Implement xtensa XIP (#1202)
Lookup table for i32.const and i64.const for xtensa XIP Lookup const offset from table for load/store opcodes for xtensa XIP Fill capability flags for xtensa XIP Enable lower switch pass for xtensa XIP
This commit is contained in:
@ -61,8 +61,10 @@ static const aot_intrinsic g_intrinsic_mapping[] = {
|
||||
{ "f64_promote_f32", "aot_intrinsic_f32_to_f64", AOT_INTRINSIC_FLAG_F32_TO_F64 },
|
||||
{ "f32_cmp", "aot_intrinsic_f32_cmp", AOT_INTRINSIC_FLAG_F32_CMP },
|
||||
{ "f64_cmp", "aot_intrinsic_f64_cmp", AOT_INTRINSIC_FLAG_F64_CMP },
|
||||
{ "f32.const", NULL, AOT_INTRINSIC_FLAG_F32_CONST},
|
||||
{ "f64.const", NULL, AOT_INTRINSIC_FLAG_F64_CONST},
|
||||
{ "i32.const", NULL, AOT_INTRINSIC_FLAG_I32_CONST },
|
||||
{ "i64.const", NULL, AOT_INTRINSIC_FLAG_I64_CONST },
|
||||
{ "f32.const", NULL, AOT_INTRINSIC_FLAG_F32_CONST },
|
||||
{ "f64.const", NULL, AOT_INTRINSIC_FLAG_F64_CONST },
|
||||
};
|
||||
/* clang-format on */
|
||||
|
||||
@ -619,6 +621,19 @@ aot_intrinsic_fill_capability_flags(AOTCompContext *comp_ctx)
|
||||
add_f64_common_intrinsics(comp_ctx);
|
||||
add_common_float_integer_convertion(comp_ctx);
|
||||
}
|
||||
else if (!strncmp(comp_ctx->target_arch, "xtensa", 6)) {
|
||||
/*
|
||||
* Note: Use builtin intrinsics since hardware float operation
|
||||
* will cause rodata relocation
|
||||
*/
|
||||
add_f32_common_intrinsics(comp_ctx);
|
||||
add_f64_common_intrinsics(comp_ctx);
|
||||
add_common_float_integer_convertion(comp_ctx);
|
||||
add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_F32_CONST);
|
||||
add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_F64_CONST);
|
||||
add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_I32_CONST);
|
||||
add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_I64_CONST);
|
||||
}
|
||||
else {
|
||||
/*
|
||||
* Use constant value table by default
|
||||
|
||||
@ -58,6 +58,7 @@ extern "C" {
|
||||
#define AOT_INTRINSIC_FLAG_F32_TO_F64 AOT_INTRINSIC_FLAG(0, 24)
|
||||
#define AOT_INTRINSIC_FLAG_F32_CMP AOT_INTRINSIC_FLAG(0, 25)
|
||||
#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_F64_FADD AOT_INTRINSIC_FLAG(1, 0)
|
||||
#define AOT_INTRINSIC_FLAG_F64_FSUB AOT_INTRINSIC_FLAG(1, 1)
|
||||
@ -86,6 +87,7 @@ extern "C" {
|
||||
#define AOT_INTRINSIC_FLAG_F64_TO_F32 AOT_INTRINSIC_FLAG(1, 24)
|
||||
#define AOT_INTRINSIC_FLAG_F64_CMP AOT_INTRINSIC_FLAG(1, 25)
|
||||
#define AOT_INTRINSIC_FLAG_F64_CONST AOT_INTRINSIC_FLAG(1, 26)
|
||||
#define AOT_INTRINSIC_FLAG_I64_CONST AOT_INTRINSIC_FLAG(1, 27)
|
||||
/* clang-format on */
|
||||
|
||||
float32
|
||||
|
||||
@ -482,7 +482,7 @@ load_native_symbol_section(const uint8 *buf, const uint8 *buf_end,
|
||||
|
||||
for (i = cnt - 1; i >= 0; i--) {
|
||||
read_string(p, p_end, symbol);
|
||||
if (!strncmp(symbol, "f32#", 4)) {
|
||||
if (!strncmp(symbol, "f32#", 4) || !strncmp(symbol, "i32#", 4)) {
|
||||
uint32 u32;
|
||||
/* Resolve the raw int bits of f32 const */
|
||||
if (!str2uint32(symbol + 4, &u32)) {
|
||||
@ -492,7 +492,8 @@ load_native_symbol_section(const uint8 *buf, const uint8 *buf_end,
|
||||
}
|
||||
*(uint32 *)(&module->native_symbol_list[i]) = u32;
|
||||
}
|
||||
else if (!strncmp(symbol, "f64#", 4)) {
|
||||
else if (!strncmp(symbol, "f64#", 4)
|
||||
|| !strncmp(symbol, "i64#", 4)) {
|
||||
uint64 u64;
|
||||
/* Resolve the raw int bits of f64 const */
|
||||
if (!str2uint64(symbol + 4, &u64)) {
|
||||
|
||||
Reference in New Issue
Block a user