From 6c05590104bbadcf522875d8db2561d6ce65282e Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Mon, 1 Jun 2020 10:23:38 -0700 Subject: [PATCH] Translate Wasm's i32x4.trunc_sat_f32x4_s instruction to Cranelift's fcvt_to_sint_sat --- cranelift/wasm/src/code_translator.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cranelift/wasm/src/code_translator.rs b/cranelift/wasm/src/code_translator.rs index 20c6e3af8d..8b73f8dca6 100644 --- a/cranelift/wasm/src/code_translator.rs +++ b/cranelift/wasm/src/code_translator.rs @@ -1548,8 +1548,11 @@ pub fn translate_operator( let a = pop1_with_bitcast(state, I32X4, builder); state.push1(builder.ins().fcvt_from_uint(F32X4, a)) } - Operator::I32x4TruncSatF32x4S - | Operator::I32x4TruncSatF32x4U + Operator::I32x4TruncSatF32x4S => { + let a = pop1_with_bitcast(state, F32X4, builder); + state.push1(builder.ins().fcvt_to_sint_sat(I32X4, a)) + } + Operator::I32x4TruncSatF32x4U | Operator::I8x16Abs | Operator::I16x8Abs | Operator::I32x4Abs