mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 1130618: Ensure float32 coercion of inputs to Float32 MConstant; r=luke
--HG-- extra : rebase_source : 9513ab5cecb9da7aade20a332504f6865eedf660
This commit is contained in:
parent
56975be652
commit
8b314aadfe
@ -147,9 +147,6 @@ 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;
|
||||
|
@ -1,5 +1,6 @@
|
||||
load(libdir + "asm.js");
|
||||
|
||||
// Bug 1126251
|
||||
var v = asmLink(asmCompile('global', `
|
||||
"use asm";
|
||||
var frd = global.Math.fround;
|
||||
@ -34,3 +35,16 @@ var v = asmLink(asmCompile('global', `
|
||||
`), this)();
|
||||
|
||||
assertEq(v, NaN);
|
||||
|
||||
// Bug 1130618
|
||||
var v = asmLink(asmCompile('global', `
|
||||
"use asm";
|
||||
var float32x4 = global.SIMD.float32x4;
|
||||
var splat = float32x4.splat;
|
||||
function e() {
|
||||
return +splat(.1e+71).x;
|
||||
}
|
||||
return e;
|
||||
`), this)();
|
||||
|
||||
assertEq(v, Infinity);
|
||||
|
@ -629,6 +629,7 @@ MConstant *
|
||||
MConstant::NewTypedValue(TempAllocator &alloc, const Value &v, MIRType type, CompilerConstraintList *constraints)
|
||||
{
|
||||
MOZ_ASSERT(!IsSimdType(type));
|
||||
MOZ_ASSERT_IF(type == MIRType_Float32, v.toDouble() == double(float(v.toDouble())));
|
||||
MConstant *constant = new(alloc) MConstant(v, constraints);
|
||||
constant->setResultType(type);
|
||||
return constant;
|
||||
@ -637,6 +638,8 @@ MConstant::NewTypedValue(TempAllocator &alloc, const Value &v, MIRType type, Com
|
||||
MConstant *
|
||||
MConstant::NewAsmJS(TempAllocator &alloc, const Value &v, MIRType type)
|
||||
{
|
||||
if (type == MIRType_Float32)
|
||||
return NewTypedValue(alloc, Float32Value(v.toNumber()), type);
|
||||
return NewTypedValue(alloc, v, type);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user