OLD | NEW |
---|---|
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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
177 kExprI64Const, 32, | 177 kExprI64Const, 32, |
178 kExprI64ShrU, | 178 kExprI64ShrU, |
179 kExprI32ConvertI64, | 179 kExprI32ConvertI64, |
180 ]) | 180 ]) |
181 .exportFunc(); | 181 .exportFunc(); |
182 var module = builder.instantiate(); | 182 var module = builder.instantiate(); |
183 assertEquals(0x7ffa0000, module.exports.F64Div1()); | 183 assertEquals(0x7ffa0000, module.exports.F64Div1()); |
184 })(); | 184 })(); |
185 | 185 |
186 (function() { | 186 (function() { |
187 print("F64: sNaN / -1 = qNaN"); | |
188 var builder = new WasmModuleBuilder(); | |
189 builder.addFunction("F64Div1", kSig_i_i) | |
190 .addBody([ | |
191 kExprI64Const, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xf9, 0xff, 0x00, | |
192 kExprF64ReinterpretI64, | |
titzer
2017/01/31 17:24:49
Can't this just be a F64Const?
ahaas
2017/01/31 19:43:37
Actually no, for two reasons:
1) Other constant fo
| |
193 kExprF64Const, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xbf, | |
194 kExprF64Div, | |
195 kExprI64ReinterpretF64, | |
196 kExprI64Const, 32, | |
197 kExprI64ShrU, | |
198 kExprI32ConvertI64, | |
199 ]) | |
200 .exportFunc(); | |
201 var module = builder.instantiate(); | |
202 assertEquals(0x7ffa0000, module.exports.F64Div1()); | |
203 })(); | |
204 | |
205 (function() { | |
187 print("F64: X / sNaN = qNaN"); | 206 print("F64: X / sNaN = qNaN"); |
188 var builder = new WasmModuleBuilder(); | 207 var builder = new WasmModuleBuilder(); |
189 builder.addFunction("F64XDivNaN", kSig_i_i) | 208 builder.addFunction("F64XDivNaN", kSig_i_i) |
190 .addBody([ | 209 .addBody([ |
191 kExprF64Const, 0xde, 0xbc, 0x0a, 0x89, 0x67, 0x45, 0x23, 0x01, | 210 kExprF64Const, 0xde, 0xbc, 0x0a, 0x89, 0x67, 0x45, 0x23, 0x01, |
192 kExprF64Const, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf2, 0x7f, | 211 kExprF64Const, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf2, 0x7f, |
193 kExprF64Div, | 212 kExprF64Div, |
194 kExprI64ReinterpretF64, | 213 kExprI64ReinterpretF64, |
195 kExprI64Const, 32, | 214 kExprI64Const, 32, |
196 kExprI64ShrU, | 215 kExprI64ShrU, |
(...skipping 14 matching lines...) Expand all Loading... | |
211 kExprF64Div, | 230 kExprF64Div, |
212 kExprI64ReinterpretF64, | 231 kExprI64ReinterpretF64, |
213 kExprI64Const, 32, | 232 kExprI64Const, 32, |
214 kExprI64ShrU, | 233 kExprI64ShrU, |
215 kExprI32ConvertI64, | 234 kExprI32ConvertI64, |
216 ]) | 235 ]) |
217 .exportFunc(); | 236 .exportFunc(); |
218 var module = builder.instantiate(); | 237 var module = builder.instantiate(); |
219 assertEquals(0x7ffa0000, module.exports.F64NaNDivX()); | 238 assertEquals(0x7ffa0000, module.exports.F64NaNDivX()); |
220 })(); | 239 })(); |
OLD | NEW |