diff --git a/core/iwasm/compilation/simd/simd_conversions.c b/core/iwasm/compilation/simd/simd_conversions.c index e9d30bfc..8e4c17ed 100644 --- a/core/iwasm/compilation/simd/simd_conversions.c +++ b/core/iwasm/compilation/simd/simd_conversions.c @@ -158,11 +158,15 @@ simd_integer_narrow_common(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx, return false; } - /* sat */ + /* Refer to: + * https://github.com/WebAssembly/spec/blob/main/proposals/simd/SIMD.md#integer-to-integer-narrowing + * Regardless of the whether the operation is signed or unsigned, the input + * lanes are interpreted as signed integers. + */ if (!(vec1 = simd_saturate(comp_ctx, func_ctx, e_sat_i16x8, vec1, min, max, - is_signed)) + true)) || !(vec2 = simd_saturate(comp_ctx, func_ctx, e_sat_i16x8, vec2, min, - max, is_signed))) { + max, true))) { return false; } @@ -740,4 +744,4 @@ aot_compile_simd_i64x2_extmul_i32x4(AOTCompContext *comp_ctx, { return simd_integer_extmul(comp_ctx, func_ctx, lower_half, is_signed, e_i64x2_extmul_i32x4); -} \ No newline at end of file +}