Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(868)

Unified Diff: test/mjsunit/wasm/float-constant-folding.js

Issue 2662363003: [wasm] Remove -0 -x = -x folding because of signalling NaNs. (Closed)
Patch Set: Rebase Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/machine-operator-reducer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/wasm/float-constant-folding.js
diff --git a/test/mjsunit/wasm/float-constant-folding.js b/test/mjsunit/wasm/float-constant-folding.js
index 30757c403d75efb4b95356de2bfd31fc49f0de52..8e9d65320a830569501a91b822cab38f26fa4e62 100644
--- a/test/mjsunit/wasm/float-constant-folding.js
+++ b/test/mjsunit/wasm/float-constant-folding.js
@@ -25,6 +25,23 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
})();
(function() {
+ print("F32: -0 sNaN = qNaN");
+ var builder = new WasmModuleBuilder();
+ builder.addFunction("F32Sub0", kSig_i_i)
+ .addBody([
+ kExprF32Const, 0x00, 0x00, 0x00, 0x80, // 0.0
+ kExprGetLocal, 0,
+ kExprF32ReinterpretI32,
+ kExprF32Sub,
+ kExprI32ReinterpretF32,
+ ])
+ .exportFunc();
+ var module = builder.instantiate();
+ // F32Sub0(signalling_NaN)
+ assertEquals(0x7fe00000, module.exports.F32Sub0(0x7fa00000));
+})();
+
+(function() {
print("F32: sNaN - X = qNaN");
var builder = new WasmModuleBuilder();
builder.addFunction("F32NaNSubX", kSig_i_i)
@@ -92,6 +109,25 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
})();
(function() {
+ print("F64: -0 - sNaN = qNaN");
+ var builder = new WasmModuleBuilder();
+ builder.addFunction("F64Sub0", kSig_i_i)
+ .addBody([
+ kExprF64Const, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, // 0.0
+ kExprI64Const, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xf9, 0xff, 0x00,
+ kExprF64ReinterpretI64,
+ kExprF64Sub,
+ kExprI64ReinterpretF64,
+ kExprI64Const, 32,
+ kExprI64ShrU,
+ kExprI32ConvertI64,
+ ])
+ .exportFunc();
+ var module = builder.instantiate();
+ assertEquals(0x7ffa0000, module.exports.F64Sub0());
+})();
+
+(function() {
print("F64: sNaN - X = qNaN");
var builder = new WasmModuleBuilder();
builder.addFunction("F64NaNSubX", kSig_i_i)
@@ -184,6 +220,25 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
})();
(function() {
+ print("F64: sNaN / -1 = qNaN");
+ var builder = new WasmModuleBuilder();
+ builder.addFunction("F64Div1", kSig_i_i)
+ .addBody([
+ kExprI64Const, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xf9, 0xff, 0x00,
+ kExprF64ReinterpretI64,
+ kExprF64Const, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xbf,
+ kExprF64Div,
+ kExprI64ReinterpretF64,
+ kExprI64Const, 32,
+ kExprI64ShrU,
+ kExprI32ConvertI64,
+ ])
+ .exportFunc();
+ var module = builder.instantiate();
+ assertEquals(0x7ffa0000, module.exports.F64Div1());
+})();
+
+(function() {
print("F64: X / sNaN = qNaN");
var builder = new WasmModuleBuilder();
builder.addFunction("F64XDivNaN", kSig_i_i)
« no previous file with comments | « src/compiler/machine-operator-reducer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698