Fix for issue 3327. Updates Bnot to handle case for NaN float
This commit is contained in:
@@ -1619,7 +1619,9 @@ fn lower_insn_to_regs<C: LowerCtx<I = Inst>>(
|
|||||||
let dst = get_output_reg(ctx, outputs[0]).only_reg().unwrap();
|
let dst = get_output_reg(ctx, outputs[0]).only_reg().unwrap();
|
||||||
ctx.emit(Inst::gen_move(dst, src, ty));
|
ctx.emit(Inst::gen_move(dst, src, ty));
|
||||||
let tmp = ctx.alloc_tmp(ty).only_reg().unwrap();
|
let tmp = ctx.alloc_tmp(ty).only_reg().unwrap();
|
||||||
ctx.emit(Inst::equals(ty, RegMem::from(tmp), tmp));
|
|
||||||
|
// Set tmp to all 1s before flipping the bits
|
||||||
|
ctx.emit(Inst::equals(types::I32X4, RegMem::from(tmp), tmp));
|
||||||
ctx.emit(Inst::xor(ty, RegMem::from(tmp), dst));
|
ctx.emit(Inst::xor(ty, RegMem::from(tmp), dst));
|
||||||
} else if ty == types::I128 || ty == types::B128 {
|
} else if ty == types::I128 || ty == types::B128 {
|
||||||
let src = put_input_in_regs(ctx, inputs[0]);
|
let src = put_input_in_regs(ctx, inputs[0]);
|
||||||
|
|||||||
10
tests/misc_testsuite/simd/issue_3327_bnot_lowering.wast
Normal file
10
tests/misc_testsuite/simd/issue_3327_bnot_lowering.wast
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
(; See issue https://github.com/bytecodealliance/wasmtime/issues/3327 ;)
|
||||||
|
|
||||||
|
(module
|
||||||
|
(func $v128_not (export "v128_not") (result v128)
|
||||||
|
v128.const f32x4 0 0 0 0
|
||||||
|
f32x4.abs
|
||||||
|
v128.not)
|
||||||
|
)
|
||||||
|
|
||||||
|
(assert_return (invoke "v128_not") (v128.const i32x4 -1 -1 -1 -1))
|
||||||
Reference in New Issue
Block a user