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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 20, r.Call(*i)); } | 78 FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 20, r.Call(*i)); } |
79 } | 79 } |
80 { | 80 { |
81 WasmRunner<int64_t> r(MachineType::Int64()); | 81 WasmRunner<int64_t> r(MachineType::Int64()); |
82 BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(40))); | 82 BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(40))); |
83 FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 40, r.Call(*i)); } | 83 FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 40, r.Call(*i)); } |
84 } | 84 } |
85 } | 85 } |
86 #endif | 86 #endif |
87 // kExprI64ShrU: | 87 // kExprI64ShrU: |
| 88 #if !V8_TARGET_ARCH_MIPS && !V8_TARGET_ARCH_X87 && !V8_TARGET_ARCH_ARM |
| 89 TEST(Run_WasmI64ShrU) { |
| 90 { |
| 91 WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); |
| 92 BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
| 93 FOR_UINT64_INPUTS(i) { |
| 94 for (int64_t j = 1; j < 64; j++) { |
| 95 CHECK_EQ(*i >> j, r.Call(*i, j)); |
| 96 } |
| 97 } |
| 98 } |
| 99 { |
| 100 WasmRunner<int64_t> r(MachineType::Int64()); |
| 101 BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(0))); |
| 102 FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 0, r.Call(*i)); } |
| 103 } |
| 104 { |
| 105 WasmRunner<int64_t> r(MachineType::Int64()); |
| 106 BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(32))); |
| 107 FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 32, r.Call(*i)); } |
| 108 } |
| 109 { |
| 110 WasmRunner<int64_t> r(MachineType::Int64()); |
| 111 BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(20))); |
| 112 FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 20, r.Call(*i)); } |
| 113 } |
| 114 { |
| 115 WasmRunner<int64_t> r(MachineType::Int64()); |
| 116 BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(40))); |
| 117 FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 40, r.Call(*i)); } |
| 118 } |
| 119 } |
| 120 #endif |
88 // kExprI64ShrS: | 121 // kExprI64ShrS: |
| 122 #if !V8_TARGET_ARCH_MIPS && !V8_TARGET_ARCH_X87 && !V8_TARGET_ARCH_ARM |
| 123 TEST(Run_WasmI64ShrS) { |
| 124 { |
| 125 WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); |
| 126 BUILD(r, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
| 127 FOR_INT64_INPUTS(i) { |
| 128 for (int64_t j = 1; j < 64; j++) { |
| 129 CHECK_EQ(*i >> j, r.Call(*i, j)); |
| 130 } |
| 131 } |
| 132 } |
| 133 { |
| 134 WasmRunner<int64_t> r(MachineType::Int64()); |
| 135 BUILD(r, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_I64V_1(0))); |
| 136 FOR_INT64_INPUTS(i) { CHECK_EQ(*i >> 0, r.Call(*i)); } |
| 137 } |
| 138 { |
| 139 WasmRunner<int64_t> r(MachineType::Int64()); |
| 140 BUILD(r, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_I64V_1(32))); |
| 141 FOR_INT64_INPUTS(i) { CHECK_EQ(*i >> 32, r.Call(*i)); } |
| 142 } |
| 143 { |
| 144 WasmRunner<int64_t> r(MachineType::Int64()); |
| 145 BUILD(r, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_I64V_1(20))); |
| 146 FOR_INT64_INPUTS(i) { CHECK_EQ(*i >> 20, r.Call(*i)); } |
| 147 } |
| 148 { |
| 149 WasmRunner<int64_t> r(MachineType::Int64()); |
| 150 BUILD(r, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_I64V_1(40))); |
| 151 FOR_INT64_INPUTS(i) { CHECK_EQ(*i >> 40, r.Call(*i)); } |
| 152 } |
| 153 } |
| 154 #endif |
89 // kExprI64Eq: | 155 // kExprI64Eq: |
90 TEST(Run_WasmI64Eq) { | 156 TEST(Run_WasmI64Eq) { |
91 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); | 157 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); |
92 BUILD(r, WASM_I64_EQ(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 158 BUILD(r, WASM_I64_EQ(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
93 FOR_INT64_INPUTS(i) { | 159 FOR_INT64_INPUTS(i) { |
94 FOR_INT64_INPUTS(j) { CHECK_EQ(*i == *j ? 1 : 0, r.Call(*i, *j)); } | 160 FOR_INT64_INPUTS(j) { CHECK_EQ(*i == *j ? 1 : 0, r.Call(*i, *j)); } |
95 } | 161 } |
96 } | 162 } |
97 // kExprI64Ne: | 163 // kExprI64Ne: |
98 TEST(Run_WasmI64Ne) { | 164 TEST(Run_WasmI64Ne) { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 WASM_I64V_10(0xbcd1234000000013), WASM_I64V_10(0xbcd1234000000014), | 284 WASM_I64V_10(0xbcd1234000000013), WASM_I64V_10(0xbcd1234000000014), |
219 WASM_I64V_10(0xbcd1234000000015), WASM_I64V_10(0xbcd1234000000016), | 285 WASM_I64V_10(0xbcd1234000000015), WASM_I64V_10(0xbcd1234000000016), |
220 WASM_I64V_10(0xbcd1234000000017), WASM_I64V_10(0xbcd1234000000018), | 286 WASM_I64V_10(0xbcd1234000000017), WASM_I64V_10(0xbcd1234000000018), |
221 WASM_I64V_10(0xbcd1234000000019), WASM_I64V_10(0xbcd123400000001a), | 287 WASM_I64V_10(0xbcd1234000000019), WASM_I64V_10(0xbcd123400000001a), |
222 WASM_I64V_10(0xbcd123400000001b), WASM_I64V_10(0xbcd123400000001c), | 288 WASM_I64V_10(0xbcd123400000001b), WASM_I64V_10(0xbcd123400000001c), |
223 WASM_I64V_10(0xbcd123400000001d)))); | 289 WASM_I64V_10(0xbcd123400000001d)))); |
224 | 290 |
225 CHECK_EQ(i + 0xb, r.Call()); | 291 CHECK_EQ(i + 0xb, r.Call()); |
226 } | 292 } |
227 } | 293 } |
OLD | NEW |