Don't use constant float table on arm and riscv (#903)
Don't use constant float table on arm and riscv as LLVM doesn't generate .LPCI/.rodata like relocations on them, the float/double constants are encoded into instructions directly, so no need to lookup them from constant table. Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
This commit is contained in:
@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
#include "aot_emit_const.h"
|
||||
#include "aot_intrinsic.h"
|
||||
|
||||
bool
|
||||
aot_compile_op_i32_const(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
|
||||
@ -36,12 +37,8 @@ aot_compile_op_f32_const(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
|
||||
LLVMValueRef alloca, value;
|
||||
|
||||
if (!isnan(f32_const)) {
|
||||
if (!comp_ctx->is_indirect_mode) {
|
||||
value = F32_CONST(f32_const);
|
||||
CHECK_LLVM_CONST(value);
|
||||
PUSH_F32(value);
|
||||
}
|
||||
else {
|
||||
if (comp_ctx->is_indirect_mode
|
||||
&& aot_intrinsic_check_capability(comp_ctx, "f32.const")) {
|
||||
WASMValue wasm_value;
|
||||
memcpy(&wasm_value.f32, &f32_const, sizeof(float32));
|
||||
value = aot_load_const_from_table(comp_ctx, func_ctx->native_symbol,
|
||||
@ -51,6 +48,11 @@ aot_compile_op_f32_const(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
|
||||
}
|
||||
PUSH_F32(value);
|
||||
}
|
||||
else {
|
||||
value = F32_CONST(f32_const);
|
||||
CHECK_LLVM_CONST(value);
|
||||
PUSH_F32(value);
|
||||
}
|
||||
}
|
||||
else {
|
||||
int32 i32_const;
|
||||
@ -89,12 +91,8 @@ aot_compile_op_f64_const(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
|
||||
LLVMValueRef alloca, value;
|
||||
|
||||
if (!isnan(f64_const)) {
|
||||
if (!comp_ctx->is_indirect_mode) {
|
||||
value = F64_CONST(f64_const);
|
||||
CHECK_LLVM_CONST(value);
|
||||
PUSH_F64(value);
|
||||
}
|
||||
else {
|
||||
if (comp_ctx->is_indirect_mode
|
||||
&& aot_intrinsic_check_capability(comp_ctx, "f64.const")) {
|
||||
WASMValue wasm_value;
|
||||
memcpy(&wasm_value.f64, &f64_const, sizeof(float64));
|
||||
value = aot_load_const_from_table(comp_ctx, func_ctx->native_symbol,
|
||||
@ -104,6 +102,11 @@ aot_compile_op_f64_const(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
|
||||
}
|
||||
PUSH_F64(value);
|
||||
}
|
||||
else {
|
||||
value = F64_CONST(f64_const);
|
||||
CHECK_LLVM_CONST(value);
|
||||
PUSH_F64(value);
|
||||
}
|
||||
}
|
||||
else {
|
||||
int64 i64_const;
|
||||
|
||||
Reference in New Issue
Block a user