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 17 matching lines...) Expand all Loading... |
28 #else | 28 #else |
29 #define MIPS_OR_ARM_OR_X87 false | 29 #define MIPS_OR_ARM_OR_X87 false |
30 #endif | 30 #endif |
31 | 31 |
32 #define FOREACH_I64_OPERATOR(V) \ | 32 #define FOREACH_I64_OPERATOR(V) \ |
33 V(DepthFirst, false) \ | 33 V(DepthFirst, false) \ |
34 V(I64Const, true) \ | 34 V(I64Const, true) \ |
35 V(I64Return, true) \ | 35 V(I64Return, true) \ |
36 V(I64Param, true) \ | 36 V(I64Param, true) \ |
37 V(I64LoadStore, true) \ | 37 V(I64LoadStore, true) \ |
38 V(I64Add, false) \ | 38 V(I64Add, true) \ |
39 V(I64Sub, false) \ | 39 V(I64Sub, false) \ |
40 V(I64Mul, false) \ | 40 V(I64Mul, false) \ |
41 V(I64DivS, false) \ | 41 V(I64DivS, false) \ |
42 V(I64DivU, false) \ | 42 V(I64DivU, false) \ |
43 V(I64RemS, false) \ | 43 V(I64RemS, false) \ |
44 V(I64RemU, false) \ | 44 V(I64RemU, false) \ |
45 V(I64And, true) \ | 45 V(I64And, true) \ |
46 V(I64Ior, true) \ | 46 V(I64Ior, true) \ |
47 V(I64Xor, true) \ | 47 V(I64Xor, true) \ |
48 V(I64Shl, !MIPS_OR_X87) \ | 48 V(I64Shl, !MIPS_OR_X87) \ |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 WasmRunner<int64_t> r(MachineType::Int64()); | 111 WasmRunner<int64_t> r(MachineType::Int64()); |
112 | 112 |
113 BUILD(r, WASM_RETURN(WASM_GET_LOCAL(0))); | 113 BUILD(r, WASM_RETURN(WASM_GET_LOCAL(0))); |
114 | 114 |
115 FOR_INT64_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } | 115 FOR_INT64_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } |
116 } | 116 } |
117 | 117 |
118 // todo(ahaas): I added a list of missing instructions here to make merging | 118 // todo(ahaas): I added a list of missing instructions here to make merging |
119 // easier when I do them one by one. | 119 // easier when I do them one by one. |
120 // kExprI64Add: | 120 // kExprI64Add: |
| 121 TEST(Run_WasmI64Add) { |
| 122 REQUIRE(I64Add); |
| 123 WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); |
| 124 BUILD(r, WASM_I64_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
| 125 FOR_INT64_INPUTS(i) { |
| 126 FOR_INT64_INPUTS(j) { CHECK_EQ(*i + *j, r.Call(*i, *j)); } |
| 127 } |
| 128 } |
121 // kExprI64Sub: | 129 // kExprI64Sub: |
122 // kExprI64Mul: | 130 // kExprI64Mul: |
123 // kExprI64DivS: | 131 // kExprI64DivS: |
124 // kExprI64DivU: | 132 // kExprI64DivU: |
125 // kExprI64RemS: | 133 // kExprI64RemS: |
126 // kExprI64RemU: | 134 // kExprI64RemU: |
127 // kExprI64And: | 135 // kExprI64And: |
128 TEST(Run_Wasm_I64And) { | 136 TEST(Run_Wasm_I64And) { |
129 REQUIRE(I64And); | 137 REQUIRE(I64And); |
130 WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); | 138 WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); |
(...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1194 WASM_I64_SCONVERT_I32(WASM_GET_LOCAL(0)))), | 1202 WASM_I64_SCONVERT_I32(WASM_GET_LOCAL(0)))), |
1195 WASM_ZERO)); | 1203 WASM_ZERO)); |
1196 | 1204 |
1197 *global = 0xFFFFFFFFFFFFFFFFLL; | 1205 *global = 0xFFFFFFFFFFFFFFFFLL; |
1198 for (int i = 9; i < 444444; i += 111111) { | 1206 for (int i = 9; i < 444444; i += 111111) { |
1199 int64_t expected = *global & i; | 1207 int64_t expected = *global & i; |
1200 r.Call(i); | 1208 r.Call(i); |
1201 CHECK_EQ(expected, *global); | 1209 CHECK_EQ(expected, *global); |
1202 } | 1210 } |
1203 } | 1211 } |
OLD | NEW |