OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 #include <stdint.h> | 5 #include <stdint.h> |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/wasm/wasm-macro-gen.h" | 10 #include "src/wasm/wasm-macro-gen.h" |
(...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1312 BUILD(r, WASM_I64_REINTERPRET_F64( | 1312 BUILD(r, WASM_I64_REINTERPRET_F64( |
1313 WASM_LOAD_MEM(MachineType::Float64(), WASM_ZERO))); | 1313 WASM_LOAD_MEM(MachineType::Float64(), WASM_ZERO))); |
1314 | 1314 |
1315 FOR_INT32_INPUTS(i) { | 1315 FOR_INT32_INPUTS(i) { |
1316 int64_t expected = static_cast<int64_t>(*i) * 0x300010001; | 1316 int64_t expected = static_cast<int64_t>(*i) * 0x300010001; |
1317 r.module().WriteMemory(&memory[0], expected); | 1317 r.module().WriteMemory(&memory[0], expected); |
1318 CHECK_EQ(expected, r.Call()); | 1318 CHECK_EQ(expected, r.Call()); |
1319 } | 1319 } |
1320 } | 1320 } |
1321 | 1321 |
| 1322 // Do not run this test in a simulator because of signalling NaN issues on ia32. |
| 1323 #ifndef USE_SIMULATOR |
| 1324 |
1322 WASM_EXEC_TEST(SignallingNanSurvivesI64ReinterpretF64) { | 1325 WASM_EXEC_TEST(SignallingNanSurvivesI64ReinterpretF64) { |
1323 REQUIRE(I64ReinterpretF64); | 1326 REQUIRE(I64ReinterpretF64); |
1324 WasmRunner<int64_t> r(execution_mode); | 1327 WasmRunner<int64_t> r(execution_mode); |
1325 BUILD(r, WASM_I64_REINTERPRET_F64(WASM_SEQ(kExprF64Const, 0x00, 0x00, 0x00, | 1328 BUILD(r, WASM_I64_REINTERPRET_F64(WASM_SEQ(kExprF64Const, 0x00, 0x00, 0x00, |
1326 0x00, 0x00, 0x00, 0xf4, 0x7f))); | 1329 0x00, 0x00, 0x00, 0xf4, 0x7f))); |
1327 | 1330 |
1328 // This is a signalling nan. | 1331 // This is a signalling nan. |
1329 CHECK_EQ(0x7ff4000000000000, r.Call()); | 1332 CHECK_EQ(0x7ff4000000000000, r.Call()); |
1330 } | 1333 } |
| 1334 #endif |
1331 | 1335 |
1332 WASM_EXEC_TEST(F64ReinterpretI64) { | 1336 WASM_EXEC_TEST(F64ReinterpretI64) { |
1333 REQUIRE(F64ReinterpretI64); | 1337 REQUIRE(F64ReinterpretI64); |
1334 WasmRunner<int64_t, int64_t> r(execution_mode); | 1338 WasmRunner<int64_t, int64_t> r(execution_mode); |
1335 int64_t* memory = r.module().AddMemoryElems<int64_t>(8); | 1339 int64_t* memory = r.module().AddMemoryElems<int64_t>(8); |
1336 | 1340 |
1337 BUILD(r, WASM_STORE_MEM(MachineType::Float64(), WASM_ZERO, | 1341 BUILD(r, WASM_STORE_MEM(MachineType::Float64(), WASM_ZERO, |
1338 WASM_F64_REINTERPRET_I64(WASM_GET_LOCAL(0))), | 1342 WASM_F64_REINTERPRET_I64(WASM_GET_LOCAL(0))), |
1339 WASM_GET_LOCAL(0)); | 1343 WASM_GET_LOCAL(0)); |
1340 | 1344 |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1641 r.module().AddMemoryElems<int64_t>(8); | 1645 r.module().AddMemoryElems<int64_t>(8); |
1642 | 1646 |
1643 BUILD(r, kExprI64Const, 0x00, // -- | 1647 BUILD(r, kExprI64Const, 0x00, // -- |
1644 kExprI32ConvertI64, // -- | 1648 kExprI32ConvertI64, // -- |
1645 kExprI64Const, 0x00, // -- | 1649 kExprI64Const, 0x00, // -- |
1646 kExprI64StoreMem, 0x03, 0x00, // -- | 1650 kExprI64StoreMem, 0x03, 0x00, // -- |
1647 kExprI32Const, 0x00); // -- | 1651 kExprI32Const, 0x00); // -- |
1648 | 1652 |
1649 r.Call(); | 1653 r.Call(); |
1650 } | 1654 } |
OLD | NEW |