mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 953270 - Canonicalize NaN on lane access r=till
This commit is contained in:
parent
7ad0d371c9
commit
b050660309
@ -12,9 +12,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "builtin/SIMD.h"
|
#include "builtin/SIMD.h"
|
||||||
|
|
||||||
#include "jsapi.h"
|
#include "jsapi.h"
|
||||||
#include "jsfriendapi.h"
|
#include "jsfriendapi.h"
|
||||||
|
|
||||||
#include "builtin/TypedObject.h"
|
#include "builtin/TypedObject.h"
|
||||||
|
#include "js/Value.h"
|
||||||
|
|
||||||
#include "jsobjinlines.h"
|
#include "jsobjinlines.h"
|
||||||
|
|
||||||
using namespace js;
|
using namespace js;
|
||||||
@ -48,7 +52,7 @@ struct Float32x4 {
|
|||||||
*out = v.toNumber();
|
*out = v.toNumber();
|
||||||
}
|
}
|
||||||
static void setReturn(CallArgs &args, float value) {
|
static void setReturn(CallArgs &args, float value) {
|
||||||
args.rval().setDouble(value);
|
args.rval().setDouble(JS::CanonicalizeNaN(value));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
27
js/src/tests/ecma_6/TypedObject/simd/bug953270.js
Normal file
27
js/src/tests/ecma_6/TypedObject/simd/bug953270.js
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
// |reftest| skip-if(!this.hasOwnProperty("SIMD"))
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Any copyright is dedicated to the Public Domain.
|
||||||
|
* http://creativecommons.org/licenses/publicdomain/
|
||||||
|
*/
|
||||||
|
|
||||||
|
var BUGNUMBER = 953270;
|
||||||
|
var summary = 'Handles';
|
||||||
|
|
||||||
|
// Check that NaN normalization is applied when extracting the x lane
|
||||||
|
// out, after bit conversion has occurred.
|
||||||
|
|
||||||
|
var int32x4 = SIMD.int32x4;
|
||||||
|
var a = int32x4((4294967295), 200, 300, 400);
|
||||||
|
var c = SIMD.int32x4.bitsToFloat32x4(a);
|
||||||
|
|
||||||
|
// NaN canonicalization occurs when extracting out x lane:
|
||||||
|
assertEq(c.x, NaN);
|
||||||
|
|
||||||
|
// but underlying bits are faithfully transmitted
|
||||||
|
// (though reinterpreted as a signed integer):
|
||||||
|
var d = SIMD.float32x4.bitsToInt32x4(c);
|
||||||
|
assertEq(d.x, -1);
|
||||||
|
|
||||||
|
reportCompare(true, true);
|
||||||
|
print("Tests complete");
|
Loading…
Reference in New Issue
Block a user