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 30 matching lines...) Expand all Loading... |
41 | 41 |
42 #define FOREACH_I64_OPERATOR(V) \ | 42 #define FOREACH_I64_OPERATOR(V) \ |
43 V(DepthFirst, true) \ | 43 V(DepthFirst, true) \ |
44 V(I64Phi, true) \ | 44 V(I64Phi, true) \ |
45 V(I64Const, true) \ | 45 V(I64Const, true) \ |
46 V(I64Return, true) \ | 46 V(I64Return, true) \ |
47 V(I64Param, true) \ | 47 V(I64Param, true) \ |
48 V(I64LoadStore, true) \ | 48 V(I64LoadStore, true) \ |
49 V(I64Add, !MIPS_OR_X87) \ | 49 V(I64Add, !MIPS_OR_X87) \ |
50 V(I64Sub, !MIPS_OR_X87) \ | 50 V(I64Sub, !MIPS_OR_X87) \ |
51 V(I64Mul, false) \ | 51 V(I64Mul, !MIPS_OR_X87) \ |
52 V(I64DivS, true) \ | 52 V(I64DivS, true) \ |
53 V(I64DivU, true) \ | 53 V(I64DivU, true) \ |
54 V(I64RemS, true) \ | 54 V(I64RemS, true) \ |
55 V(I64RemU, true) \ | 55 V(I64RemU, true) \ |
56 V(I64And, true) \ | 56 V(I64And, true) \ |
57 V(I64Ior, true) \ | 57 V(I64Ior, true) \ |
58 V(I64Xor, true) \ | 58 V(I64Xor, true) \ |
59 V(I64Shl, !MIPS_OR_X87) \ | 59 V(I64Shl, !MIPS_OR_X87) \ |
60 V(I64ShrU, !MIPS_OR_X87) \ | 60 V(I64ShrU, !MIPS_OR_X87) \ |
61 V(I64ShrS, !MIPS_OR_X87) \ | 61 V(I64ShrS, !MIPS_OR_X87) \ |
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
866 do { \ | 866 do { \ |
867 if (WASM_64 || kSupported_##name) \ | 867 if (WASM_64 || kSupported_##name) \ |
868 TestI64Binop(kExpr##name, expected, a, b); \ | 868 TestI64Binop(kExpr##name, expected, a, b); \ |
869 } while (false) | 869 } while (false) |
870 | 870 |
871 TEST(Run_Wasm_I64Binops) { | 871 TEST(Run_Wasm_I64Binops) { |
872 // TODO(titzer): real 64-bit numbers | 872 // TODO(titzer): real 64-bit numbers |
873 TEST_I64_BINOP(I64Add, 8888888888888LL, 3333333333333LL, 5555555555555LL); | 873 TEST_I64_BINOP(I64Add, 8888888888888LL, 3333333333333LL, 5555555555555LL); |
874 TEST_I64_BINOP(I64Sub, -111111111111LL, 777777777777LL, 888888888888LL); | 874 TEST_I64_BINOP(I64Sub, -111111111111LL, 777777777777LL, 888888888888LL); |
875 TEST_I64_BINOP(I64Mul, 65130756, 88734, 734); | 875 TEST_I64_BINOP(I64Mul, 65130756, 88734, 734); |
| 876 TEST_I64_BINOP(I64Mul, 65130756, -88734, -734); |
| 877 TEST_I64_BINOP(I64Mul, -65130756, -88734, 734); |
876 TEST_I64_BINOP(I64DivS, -66, -4777344, 72384); | 878 TEST_I64_BINOP(I64DivS, -66, -4777344, 72384); |
877 TEST_I64_BINOP(I64DivU, 805306368, 0xF0000000, 5); | 879 TEST_I64_BINOP(I64DivU, 805306368, 0xF0000000, 5); |
878 TEST_I64_BINOP(I64RemS, -3, -3003, 1000); | 880 TEST_I64_BINOP(I64RemS, -3, -3003, 1000); |
879 TEST_I64_BINOP(I64RemU, 4, 4004, 1000); | 881 TEST_I64_BINOP(I64RemU, 4, 4004, 1000); |
880 TEST_I64_BINOP(I64And, 0xEE, 0xFFEE, 0xFF0000FF); | 882 TEST_I64_BINOP(I64And, 0xEE, 0xFFEE, 0xFF0000FF); |
881 TEST_I64_BINOP(I64Ior, 0xF0FF00FF, 0xF0F000EE, 0x000F0011); | 883 TEST_I64_BINOP(I64Ior, 0xF0FF00FF, 0xF0F000EE, 0x000F0011); |
882 TEST_I64_BINOP(I64Xor, 0xABCDEF01, 0xABCDEFFF, 0xFE); | 884 TEST_I64_BINOP(I64Xor, 0xABCDEF01, 0xABCDEFFF, 0xFE); |
883 TEST_I64_BINOP(I64Shl, 0xA0000000, 0xA, 28); | 885 TEST_I64_BINOP(I64Shl, 0xA0000000, 0xA, 28); |
884 TEST_I64_BINOP(I64ShrU, 0x0700001000123456LL, 0x7000010001234567LL, 4); | 886 TEST_I64_BINOP(I64ShrU, 0x0700001000123456LL, 0x7000010001234567LL, 4); |
885 TEST_I64_BINOP(I64ShrS, 0xFF00000000000000LL, 0x8000000000000000LL, 7); | 887 TEST_I64_BINOP(I64ShrS, 0xFF00000000000000LL, 0x8000000000000000LL, 7); |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1308 REQUIRE(I64Eq); | 1310 REQUIRE(I64Eq); |
1309 | 1311 |
1310 WasmRunner<int32_t> r(MachineType::Int64()); | 1312 WasmRunner<int32_t> r(MachineType::Int64()); |
1311 BUILD(r, WASM_I64_EQZ(WASM_GET_LOCAL(0))); | 1313 BUILD(r, WASM_I64_EQZ(WASM_GET_LOCAL(0))); |
1312 | 1314 |
1313 FOR_INT64_INPUTS(i) { | 1315 FOR_INT64_INPUTS(i) { |
1314 int32_t result = *i == 0 ? 1 : 0; | 1316 int32_t result = *i == 0 ? 1 : 0; |
1315 CHECK_EQ(result, r.Call(*i)); | 1317 CHECK_EQ(result, r.Call(*i)); |
1316 } | 1318 } |
1317 } | 1319 } |
OLD | NEW |