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

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

Issue 2662233002: [wasm] Remove x / -1 = -x constant folding for wasm (Closed)
Patch Set: Rebase Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 the V8 project authors. All rights reserved. 1 // Copyright 2017 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Flags: --expose-wasm 5 // Flags: --expose-wasm
6 6
7 load("test/mjsunit/wasm/wasm-constants.js"); 7 load("test/mjsunit/wasm/wasm-constants.js");
8 load("test/mjsunit/wasm/wasm-module-builder.js"); 8 load("test/mjsunit/wasm/wasm-module-builder.js");
9 9
10 (function() { 10 (function() {
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 kExprI64Const, 32, 232 kExprI64Const, 32,
233 kExprI64ShrU, 233 kExprI64ShrU,
234 kExprI32ConvertI64, 234 kExprI32ConvertI64,
235 ]) 235 ])
236 .exportFunc(); 236 .exportFunc();
237 var module = builder.instantiate(); 237 var module = builder.instantiate();
238 assertEquals(0x7ffa0000, module.exports.F64Div1()); 238 assertEquals(0x7ffa0000, module.exports.F64Div1());
239 })(); 239 })();
240 240
241 (function() { 241 (function() {
242 print("F64: sNaN / -1 = qNaN");
243 var builder = new WasmModuleBuilder();
244 builder.addFunction("F64Div1", kSig_i_i)
245 .addBody([
246 kExprI64Const, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xf9, 0xff, 0x00,
247 kExprF64ReinterpretI64,
248 kExprF64Const, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xbf,
249 kExprF64Div,
250 kExprI64ReinterpretF64,
251 kExprI64Const, 32,
252 kExprI64ShrU,
253 kExprI32ConvertI64,
254 ])
255 .exportFunc();
256 var module = builder.instantiate();
257 assertEquals(0x7ffa0000, module.exports.F64Div1());
258 })();
259
260 (function() {
242 print("F64: X / sNaN = qNaN"); 261 print("F64: X / sNaN = qNaN");
243 var builder = new WasmModuleBuilder(); 262 var builder = new WasmModuleBuilder();
244 builder.addFunction("F64XDivNaN", kSig_i_i) 263 builder.addFunction("F64XDivNaN", kSig_i_i)
245 .addBody([ 264 .addBody([
246 kExprF64Const, 0xde, 0xbc, 0x0a, 0x89, 0x67, 0x45, 0x23, 0x01, 265 kExprF64Const, 0xde, 0xbc, 0x0a, 0x89, 0x67, 0x45, 0x23, 0x01,
247 kExprF64Const, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf2, 0x7f, 266 kExprF64Const, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf2, 0x7f,
248 kExprF64Div, 267 kExprF64Div,
249 kExprI64ReinterpretF64, 268 kExprI64ReinterpretF64,
250 kExprI64Const, 32, 269 kExprI64Const, 32,
251 kExprI64ShrU, 270 kExprI64ShrU,
(...skipping 14 matching lines...) Expand all
266 kExprF64Div, 285 kExprF64Div,
267 kExprI64ReinterpretF64, 286 kExprI64ReinterpretF64,
268 kExprI64Const, 32, 287 kExprI64Const, 32,
269 kExprI64ShrU, 288 kExprI64ShrU,
270 kExprI32ConvertI64, 289 kExprI32ConvertI64,
271 ]) 290 ])
272 .exportFunc(); 291 .exportFunc();
273 var module = builder.instantiate(); 292 var module = builder.instantiate();
274 assertEquals(0x7ffa0000, module.exports.F64NaNDivX()); 293 assertEquals(0x7ffa0000, module.exports.F64NaNDivX());
275 })(); 294 })();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698