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/wasm/wasm-macro-gen.h" | 9 #include "src/wasm/wasm-macro-gen.h" |
10 | 10 |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
253 // kExprI64ReinterpretF64: | 253 // kExprI64ReinterpretF64: |
254 | 254 |
255 // kExprI64Clz: | 255 // kExprI64Clz: |
256 // kExprI64Ctz: | 256 // kExprI64Ctz: |
257 // kExprI64Popcnt: | 257 // kExprI64Popcnt: |
258 | 258 |
259 // kExprF32SConvertI64: | 259 // kExprF32SConvertI64: |
260 TEST(Run_WasmF32SConvertI64) { | 260 TEST(Run_WasmF32SConvertI64) { |
261 WasmRunner<float> r(MachineType::Int64()); | 261 WasmRunner<float> r(MachineType::Int64()); |
262 BUILD(r, WASM_F32_SCONVERT_I64(WASM_GET_LOCAL(0))); | 262 BUILD(r, WASM_F32_SCONVERT_I64(WASM_GET_LOCAL(0))); |
263 FOR_INT64_INPUTS(i) { CHECK_EQ(static_cast<float>(*i), r.Call(*i)); } | 263 FOR_INT64_INPUTS(i) { |
264 volatile float expected = static_cast<float>(*i); | |
titzer
2016/03/16 09:44:51
Can you try the CHECK_DOUBLE_EQ macro?
| |
265 CHECK_EQ(expected, r.Call(*i)); | |
266 } | |
264 } | 267 } |
265 // kExprF32UConvertI64: | 268 // kExprF32UConvertI64: |
266 TEST(Run_WasmF32UConvertI64) { | 269 TEST(Run_WasmF32UConvertI64) { |
267 struct { | 270 struct { |
268 uint64_t input; | 271 uint64_t input; |
269 uint32_t expected; | 272 uint32_t expected; |
270 } values[] = {{0x0, 0x0}, | 273 } values[] = {{0x0, 0x0}, |
271 {0x1, 0x3f800000}, | 274 {0x1, 0x3f800000}, |
272 {0xffffffff, 0x4f800000}, | 275 {0xffffffff, 0x4f800000}, |
273 {0x1b09788b, 0x4dd84bc4}, | 276 {0x1b09788b, 0x4dd84bc4}, |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
346 WasmRunner<float> r(MachineType::Uint64()); | 349 WasmRunner<float> r(MachineType::Uint64()); |
347 BUILD(r, WASM_F32_UCONVERT_I64(WASM_GET_LOCAL(0))); | 350 BUILD(r, WASM_F32_UCONVERT_I64(WASM_GET_LOCAL(0))); |
348 for (size_t i = 0; i < arraysize(values); i++) { | 351 for (size_t i = 0; i < arraysize(values); i++) { |
349 CHECK_EQ(bit_cast<float>(values[i].expected), r.Call(values[i].input)); | 352 CHECK_EQ(bit_cast<float>(values[i].expected), r.Call(values[i].input)); |
350 } | 353 } |
351 } | 354 } |
352 // kExprF64SConvertI64: | 355 // kExprF64SConvertI64: |
353 TEST(Run_WasmF64SConvertI64) { | 356 TEST(Run_WasmF64SConvertI64) { |
354 WasmRunner<double> r(MachineType::Int64()); | 357 WasmRunner<double> r(MachineType::Int64()); |
355 BUILD(r, WASM_F64_SCONVERT_I64(WASM_GET_LOCAL(0))); | 358 BUILD(r, WASM_F64_SCONVERT_I64(WASM_GET_LOCAL(0))); |
356 FOR_INT64_INPUTS(i) { CHECK_EQ(static_cast<double>(*i), r.Call(*i)); } | 359 FOR_INT64_INPUTS(i) { |
360 volatile double expected = static_cast<double>(*i); | |
361 CHECK_EQ(expected, r.Call(*i)); | |
362 } | |
357 } | 363 } |
358 // kExprF64UConvertI64: | 364 // kExprF64UConvertI64: |
359 TEST(Run_Wasm_F64UConvertI64) { | 365 TEST(Run_Wasm_F64UConvertI64) { |
360 struct { | 366 struct { |
361 uint64_t input; | 367 uint64_t input; |
362 uint64_t expected; | 368 uint64_t expected; |
363 } values[] = {{0x0, 0x0}, | 369 } values[] = {{0x0, 0x0}, |
364 {0x1, 0x3ff0000000000000}, | 370 {0x1, 0x3ff0000000000000}, |
365 {0xffffffff, 0x41efffffffe00000}, | 371 {0xffffffff, 0x41efffffffe00000}, |
366 {0x1b09788b, 0x41bb09788b000000}, | 372 {0x1b09788b, 0x41bb09788b000000}, |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
476 WASM_I64V_10(0xbcd1234000000013), WASM_I64V_10(0xbcd1234000000014), | 482 WASM_I64V_10(0xbcd1234000000013), WASM_I64V_10(0xbcd1234000000014), |
477 WASM_I64V_10(0xbcd1234000000015), WASM_I64V_10(0xbcd1234000000016), | 483 WASM_I64V_10(0xbcd1234000000015), WASM_I64V_10(0xbcd1234000000016), |
478 WASM_I64V_10(0xbcd1234000000017), WASM_I64V_10(0xbcd1234000000018), | 484 WASM_I64V_10(0xbcd1234000000017), WASM_I64V_10(0xbcd1234000000018), |
479 WASM_I64V_10(0xbcd1234000000019), WASM_I64V_10(0xbcd123400000001a), | 485 WASM_I64V_10(0xbcd1234000000019), WASM_I64V_10(0xbcd123400000001a), |
480 WASM_I64V_10(0xbcd123400000001b), WASM_I64V_10(0xbcd123400000001c), | 486 WASM_I64V_10(0xbcd123400000001b), WASM_I64V_10(0xbcd123400000001c), |
481 WASM_I64V_10(0xbcd123400000001d)))); | 487 WASM_I64V_10(0xbcd123400000001d)))); |
482 | 488 |
483 CHECK_EQ(i + 0xb, r.Call()); | 489 CHECK_EQ(i + 0xb, r.Call()); |
484 } | 490 } |
485 } | 491 } |
OLD | NEW |