mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1126251: Force float32 coercion of Float AsmJSNumLit input; r=luke
This commit is contained in:
parent
ea7c16928c
commit
462648786d
@ -147,6 +147,9 @@ class AsmJSNumLit
|
||||
static AsmJSNumLit Create(Which w, Value v) {
|
||||
AsmJSNumLit lit;
|
||||
lit.which_ = w;
|
||||
// Force float32 coercion, as the caller may have not done it.
|
||||
if (w == Float)
|
||||
v = Float32Value(v.toNumber());
|
||||
lit.value.scalar_ = v;
|
||||
MOZ_ASSERT(!lit.isSimd());
|
||||
return lit;
|
||||
|
36
js/src/jit-test/tests/asm.js/bug1126251.js
Normal file
36
js/src/jit-test/tests/asm.js/bug1126251.js
Normal file
@ -0,0 +1,36 @@
|
||||
load(libdir + "asm.js");
|
||||
|
||||
var v = asmLink(asmCompile('global', `
|
||||
"use asm";
|
||||
var frd = global.Math.fround;
|
||||
function e() {
|
||||
var x = frd(.1e+71);
|
||||
x = frd(x / x);
|
||||
return +x;
|
||||
}
|
||||
return e;
|
||||
`), this)();
|
||||
|
||||
assertEq(v, NaN);
|
||||
|
||||
if (!isSimdAvailable() || typeof SIMD === 'undefined') {
|
||||
quit(0);
|
||||
}
|
||||
|
||||
var v = asmLink(asmCompile('global', `
|
||||
"use asm";
|
||||
var frd = global.Math.fround;
|
||||
var float32x4 = global.SIMD.float32x4;
|
||||
var splat = float32x4.splat;
|
||||
function e() {
|
||||
var v = float32x4(0,0,0,0);
|
||||
var x = frd(0.);
|
||||
v = splat(.1e+71);
|
||||
x = v.x;
|
||||
x = frd(x / x);
|
||||
return +x;
|
||||
}
|
||||
return e;
|
||||
`), this)();
|
||||
|
||||
assertEq(v, NaN);
|
Loading…
Reference in New Issue
Block a user