Fix for issue 3327. Updates Bnot to handle case for NaN float

This commit is contained in:
Johnnie Birch
2021-11-11 17:33:50 -08:00
parent b530d283e4
commit 5d5629de60
2 changed files with 13 additions and 1 deletions

View File

@@ -1619,7 +1619,9 @@ fn lower_insn_to_regs<C: LowerCtx<I = Inst>>(
let dst = get_output_reg(ctx, outputs[0]).only_reg().unwrap();
ctx.emit(Inst::gen_move(dst, src, ty));
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));
} else if ty == types::I128 || ty == types::B128 {
let src = put_input_in_regs(ctx, inputs[0]);

View 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))