Implement i32.rem_s and i32.rem_u intrinsic (#1789)
This commit is contained in:
@ -69,6 +69,8 @@ static const aot_intrinsic g_intrinsic_mapping[] = {
|
||||
{ "f64.const", NULL, AOT_INTRINSIC_FLAG_F64_CONST },
|
||||
{ "i64.div_s", "aot_intrinsic_i64_div_s", AOT_INTRINSIC_FLAG_I64_DIV_S},
|
||||
{ "i32.div_u", "aot_intrinsic_i32_div_u", AOT_INTRINSIC_FLAG_I32_DIV_U},
|
||||
{ "i32.rem_s", "aot_intrinsic_i32_rem_s", AOT_INTRINSIC_FLAG_I32_REM_S},
|
||||
{ "i32.rem_u", "aot_intrinsic_i32_rem_u", AOT_INTRINSIC_FLAG_I32_REM_U},
|
||||
{ "i64.div_u", "aot_intrinsic_i64_div_u", AOT_INTRINSIC_FLAG_I64_DIV_U},
|
||||
{ "i64.rem_s", "aot_intrinsic_i64_rem_s", AOT_INTRINSIC_FLAG_I64_REM_S},
|
||||
{ "i64.rem_u", "aot_intrinsic_i64_rem_u", AOT_INTRINSIC_FLAG_I64_REM_U},
|
||||
@ -508,6 +510,18 @@ aot_intrinsic_i32_div_u(uint32 l, uint32 r)
|
||||
return l / r;
|
||||
}
|
||||
|
||||
int32
|
||||
aot_intrinsic_i32_rem_s(int32 l, int32 r)
|
||||
{
|
||||
return l % r;
|
||||
}
|
||||
|
||||
uint32
|
||||
aot_intrinsic_i32_rem_u(uint32 l, uint32 r)
|
||||
{
|
||||
return l % r;
|
||||
}
|
||||
|
||||
uint64
|
||||
aot_intrinsic_i64_div_u(uint64 l, uint64 r)
|
||||
{
|
||||
@ -580,6 +594,8 @@ static void
|
||||
add_i32_common_intrinsics(AOTCompContext *comp_ctx)
|
||||
{
|
||||
add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_I32_DIV_U);
|
||||
add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_I32_REM_S);
|
||||
add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_I32_REM_U);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -675,6 +691,7 @@ aot_intrinsic_fill_capability_flags(AOTCompContext *comp_ctx)
|
||||
return;
|
||||
|
||||
if (!strncmp(comp_ctx->target_arch, "thumb", 5)) {
|
||||
add_i32_common_intrinsics(comp_ctx);
|
||||
if (!strcmp(comp_ctx->target_cpu, "cortex-m7")) {
|
||||
}
|
||||
else if (!strcmp(comp_ctx->target_cpu, "cortex-m4")) {
|
||||
|
||||
@ -60,6 +60,8 @@ extern "C" {
|
||||
#define AOT_INTRINSIC_FLAG_F32_CONST AOT_INTRINSIC_FLAG(0, 26)
|
||||
#define AOT_INTRINSIC_FLAG_I32_CONST AOT_INTRINSIC_FLAG(0, 27)
|
||||
#define AOT_INTRINSIC_FLAG_I32_DIV_U AOT_INTRINSIC_FLAG(0, 28)
|
||||
#define AOT_INTRINSIC_FLAG_I32_REM_S AOT_INTRINSIC_FLAG(0, 29)
|
||||
#define AOT_INTRINSIC_FLAG_I32_REM_U AOT_INTRINSIC_FLAG(0, 30)
|
||||
|
||||
#define AOT_INTRINSIC_FLAG_F64_FADD AOT_INTRINSIC_FLAG(1, 0)
|
||||
#define AOT_INTRINSIC_FLAG_F64_FSUB AOT_INTRINSIC_FLAG(1, 1)
|
||||
@ -260,6 +262,12 @@ aot_intrinsic_i64_div_s(int64 l, int64 r);
|
||||
uint32
|
||||
aot_intrinsic_i32_div_u(uint32 l, uint32 r);
|
||||
|
||||
int32
|
||||
aot_intrinsic_i32_rem_s(int32 l, int32 r);
|
||||
|
||||
uint32
|
||||
aot_intrinsic_i32_rem_u(uint32 l, uint32 r);
|
||||
|
||||
uint64
|
||||
aot_intrinsic_i64_div_u(uint64 l, uint64 r);
|
||||
|
||||
|
||||
@ -115,6 +115,8 @@ typedef struct {
|
||||
REG_SYM(aot_intrinsic_i64_bit_or), \
|
||||
REG_SYM(aot_intrinsic_i64_bit_and), \
|
||||
REG_SYM(aot_intrinsic_i32_div_u), \
|
||||
REG_SYM(aot_intrinsic_i32_rem_s), \
|
||||
REG_SYM(aot_intrinsic_i32_rem_u), \
|
||||
|
||||
#define REG_COMMON_SYMBOLS \
|
||||
REG_SYM(aot_set_exception_with_id), \
|
||||
|
||||
Reference in New Issue
Block a user