Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: three unsigned narrow op should be interpreted as signed as the simd proposal #2850

Merged
merged 2 commits into from
Jan 3, 2024
Merged
Changes from all 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
12 changes: 8 additions & 4 deletions core/iwasm/compilation/simd/simd_conversions.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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);
}
}
Loading