Closed Bug 1799014 Opened 2 years ago Closed 2 years ago

f64x2.max produces incorrect result when 0 compared with -0

Categories

(Core :: JavaScript: WebAssembly, defect)

defect

Tracking

()

RESOLVED FIXED
108 Branch
Tracking Status
firefox108 --- fixed

People

(Reporter: yury, Assigned: yury)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

The script case below outputs 0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,128:

const wasm = wasmTextToBinary(`(module
  (memory (export "memory") 1 1)
  (func (export "f64x2.max") (param v128 v128) (result v128) (f64x2.max (local.get 0) (local.get 1)))
  (func (export "f")
      i32.const 0
      v128.const f64x2 0.0 0.0
      v128.const f64x2 -0.0 -0.0
      call 0
      v128.store)
)`);
const mod = new WebAssembly.Module(wasm);
const ins = new WebAssembly.Instance(mod);

ins.exports.f();
const mem = ins.exports.memory.buffer;
console.log(new Uint8Array(mem, 0, 16));

Expected all 0

Affects only AVX lowering: works as expected with --no-avx

Addresses wrong refactoring/optimization of the
minMaxFloat32x4AVX and minMaxFloat64x2AVX functions.

Testing of this case is covered by spec tests.
(Also to be addressed in bug 1797194)

Assignee: nobody → ydelendik
Status: NEW → ASSIGNED
Pushed by ydelendik@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a2a4b5166fd5 Fix f64x2./f32x4.max for AVX cpus. r=rhunt
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 108 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: