@@ -347,20 +347,8 @@ aot_compile_op_i32_trunc_f32(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
347347
348348 POP_F32 (value );
349349
350- #if !defined(BUILD_TARGET_XTENSA )
351- if (!comp_ctx -> is_indirect_mode ) {
352- #endif
353- if (sign ) {
354- min_value = F32_CONST (-2147483904.0f );
355- max_value = F32_CONST (2147483648.0f );
356- }
357- else {
358- min_value = F32_CONST (-1.0f );
359- max_value = F32_CONST (4294967296.0f );
360- }
361- #if !defined(BUILD_TARGET_XTENSA )
362- }
363- else {
350+ if (comp_ctx -> is_indirect_mode
351+ && aot_intrinsic_check_capability (comp_ctx , "f32.const" )) {
364352 WASMValue wasm_value ;
365353 if (sign ) {
366354 wasm_value .f32 = -2147483904.0f ;
@@ -379,7 +367,16 @@ aot_compile_op_i32_trunc_f32(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
379367 comp_ctx , func_ctx -> native_symbol , & wasm_value , VALUE_TYPE_F32 );
380368 }
381369 }
382- #endif
370+ else {
371+ if (sign ) {
372+ min_value = F32_CONST (-2147483904.0f );
373+ max_value = F32_CONST (2147483648.0f );
374+ }
375+ else {
376+ min_value = F32_CONST (-1.0f );
377+ max_value = F32_CONST (4294967296.0f );
378+ }
379+ }
383380 CHECK_LLVM_CONST (min_value );
384381 CHECK_LLVM_CONST (max_value );
385382
@@ -404,20 +401,8 @@ aot_compile_op_i32_trunc_f64(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
404401
405402 POP_F64 (value );
406403
407- #if !defined(BUILD_TARGET_XTENSA )
408- if (!comp_ctx -> is_indirect_mode ) {
409- #endif
410- if (sign ) {
411- min_value = F64_CONST (-2147483649.0 );
412- max_value = F64_CONST (2147483648.0 );
413- }
414- else {
415- min_value = F64_CONST (-1.0 );
416- max_value = F64_CONST (4294967296.0 );
417- }
418- #if !defined(BUILD_TARGET_XTENSA )
419- }
420- else {
404+ if (comp_ctx -> is_indirect_mode
405+ && aot_intrinsic_check_capability (comp_ctx , "f64.const" )) {
421406 WASMValue wasm_value ;
422407 if (sign ) {
423408 wasm_value .f64 = -2147483649.0 ;
@@ -436,7 +421,16 @@ aot_compile_op_i32_trunc_f64(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
436421 comp_ctx , func_ctx -> native_symbol , & wasm_value , VALUE_TYPE_F64 );
437422 }
438423 }
439- #endif
424+ else {
425+ if (sign ) {
426+ min_value = F64_CONST (-2147483649.0 );
427+ max_value = F64_CONST (2147483648.0 );
428+ }
429+ else {
430+ min_value = F64_CONST (-1.0 );
431+ max_value = F64_CONST (4294967296.0 );
432+ }
433+ }
440434 CHECK_LLVM_CONST (min_value );
441435 CHECK_LLVM_CONST (max_value );
442436
@@ -562,20 +556,8 @@ aot_compile_op_i64_trunc_f32(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
562556
563557 POP_F32 (value );
564558
565- #if !defined(BUILD_TARGET_XTENSA )
566- if (!comp_ctx -> is_indirect_mode ) {
567- #endif
568- if (sign ) {
569- min_value = F32_CONST (-9223373136366403584.0f );
570- max_value = F32_CONST (9223372036854775808.0f );
571- }
572- else {
573- min_value = F32_CONST (-1.0f );
574- max_value = F32_CONST (18446744073709551616.0f );
575- }
576- #if !defined(BUILD_TARGET_XTENSA )
577- }
578- else {
559+ if (comp_ctx -> is_indirect_mode
560+ && aot_intrinsic_check_capability (comp_ctx , "f32.const" )) {
579561 WASMValue wasm_value ;
580562 if (sign ) {
581563 wasm_value .f32 = -9223373136366403584.0f ;
@@ -594,7 +576,16 @@ aot_compile_op_i64_trunc_f32(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
594576 comp_ctx , func_ctx -> native_symbol , & wasm_value , VALUE_TYPE_F32 );
595577 }
596578 }
597- #endif
579+ else {
580+ if (sign ) {
581+ min_value = F32_CONST (-9223373136366403584.0f );
582+ max_value = F32_CONST (9223372036854775808.0f );
583+ }
584+ else {
585+ min_value = F32_CONST (-1.0f );
586+ max_value = F32_CONST (18446744073709551616.0f );
587+ }
588+ }
598589 CHECK_LLVM_CONST (min_value );
599590 CHECK_LLVM_CONST (max_value );
600591
@@ -619,20 +610,8 @@ aot_compile_op_i64_trunc_f64(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
619610
620611 POP_F64 (value );
621612
622- #if !defined(BUILD_TARGET_XTENSA )
623- if (!comp_ctx -> is_indirect_mode ) {
624- #endif
625- if (sign ) {
626- min_value = F64_CONST (-9223372036854777856.0 );
627- max_value = F64_CONST (9223372036854775808.0 );
628- }
629- else {
630- min_value = F64_CONST (-1.0 );
631- max_value = F64_CONST (18446744073709551616.0 );
632- }
633- #if !defined(BUILD_TARGET_XTENSA )
634- }
635- else {
613+ if (comp_ctx -> is_indirect_mode
614+ && aot_intrinsic_check_capability (comp_ctx , "f64.const" )) {
636615 WASMValue wasm_value ;
637616 if (sign ) {
638617 wasm_value .f64 = -9223372036854777856.0 ;
@@ -651,7 +630,16 @@ aot_compile_op_i64_trunc_f64(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
651630 comp_ctx , func_ctx -> native_symbol , & wasm_value , VALUE_TYPE_F64 );
652631 }
653632 }
654- #endif
633+ else {
634+ if (sign ) {
635+ min_value = F64_CONST (-9223372036854777856.0 );
636+ max_value = F64_CONST (9223372036854775808.0 );
637+ }
638+ else {
639+ min_value = F64_CONST (-1.0 );
640+ max_value = F64_CONST (18446744073709551616.0 );
641+ }
642+ }
655643 CHECK_LLVM_CONST (min_value );
656644 CHECK_LLVM_CONST (max_value );
657645
0 commit comments