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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 V(I64LtS, true) \ | 63 V(I64LtS, true) \ |
64 V(I64LeS, true) \ | 64 V(I64LeS, true) \ |
65 V(I64LtU, true) \ | 65 V(I64LtU, true) \ |
66 V(I64LeU, true) \ | 66 V(I64LeU, true) \ |
67 V(I64GtS, true) \ | 67 V(I64GtS, true) \ |
68 V(I64GeS, true) \ | 68 V(I64GeS, true) \ |
69 V(I64GtU, true) \ | 69 V(I64GtU, true) \ |
70 V(I64GeU, true) \ | 70 V(I64GeU, true) \ |
71 V(I64Clz, false) \ | 71 V(I64Clz, false) \ |
72 V(I64Ctz, false) \ | 72 V(I64Ctz, false) \ |
73 V(I64Popcnt, false) \ | 73 V(I64Popcnt, !MIPS_OR_X87) \ |
74 V(I32ConvertI64, true) \ | 74 V(I32ConvertI64, true) \ |
75 V(I64SConvertF32, false) \ | 75 V(I64SConvertF32, false) \ |
76 V(I64SConvertF64, false) \ | 76 V(I64SConvertF64, false) \ |
77 V(I64UConvertF32, false) \ | 77 V(I64UConvertF32, false) \ |
78 V(I64UConvertF64, false) \ | 78 V(I64UConvertF64, false) \ |
79 V(I64SConvertI32, true) \ | 79 V(I64SConvertI32, true) \ |
80 V(I64UConvertI32, true) \ | 80 V(I64UConvertI32, true) \ |
81 V(F32SConvertI64, true) \ | 81 V(F32SConvertI64, true) \ |
82 V(F32UConvertI64, true) \ | 82 V(F32UConvertI64, true) \ |
83 V(F64SConvertI64, true) \ | 83 V(F64SConvertI64, true) \ |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 BUILD(r, WASM_I64_UCONVERT_I32(WASM_GET_LOCAL(0))); | 512 BUILD(r, WASM_I64_UCONVERT_I32(WASM_GET_LOCAL(0))); |
513 FOR_UINT32_INPUTS(i) { CHECK_EQ(static_cast<uint64_t>(*i), r.Call(*i)); } | 513 FOR_UINT32_INPUTS(i) { CHECK_EQ(static_cast<uint64_t>(*i), r.Call(*i)); } |
514 } | 514 } |
515 | 515 |
516 // kExprF64ReinterpretI64: | 516 // kExprF64ReinterpretI64: |
517 // kExprI64ReinterpretF64: | 517 // kExprI64ReinterpretF64: |
518 | 518 |
519 // kExprI64Clz: | 519 // kExprI64Clz: |
520 // kExprI64Ctz: | 520 // kExprI64Ctz: |
521 // kExprI64Popcnt: | 521 // kExprI64Popcnt: |
| 522 TEST(Run_WasmI64Popcnt) { |
| 523 struct { |
| 524 int64_t expected; |
| 525 uint64_t input; |
| 526 } values[] = {{64, 0xffffffffffffffff}, |
| 527 {0, 0x0000000000000000}, |
| 528 {2, 0x0000080000008000}, |
| 529 {26, 0x1123456782345678}, |
| 530 {38, 0xffedcba09edcba09}}; |
| 531 |
| 532 WasmRunner<int64_t> r(MachineType::Uint64()); |
| 533 BUILD(r, WASM_I64_POPCNT(WASM_GET_LOCAL(0))); |
| 534 for (size_t i = 0; i < arraysize(values); i++) { |
| 535 CHECK_EQ(values[i].expected, r.Call(values[i].input)); |
| 536 } |
| 537 } |
522 | 538 |
523 // kExprF32SConvertI64: | 539 // kExprF32SConvertI64: |
524 TEST(Run_WasmF32SConvertI64) { | 540 TEST(Run_WasmF32SConvertI64) { |
525 REQUIRE(F32SConvertI64); | 541 REQUIRE(F32SConvertI64); |
526 WasmRunner<float> r(MachineType::Int64()); | 542 WasmRunner<float> r(MachineType::Int64()); |
527 BUILD(r, WASM_F32_SCONVERT_I64(WASM_GET_LOCAL(0))); | 543 BUILD(r, WASM_F32_SCONVERT_I64(WASM_GET_LOCAL(0))); |
528 FOR_INT64_INPUTS(i) { CHECK_EQ(static_cast<float>(*i), r.Call(*i)); } | 544 FOR_INT64_INPUTS(i) { CHECK_EQ(static_cast<float>(*i), r.Call(*i)); } |
529 } | 545 } |
530 // kExprF32UConvertI64: | 546 // kExprF32UConvertI64: |
531 TEST(Run_WasmF32UConvertI64) { | 547 TEST(Run_WasmF32UConvertI64) { |
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1282 REQUIRE(I64Eq); | 1298 REQUIRE(I64Eq); |
1283 | 1299 |
1284 WasmRunner<int32_t> r(MachineType::Int64()); | 1300 WasmRunner<int32_t> r(MachineType::Int64()); |
1285 BUILD(r, WASM_I64_EQZ(WASM_GET_LOCAL(0))); | 1301 BUILD(r, WASM_I64_EQZ(WASM_GET_LOCAL(0))); |
1286 | 1302 |
1287 FOR_INT64_INPUTS(i) { | 1303 FOR_INT64_INPUTS(i) { |
1288 int32_t result = *i == 0 ? 1 : 0; | 1304 int32_t result = *i == 0 ? 1 : 0; |
1289 CHECK_EQ(result, r.Call(*i)); | 1305 CHECK_EQ(result, r.Call(*i)); |
1290 } | 1306 } |
1291 } | 1307 } |
OLD | NEW |