wazevo(amd64): fixes u32 i->f conv with higher bits garbage (#2136)
Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
This commit is contained in:
@@ -2866,9 +2866,11 @@ func (m *machine) lowerFcvtFromUint(rn, rd operand, src64, dst64 bool) {
|
||||
// >> which allows CVTSI2SS to be used after all.
|
||||
//
|
||||
if !src64 {
|
||||
cvt := m.allocateInstr()
|
||||
cvt.asGprToXmm(op, rn, rd.reg(), true)
|
||||
m.insert(cvt)
|
||||
// Before we convert, we have to clear the higher 32-bits of the 64-bit register
|
||||
// to get the correct result.
|
||||
tmp := m.c.AllocateVReg(ssa.TypeI32)
|
||||
m.insert(m.allocateInstr().asMovzxRmR(extModeLQ, rn, tmp))
|
||||
m.insert(m.allocateInstr().asGprToXmm(op, newOperandReg(tmp), rd.reg(), true))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -1056,3 +1056,10 @@ func Test2131(t *testing.T) {
|
||||
}
|
||||
nodiff.RequireNoDiffT(t, getWasmBinary(t, "2131"), true, true)
|
||||
}
|
||||
|
||||
func Test2136(t *testing.T) {
|
||||
if !platform.CompilerSupported() {
|
||||
return
|
||||
}
|
||||
nodiff.RequireNoDiffT(t, getWasmBinary(t, "2136"), true, true)
|
||||
}
|
||||
|
||||
BIN
internal/integration_test/fuzzcases/testdata/2136.wasm
vendored
Normal file
BIN
internal/integration_test/fuzzcases/testdata/2136.wasm
vendored
Normal file
Binary file not shown.
11
internal/integration_test/fuzzcases/testdata/2136.wat
vendored
Normal file
11
internal/integration_test/fuzzcases/testdata/2136.wat
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
(module
|
||||
(type (;0;) (func (result f32)))
|
||||
(func (;0;) (type 0) (result f32)
|
||||
i32.const 0
|
||||
i32.load8_s
|
||||
f32.convert_i32_u
|
||||
)
|
||||
(memory (;0;) 3 8)
|
||||
(export "" (func 0))
|
||||
(data (;0;) (i32.const 0) "\f2")
|
||||
)
|
||||
Reference in New Issue
Block a user