Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions core/iwasm/compilation/aot_emit_const.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ aot_compile_op_i32_const(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
{
LLVMValueRef value;

#if !defined(BUILD_TARGET_XTENSA)
Comment thread
lum1n0us marked this conversation as resolved.
Outdated
if (comp_ctx->is_indirect_mode
&& aot_intrinsic_check_capability(comp_ctx, "i32.const")) {
WASMValue wasm_value;
Expand All @@ -22,7 +23,9 @@ aot_compile_op_i32_const(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
return false;
}
}
else {
else
#endif
{
value = I32_CONST((uint32)i32_const);
CHECK_LLVM_CONST(value);
}
Expand All @@ -40,6 +43,7 @@ aot_compile_op_i64_const(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
{
LLVMValueRef value;

#if !defined(BUILD_TARGET_XTENSA)
if (comp_ctx->is_indirect_mode
&& aot_intrinsic_check_capability(comp_ctx, "i64.const")) {
WASMValue wasm_value;
Expand All @@ -50,7 +54,9 @@ aot_compile_op_i64_const(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
return false;
}
}
else {
else
#endif
{
value = I64_CONST((uint64)i64_const);
CHECK_LLVM_CONST(value);
}
Expand All @@ -68,6 +74,7 @@ aot_compile_op_f32_const(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
{
LLVMValueRef alloca, value;

#if !defined(BUILD_TARGET_XTENSA)
if (comp_ctx->is_indirect_mode
&& aot_intrinsic_check_capability(comp_ctx, "f32.const")) {
WASMValue wasm_value;
Expand All @@ -80,6 +87,9 @@ aot_compile_op_f32_const(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
PUSH_F32(value);
}
else if (!isnan(f32_const)) {
#else
if (!isnan(f32_const)) {
#endif
value = F32_CONST(f32_const);
CHECK_LLVM_CONST(value);
PUSH_F32(value);
Expand Down Expand Up @@ -121,6 +131,7 @@ aot_compile_op_f64_const(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
{
LLVMValueRef alloca, value;

#if !defined(BUILD_TARGET_XTENSA)
if (comp_ctx->is_indirect_mode
&& aot_intrinsic_check_capability(comp_ctx, "f64.const")) {
WASMValue wasm_value;
Expand All @@ -133,6 +144,9 @@ aot_compile_op_f64_const(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
PUSH_F64(value);
}
else if (!isnan(f64_const)) {
#else
if (!isnan(f64_const)) {
#endif
value = F64_CONST(f64_const);
CHECK_LLVM_CONST(value);
PUSH_F64(value);
Expand Down
16 changes: 16 additions & 0 deletions core/iwasm/compilation/aot_emit_conversion.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,9 @@ aot_compile_op_i32_trunc_f32(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,

POP_F32(value);

#if !defined(BUILD_TARGET_XTENSA)
if (!comp_ctx->is_indirect_mode) {
#endif
if (sign) {
min_value = F32_CONST(-2147483904.0f);
max_value = F32_CONST(2147483648.0f);
Expand All @@ -356,6 +358,7 @@ aot_compile_op_i32_trunc_f32(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
min_value = F32_CONST(-1.0f);
max_value = F32_CONST(4294967296.0f);
}
#if !defined(BUILD_TARGET_XTENSA)
}
else {
WASMValue wasm_value;
Expand All @@ -376,6 +379,7 @@ aot_compile_op_i32_trunc_f32(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
comp_ctx, func_ctx->native_symbol, &wasm_value, VALUE_TYPE_F32);
}
}
#endif
CHECK_LLVM_CONST(min_value);
CHECK_LLVM_CONST(max_value);

Expand All @@ -400,7 +404,9 @@ aot_compile_op_i32_trunc_f64(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,

POP_F64(value);

#if !defined(BUILD_TARGET_XTENSA)
if (!comp_ctx->is_indirect_mode) {
#endif
if (sign) {
min_value = F64_CONST(-2147483649.0);
max_value = F64_CONST(2147483648.0);
Expand All @@ -409,6 +415,7 @@ aot_compile_op_i32_trunc_f64(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
min_value = F64_CONST(-1.0);
max_value = F64_CONST(4294967296.0);
}
#if !defined(BUILD_TARGET_XTENSA)
}
else {
WASMValue wasm_value;
Expand All @@ -429,6 +436,7 @@ aot_compile_op_i32_trunc_f64(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
comp_ctx, func_ctx->native_symbol, &wasm_value, VALUE_TYPE_F64);
}
}
#endif
CHECK_LLVM_CONST(min_value);
CHECK_LLVM_CONST(max_value);

Expand Down Expand Up @@ -554,7 +562,9 @@ aot_compile_op_i64_trunc_f32(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,

POP_F32(value);

#if !defined(BUILD_TARGET_XTENSA)
if (!comp_ctx->is_indirect_mode) {
#endif
if (sign) {
min_value = F32_CONST(-9223373136366403584.0f);
max_value = F32_CONST(9223372036854775808.0f);
Expand All @@ -563,6 +573,7 @@ aot_compile_op_i64_trunc_f32(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
min_value = F32_CONST(-1.0f);
max_value = F32_CONST(18446744073709551616.0f);
}
#if !defined(BUILD_TARGET_XTENSA)
}
else {
WASMValue wasm_value;
Expand All @@ -583,6 +594,7 @@ aot_compile_op_i64_trunc_f32(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
comp_ctx, func_ctx->native_symbol, &wasm_value, VALUE_TYPE_F32);
}
}
#endif
CHECK_LLVM_CONST(min_value);
CHECK_LLVM_CONST(max_value);

Expand All @@ -607,7 +619,9 @@ aot_compile_op_i64_trunc_f64(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,

POP_F64(value);

#if !defined(BUILD_TARGET_XTENSA)
if (!comp_ctx->is_indirect_mode) {
#endif
if (sign) {
min_value = F64_CONST(-9223372036854777856.0);
max_value = F64_CONST(9223372036854775808.0);
Expand All @@ -616,6 +630,7 @@ aot_compile_op_i64_trunc_f64(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
min_value = F64_CONST(-1.0);
max_value = F64_CONST(18446744073709551616.0);
}
#if !defined(BUILD_TARGET_XTENSA)
}
else {
WASMValue wasm_value;
Expand All @@ -636,6 +651,7 @@ aot_compile_op_i64_trunc_f64(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
comp_ctx, func_ctx->native_symbol, &wasm_value, VALUE_TYPE_F64);
}
}
#endif
CHECK_LLVM_CONST(min_value);
CHECK_LLVM_CONST(max_value);

Expand Down
5 changes: 4 additions & 1 deletion core/iwasm/compilation/aot_emit_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ aot_check_memory_overflow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,

is_target_64bit = (comp_ctx->pointer_size == sizeof(uint64)) ? true : false;

#if !defined(BUILD_TARGET_XTENSA)
if (comp_ctx->is_indirect_mode
&& aot_intrinsic_check_capability(
comp_ctx, MEMORY64_COND_VALUE("i64.const", "i32.const"))) {
Expand All @@ -159,7 +160,9 @@ aot_check_memory_overflow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
return NULL;
}
}
else {
else
#endif
{
CHECK_LLVM_CONST(offset_const);
}

Expand Down
Loading