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/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/wasm/wasm-macro-gen.h" | 10 #include "src/wasm/wasm-macro-gen.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 114 |
115 TEST(Run_Wasm_Return_I64) { | 115 TEST(Run_Wasm_Return_I64) { |
116 REQUIRE(I64Return); | 116 REQUIRE(I64Return); |
117 WasmRunner<int64_t> r(MachineType::Int64()); | 117 WasmRunner<int64_t> r(MachineType::Int64()); |
118 | 118 |
119 BUILD(r, WASM_RETURN1(WASM_GET_LOCAL(0))); | 119 BUILD(r, WASM_RETURN1(WASM_GET_LOCAL(0))); |
120 | 120 |
121 FOR_INT64_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } | 121 FOR_INT64_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } |
122 } | 122 } |
123 | 123 |
124 // todo(ahaas): I added a list of missing instructions here to make merging | |
125 // easier when I do them one by one. | |
126 // kExprI64Add: | |
127 TEST(Run_WasmI64Add) { | 124 TEST(Run_WasmI64Add) { |
128 REQUIRE(I64Add); | 125 REQUIRE(I64Add); |
129 WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); | 126 WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); |
130 BUILD(r, WASM_I64_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 127 BUILD(r, WASM_I64_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
131 FOR_INT64_INPUTS(i) { | 128 FOR_INT64_INPUTS(i) { |
132 FOR_INT64_INPUTS(j) { CHECK_EQ(*i + *j, r.Call(*i, *j)); } | 129 FOR_INT64_INPUTS(j) { CHECK_EQ(*i + *j, r.Call(*i, *j)); } |
133 } | 130 } |
134 } | 131 } |
135 // kExprI64Sub: | 132 |
136 TEST(Run_Wasm_I64Sub) { | 133 TEST(Run_Wasm_I64Sub) { |
137 REQUIRE(I64Sub); | 134 REQUIRE(I64Sub); |
138 WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); | 135 WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); |
139 BUILD(r, WASM_I64_SUB(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 136 BUILD(r, WASM_I64_SUB(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
140 FOR_INT64_INPUTS(i) { | 137 FOR_INT64_INPUTS(i) { |
141 FOR_INT64_INPUTS(j) { CHECK_EQ(*i - *j, r.Call(*i, *j)); } | 138 FOR_INT64_INPUTS(j) { CHECK_EQ(*i - *j, r.Call(*i, *j)); } |
142 } | 139 } |
143 } | 140 } |
144 // kExprI64Mul: | |
145 // kExprI64DivS: | |
146 | 141 |
147 TEST(Run_WasmI64DivS) { | 142 TEST(Run_WasmI64DivS) { |
148 REQUIRE(I64DivS); | 143 REQUIRE(I64DivS); |
149 WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); | 144 WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); |
150 BUILD(r, WASM_I64_DIVS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 145 BUILD(r, WASM_I64_DIVS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
151 FOR_INT64_INPUTS(i) { | 146 FOR_INT64_INPUTS(i) { |
152 FOR_INT64_INPUTS(j) { | 147 FOR_INT64_INPUTS(j) { |
153 if (*j == 0) { | 148 if (*j == 0) { |
154 CHECK_TRAP64(r.Call(*i, *j)); | 149 CHECK_TRAP64(r.Call(*i, *j)); |
155 } else if (*j == -1 && *i == std::numeric_limits<int64_t>::min()) { | 150 } else if (*j == -1 && *i == std::numeric_limits<int64_t>::min()) { |
(...skipping 23 matching lines...) Expand all Loading... |
179 BUILD(r, WASM_I64_DIVS(WASM_GET_LOCAL(0), WASM_I64V_1(denom))); | 174 BUILD(r, WASM_I64_DIVS(WASM_GET_LOCAL(0), WASM_I64V_1(denom))); |
180 for (int64_t val = -7; val < 8; val++) { | 175 for (int64_t val = -7; val < 8; val++) { |
181 if (denom == 0) { | 176 if (denom == 0) { |
182 CHECK_TRAP64(r.Call(val)); | 177 CHECK_TRAP64(r.Call(val)); |
183 } else { | 178 } else { |
184 CHECK_EQ(val / denom, r.Call(val)); | 179 CHECK_EQ(val / denom, r.Call(val)); |
185 } | 180 } |
186 } | 181 } |
187 } | 182 } |
188 } | 183 } |
189 // kExprI64DivU: | |
190 | 184 |
191 TEST(Run_WasmI64DivU) { | 185 TEST(Run_WasmI64DivU) { |
192 REQUIRE(I64DivU); | 186 REQUIRE(I64DivU); |
193 WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64()); | 187 WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64()); |
194 BUILD(r, WASM_I64_DIVU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 188 BUILD(r, WASM_I64_DIVU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
195 FOR_UINT64_INPUTS(i) { | 189 FOR_UINT64_INPUTS(i) { |
196 FOR_UINT64_INPUTS(j) { | 190 FOR_UINT64_INPUTS(j) { |
197 if (*j == 0) { | 191 if (*j == 0) { |
198 CHECK_TRAP64(r.Call(*i, *j)); | 192 CHECK_TRAP64(r.Call(*i, *j)); |
199 } else { | 193 } else { |
(...skipping 21 matching lines...) Expand all Loading... |
221 | 215 |
222 for (uint64_t val = 0xfffffffffffffff0; val < 8; val++) { | 216 for (uint64_t val = 0xfffffffffffffff0; val < 8; val++) { |
223 if (denom == 0) { | 217 if (denom == 0) { |
224 CHECK_TRAP64(r.Call(val)); | 218 CHECK_TRAP64(r.Call(val)); |
225 } else { | 219 } else { |
226 CHECK_EQ(val / denom, r.Call(val)); | 220 CHECK_EQ(val / denom, r.Call(val)); |
227 } | 221 } |
228 } | 222 } |
229 } | 223 } |
230 } | 224 } |
231 // kExprI64RemS: | 225 |
232 TEST(Run_WasmI64RemS) { | 226 TEST(Run_WasmI64RemS) { |
233 REQUIRE(I64RemS); | 227 REQUIRE(I64RemS); |
234 WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); | 228 WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); |
235 BUILD(r, WASM_I64_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 229 BUILD(r, WASM_I64_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
236 FOR_INT64_INPUTS(i) { | 230 FOR_INT64_INPUTS(i) { |
237 FOR_INT64_INPUTS(j) { | 231 FOR_INT64_INPUTS(j) { |
238 if (*j == 0) { | 232 if (*j == 0) { |
239 CHECK_TRAP64(r.Call(*i, *j)); | 233 CHECK_TRAP64(r.Call(*i, *j)); |
240 } else { | 234 } else { |
241 CHECK_EQ(*i % *j, r.Call(*i, *j)); | 235 CHECK_EQ(*i % *j, r.Call(*i, *j)); |
242 } | 236 } |
243 } | 237 } |
244 } | 238 } |
245 } | 239 } |
246 | 240 |
247 TEST(Run_WasmI64RemS_Trap) { | 241 TEST(Run_WasmI64RemS_Trap) { |
248 REQUIRE(I64RemS); | 242 REQUIRE(I64RemS); |
249 WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); | 243 WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); |
250 BUILD(r, WASM_I64_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 244 BUILD(r, WASM_I64_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
251 CHECK_EQ(33, r.Call(asi64(133), asi64(100))); | 245 CHECK_EQ(33, r.Call(asi64(133), asi64(100))); |
252 CHECK_EQ(0, r.Call(std::numeric_limits<int64_t>::min(), asi64(-1))); | 246 CHECK_EQ(0, r.Call(std::numeric_limits<int64_t>::min(), asi64(-1))); |
253 CHECK_TRAP64(r.Call(asi64(100), asi64(0))); | 247 CHECK_TRAP64(r.Call(asi64(100), asi64(0))); |
254 CHECK_TRAP64(r.Call(asi64(-1001), asi64(0))); | 248 CHECK_TRAP64(r.Call(asi64(-1001), asi64(0))); |
255 CHECK_TRAP64(r.Call(std::numeric_limits<int64_t>::min(), asi64(0))); | 249 CHECK_TRAP64(r.Call(std::numeric_limits<int64_t>::min(), asi64(0))); |
256 } | 250 } |
257 | 251 |
258 // kExprI64RemU: | |
259 TEST(Run_WasmI64RemU) { | 252 TEST(Run_WasmI64RemU) { |
260 REQUIRE(I64RemU); | 253 REQUIRE(I64RemU); |
261 WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64()); | 254 WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64()); |
262 BUILD(r, WASM_I64_REMU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 255 BUILD(r, WASM_I64_REMU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
263 FOR_UINT64_INPUTS(i) { | 256 FOR_UINT64_INPUTS(i) { |
264 FOR_UINT64_INPUTS(j) { | 257 FOR_UINT64_INPUTS(j) { |
265 if (*j == 0) { | 258 if (*j == 0) { |
266 CHECK_TRAP64(r.Call(*i, *j)); | 259 CHECK_TRAP64(r.Call(*i, *j)); |
267 } else { | 260 } else { |
268 CHECK_EQ(*i % *j, r.Call(*i, *j)); | 261 CHECK_EQ(*i % *j, r.Call(*i, *j)); |
269 } | 262 } |
270 } | 263 } |
271 } | 264 } |
272 } | 265 } |
273 | 266 |
274 TEST(Run_Wasm_I64RemU_Trap) { | 267 TEST(Run_Wasm_I64RemU_Trap) { |
275 REQUIRE(I64RemU); | 268 REQUIRE(I64RemU); |
276 WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64()); | 269 WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64()); |
277 BUILD(r, WASM_I64_REMU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 270 BUILD(r, WASM_I64_REMU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
278 CHECK_EQ(17, r.Call(asu64(217), asu64(100))); | 271 CHECK_EQ(17, r.Call(asu64(217), asu64(100))); |
279 CHECK_TRAP64(r.Call(asu64(100), asu64(0))); | 272 CHECK_TRAP64(r.Call(asu64(100), asu64(0))); |
280 CHECK_TRAP64(r.Call(asu64(1001), asu64(0))); | 273 CHECK_TRAP64(r.Call(asu64(1001), asu64(0))); |
281 CHECK_TRAP64(r.Call(std::numeric_limits<uint64_t>::max(), asu64(0))); | 274 CHECK_TRAP64(r.Call(std::numeric_limits<uint64_t>::max(), asu64(0))); |
282 } | 275 } |
283 | 276 |
284 // kExprI64And: | |
285 TEST(Run_Wasm_I64And) { | 277 TEST(Run_Wasm_I64And) { |
286 REQUIRE(I64And); | 278 REQUIRE(I64And); |
287 WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); | 279 WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); |
288 BUILD(r, WASM_I64_AND(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 280 BUILD(r, WASM_I64_AND(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
289 FOR_INT64_INPUTS(i) { | 281 FOR_INT64_INPUTS(i) { |
290 FOR_INT64_INPUTS(j) { CHECK_EQ((*i) & (*j), r.Call(*i, *j)); } | 282 FOR_INT64_INPUTS(j) { CHECK_EQ((*i) & (*j), r.Call(*i, *j)); } |
291 } | 283 } |
292 } | 284 } |
293 // kExprI64Ior: | 285 |
294 TEST(Run_Wasm_I64Ior) { | 286 TEST(Run_Wasm_I64Ior) { |
295 REQUIRE(I64Ior); | 287 REQUIRE(I64Ior); |
296 WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); | 288 WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); |
297 BUILD(r, WASM_I64_IOR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 289 BUILD(r, WASM_I64_IOR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
298 FOR_INT64_INPUTS(i) { | 290 FOR_INT64_INPUTS(i) { |
299 FOR_INT64_INPUTS(j) { CHECK_EQ((*i) | (*j), r.Call(*i, *j)); } | 291 FOR_INT64_INPUTS(j) { CHECK_EQ((*i) | (*j), r.Call(*i, *j)); } |
300 } | 292 } |
301 } | 293 } |
302 // kExprI64Xor: | 294 |
303 TEST(Run_Wasm_I64Xor) { | 295 TEST(Run_Wasm_I64Xor) { |
304 REQUIRE(I64Xor); | 296 REQUIRE(I64Xor); |
305 WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); | 297 WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); |
306 BUILD(r, WASM_I64_XOR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 298 BUILD(r, WASM_I64_XOR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
307 FOR_INT64_INPUTS(i) { | 299 FOR_INT64_INPUTS(i) { |
308 FOR_INT64_INPUTS(j) { CHECK_EQ((*i) ^ (*j), r.Call(*i, *j)); } | 300 FOR_INT64_INPUTS(j) { CHECK_EQ((*i) ^ (*j), r.Call(*i, *j)); } |
309 } | 301 } |
310 } | 302 } |
311 // kExprI64Shl: | 303 |
312 TEST(Run_Wasm_I64Shl) { | 304 TEST(Run_Wasm_I64Shl) { |
313 REQUIRE(I64Shl); | 305 REQUIRE(I64Shl); |
314 { | 306 { |
315 WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64()); | 307 WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64()); |
316 BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 308 BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
317 | 309 |
318 FOR_UINT64_INPUTS(i) { | 310 FOR_UINT64_INPUTS(i) { |
319 FOR_UINT64_INPUTS(j) { | 311 FOR_UINT64_INPUTS(j) { |
320 uint64_t expected = (*i) << (*j & 0x3f); | 312 uint64_t expected = (*i) << (*j & 0x3f); |
321 CHECK_EQ(expected, r.Call(*i, *j)); | 313 CHECK_EQ(expected, r.Call(*i, *j)); |
(...skipping 14 matching lines...) Expand all Loading... |
336 WasmRunner<int64_t> r(MachineType::Int64()); | 328 WasmRunner<int64_t> r(MachineType::Int64()); |
337 BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(20))); | 329 BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(20))); |
338 FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 20, r.Call(*i)); } | 330 FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 20, r.Call(*i)); } |
339 } | 331 } |
340 { | 332 { |
341 WasmRunner<int64_t> r(MachineType::Int64()); | 333 WasmRunner<int64_t> r(MachineType::Int64()); |
342 BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(40))); | 334 BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(40))); |
343 FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 40, r.Call(*i)); } | 335 FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 40, r.Call(*i)); } |
344 } | 336 } |
345 } | 337 } |
346 // kExprI64ShrU: | 338 |
347 TEST(Run_Wasm_I64ShrU) { | 339 TEST(Run_Wasm_I64ShrU) { |
348 REQUIRE(I64ShrU); | 340 REQUIRE(I64ShrU); |
349 { | 341 { |
350 WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64()); | 342 WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64()); |
351 BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 343 BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
352 | 344 |
353 FOR_UINT64_INPUTS(i) { | 345 FOR_UINT64_INPUTS(i) { |
354 FOR_UINT64_INPUTS(j) { | 346 FOR_UINT64_INPUTS(j) { |
355 uint64_t expected = (*i) >> (*j & 0x3f); | 347 uint64_t expected = (*i) >> (*j & 0x3f); |
356 CHECK_EQ(expected, r.Call(*i, *j)); | 348 CHECK_EQ(expected, r.Call(*i, *j)); |
(...skipping 14 matching lines...) Expand all Loading... |
371 WasmRunner<int64_t> r(MachineType::Int64()); | 363 WasmRunner<int64_t> r(MachineType::Int64()); |
372 BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(20))); | 364 BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(20))); |
373 FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 20, r.Call(*i)); } | 365 FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 20, r.Call(*i)); } |
374 } | 366 } |
375 { | 367 { |
376 WasmRunner<int64_t> r(MachineType::Int64()); | 368 WasmRunner<int64_t> r(MachineType::Int64()); |
377 BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(40))); | 369 BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(40))); |
378 FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 40, r.Call(*i)); } | 370 FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 40, r.Call(*i)); } |
379 } | 371 } |
380 } | 372 } |
381 // kExprI64ShrS: | 373 |
382 TEST(Run_Wasm_I64ShrS) { | 374 TEST(Run_Wasm_I64ShrS) { |
383 REQUIRE(I64ShrS); | 375 REQUIRE(I64ShrS); |
384 { | 376 { |
385 WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); | 377 WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); |
386 BUILD(r, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 378 BUILD(r, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
387 | 379 |
388 FOR_INT64_INPUTS(i) { | 380 FOR_INT64_INPUTS(i) { |
389 FOR_INT64_INPUTS(j) { | 381 FOR_INT64_INPUTS(j) { |
390 int64_t expected = (*i) >> (*j & 0x3f); | 382 int64_t expected = (*i) >> (*j & 0x3f); |
391 CHECK_EQ(expected, r.Call(*i, *j)); | 383 CHECK_EQ(expected, r.Call(*i, *j)); |
(...skipping 14 matching lines...) Expand all Loading... |
406 WasmRunner<int64_t> r(MachineType::Int64()); | 398 WasmRunner<int64_t> r(MachineType::Int64()); |
407 BUILD(r, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_I64V_1(20))); | 399 BUILD(r, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_I64V_1(20))); |
408 FOR_INT64_INPUTS(i) { CHECK_EQ(*i >> 20, r.Call(*i)); } | 400 FOR_INT64_INPUTS(i) { CHECK_EQ(*i >> 20, r.Call(*i)); } |
409 } | 401 } |
410 { | 402 { |
411 WasmRunner<int64_t> r(MachineType::Int64()); | 403 WasmRunner<int64_t> r(MachineType::Int64()); |
412 BUILD(r, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_I64V_1(40))); | 404 BUILD(r, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_I64V_1(40))); |
413 FOR_INT64_INPUTS(i) { CHECK_EQ(*i >> 40, r.Call(*i)); } | 405 FOR_INT64_INPUTS(i) { CHECK_EQ(*i >> 40, r.Call(*i)); } |
414 } | 406 } |
415 } | 407 } |
416 // kExprI64Eq: | 408 |
417 TEST(Run_Wasm_I64Eq) { | 409 TEST(Run_Wasm_I64Eq) { |
418 REQUIRE(I64Eq); | 410 REQUIRE(I64Eq); |
419 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); | 411 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); |
420 BUILD(r, WASM_I64_EQ(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 412 BUILD(r, WASM_I64_EQ(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
421 FOR_INT64_INPUTS(i) { | 413 FOR_INT64_INPUTS(i) { |
422 FOR_INT64_INPUTS(j) { CHECK_EQ(*i == *j ? 1 : 0, r.Call(*i, *j)); } | 414 FOR_INT64_INPUTS(j) { CHECK_EQ(*i == *j ? 1 : 0, r.Call(*i, *j)); } |
423 } | 415 } |
424 } | 416 } |
425 // kExprI64Ne: | 417 |
426 TEST(Run_Wasm_I64Ne) { | 418 TEST(Run_Wasm_I64Ne) { |
427 REQUIRE(I64Ne); | 419 REQUIRE(I64Ne); |
428 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); | 420 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); |
429 BUILD(r, WASM_I64_NE(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 421 BUILD(r, WASM_I64_NE(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
430 FOR_INT64_INPUTS(i) { | 422 FOR_INT64_INPUTS(i) { |
431 FOR_INT64_INPUTS(j) { CHECK_EQ(*i != *j ? 1 : 0, r.Call(*i, *j)); } | 423 FOR_INT64_INPUTS(j) { CHECK_EQ(*i != *j ? 1 : 0, r.Call(*i, *j)); } |
432 } | 424 } |
433 } | 425 } |
434 // kExprI64LtS: | 426 |
435 TEST(Run_Wasm_I64LtS) { | 427 TEST(Run_Wasm_I64LtS) { |
436 REQUIRE(I64LtS); | 428 REQUIRE(I64LtS); |
437 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); | 429 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); |
438 BUILD(r, WASM_I64_LTS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 430 BUILD(r, WASM_I64_LTS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
439 FOR_INT64_INPUTS(i) { | 431 FOR_INT64_INPUTS(i) { |
440 FOR_INT64_INPUTS(j) { CHECK_EQ(*i < *j ? 1 : 0, r.Call(*i, *j)); } | 432 FOR_INT64_INPUTS(j) { CHECK_EQ(*i < *j ? 1 : 0, r.Call(*i, *j)); } |
441 } | 433 } |
442 } | 434 } |
| 435 |
443 TEST(Run_Wasm_I64LeS) { | 436 TEST(Run_Wasm_I64LeS) { |
444 REQUIRE(I64LeS); | 437 REQUIRE(I64LeS); |
445 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); | 438 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); |
446 BUILD(r, WASM_I64_LES(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 439 BUILD(r, WASM_I64_LES(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
447 FOR_INT64_INPUTS(i) { | 440 FOR_INT64_INPUTS(i) { |
448 FOR_INT64_INPUTS(j) { CHECK_EQ(*i <= *j ? 1 : 0, r.Call(*i, *j)); } | 441 FOR_INT64_INPUTS(j) { CHECK_EQ(*i <= *j ? 1 : 0, r.Call(*i, *j)); } |
449 } | 442 } |
450 } | 443 } |
| 444 |
451 TEST(Run_Wasm_I64LtU) { | 445 TEST(Run_Wasm_I64LtU) { |
452 REQUIRE(I64LtU); | 446 REQUIRE(I64LtU); |
453 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); | 447 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); |
454 BUILD(r, WASM_I64_LTU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 448 BUILD(r, WASM_I64_LTU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
455 FOR_UINT64_INPUTS(i) { | 449 FOR_UINT64_INPUTS(i) { |
456 FOR_UINT64_INPUTS(j) { CHECK_EQ(*i < *j ? 1 : 0, r.Call(*i, *j)); } | 450 FOR_UINT64_INPUTS(j) { CHECK_EQ(*i < *j ? 1 : 0, r.Call(*i, *j)); } |
457 } | 451 } |
458 } | 452 } |
| 453 |
459 TEST(Run_Wasm_I64LeU) { | 454 TEST(Run_Wasm_I64LeU) { |
460 REQUIRE(I64LeU); | 455 REQUIRE(I64LeU); |
461 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); | 456 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); |
462 BUILD(r, WASM_I64_LEU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 457 BUILD(r, WASM_I64_LEU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
463 FOR_UINT64_INPUTS(i) { | 458 FOR_UINT64_INPUTS(i) { |
464 FOR_UINT64_INPUTS(j) { CHECK_EQ(*i <= *j ? 1 : 0, r.Call(*i, *j)); } | 459 FOR_UINT64_INPUTS(j) { CHECK_EQ(*i <= *j ? 1 : 0, r.Call(*i, *j)); } |
465 } | 460 } |
466 } | 461 } |
| 462 |
467 TEST(Run_Wasm_I64GtS) { | 463 TEST(Run_Wasm_I64GtS) { |
468 REQUIRE(I64GtS); | 464 REQUIRE(I64GtS); |
469 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); | 465 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); |
470 BUILD(r, WASM_I64_GTS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 466 BUILD(r, WASM_I64_GTS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
471 FOR_INT64_INPUTS(i) { | 467 FOR_INT64_INPUTS(i) { |
472 FOR_INT64_INPUTS(j) { CHECK_EQ(*i > *j ? 1 : 0, r.Call(*i, *j)); } | 468 FOR_INT64_INPUTS(j) { CHECK_EQ(*i > *j ? 1 : 0, r.Call(*i, *j)); } |
473 } | 469 } |
474 } | 470 } |
| 471 |
475 TEST(Run_Wasm_I64GeS) { | 472 TEST(Run_Wasm_I64GeS) { |
476 REQUIRE(I64GeS); | 473 REQUIRE(I64GeS); |
477 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); | 474 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); |
478 BUILD(r, WASM_I64_GES(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 475 BUILD(r, WASM_I64_GES(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
479 FOR_INT64_INPUTS(i) { | 476 FOR_INT64_INPUTS(i) { |
480 FOR_INT64_INPUTS(j) { CHECK_EQ(*i >= *j ? 1 : 0, r.Call(*i, *j)); } | 477 FOR_INT64_INPUTS(j) { CHECK_EQ(*i >= *j ? 1 : 0, r.Call(*i, *j)); } |
481 } | 478 } |
482 } | 479 } |
483 | 480 |
484 TEST(Run_Wasm_I64GtU) { | 481 TEST(Run_Wasm_I64GtU) { |
485 REQUIRE(I64GtU); | 482 REQUIRE(I64GtU); |
486 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); | 483 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); |
487 BUILD(r, WASM_I64_GTU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 484 BUILD(r, WASM_I64_GTU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
488 FOR_UINT64_INPUTS(i) { | 485 FOR_UINT64_INPUTS(i) { |
489 FOR_UINT64_INPUTS(j) { CHECK_EQ(*i > *j ? 1 : 0, r.Call(*i, *j)); } | 486 FOR_UINT64_INPUTS(j) { CHECK_EQ(*i > *j ? 1 : 0, r.Call(*i, *j)); } |
490 } | 487 } |
491 } | 488 } |
492 | 489 |
493 TEST(Run_Wasm_I64GeU) { | 490 TEST(Run_Wasm_I64GeU) { |
494 REQUIRE(I64GeU); | 491 REQUIRE(I64GeU); |
495 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); | 492 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); |
496 BUILD(r, WASM_I64_GEU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 493 BUILD(r, WASM_I64_GEU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
497 FOR_UINT64_INPUTS(i) { | 494 FOR_UINT64_INPUTS(i) { |
498 FOR_UINT64_INPUTS(j) { CHECK_EQ(*i >= *j ? 1 : 0, r.Call(*i, *j)); } | 495 FOR_UINT64_INPUTS(j) { CHECK_EQ(*i >= *j ? 1 : 0, r.Call(*i, *j)); } |
499 } | 496 } |
500 } | 497 } |
501 // kExprI32ConvertI64: | 498 |
502 TEST(Run_Wasm_I32ConvertI64) { | 499 TEST(Run_Wasm_I32ConvertI64) { |
503 REQUIRE(I32ConvertI64); | 500 REQUIRE(I32ConvertI64); |
504 FOR_INT64_INPUTS(i) { | 501 FOR_INT64_INPUTS(i) { |
505 WasmRunner<int32_t> r; | 502 WasmRunner<int32_t> r; |
506 BUILD(r, WASM_I32_CONVERT_I64(WASM_I64V(*i))); | 503 BUILD(r, WASM_I32_CONVERT_I64(WASM_I64V(*i))); |
507 CHECK_EQ(static_cast<int32_t>(*i), r.Call()); | 504 CHECK_EQ(static_cast<int32_t>(*i), r.Call()); |
508 } | 505 } |
509 } | 506 } |
510 // kExprI64SConvertI32: | 507 |
511 TEST(Run_Wasm_I64SConvertI32) { | 508 TEST(Run_Wasm_I64SConvertI32) { |
512 REQUIRE(I64SConvertI32); | 509 REQUIRE(I64SConvertI32); |
513 WasmRunner<int64_t> r(MachineType::Int32()); | 510 WasmRunner<int64_t> r(MachineType::Int32()); |
514 BUILD(r, WASM_I64_SCONVERT_I32(WASM_GET_LOCAL(0))); | 511 BUILD(r, WASM_I64_SCONVERT_I32(WASM_GET_LOCAL(0))); |
515 FOR_INT32_INPUTS(i) { CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i)); } | 512 FOR_INT32_INPUTS(i) { CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i)); } |
516 } | 513 } |
517 | 514 |
518 // kExprI64UConvertI32: | |
519 TEST(Run_Wasm_I64UConvertI32) { | 515 TEST(Run_Wasm_I64UConvertI32) { |
520 REQUIRE(I64UConvertI32); | 516 REQUIRE(I64UConvertI32); |
521 WasmRunner<int64_t> r(MachineType::Uint32()); | 517 WasmRunner<int64_t> r(MachineType::Uint32()); |
522 BUILD(r, WASM_I64_UCONVERT_I32(WASM_GET_LOCAL(0))); | 518 BUILD(r, WASM_I64_UCONVERT_I32(WASM_GET_LOCAL(0))); |
523 FOR_UINT32_INPUTS(i) { CHECK_EQ(static_cast<uint64_t>(*i), r.Call(*i)); } | 519 FOR_UINT32_INPUTS(i) { CHECK_EQ(static_cast<uint64_t>(*i), r.Call(*i)); } |
524 } | 520 } |
525 | 521 |
526 // kExprF64ReinterpretI64: | |
527 // kExprI64ReinterpretF64: | |
528 | |
529 // kExprI64Clz: | |
530 // kExprI64Ctz: | |
531 // kExprI64Popcnt: | |
532 TEST(Run_WasmI64Popcnt) { | 522 TEST(Run_WasmI64Popcnt) { |
533 struct { | 523 struct { |
534 int64_t expected; | 524 int64_t expected; |
535 uint64_t input; | 525 uint64_t input; |
536 } values[] = {{64, 0xffffffffffffffff}, | 526 } values[] = {{64, 0xffffffffffffffff}, |
537 {0, 0x0000000000000000}, | 527 {0, 0x0000000000000000}, |
538 {2, 0x0000080000008000}, | 528 {2, 0x0000080000008000}, |
539 {26, 0x1123456782345678}, | 529 {26, 0x1123456782345678}, |
540 {38, 0xffedcba09edcba09}}; | 530 {38, 0xffedcba09edcba09}}; |
541 | 531 |
542 WasmRunner<int64_t> r(MachineType::Uint64()); | 532 WasmRunner<int64_t> r(MachineType::Uint64()); |
543 BUILD(r, WASM_I64_POPCNT(WASM_GET_LOCAL(0))); | 533 BUILD(r, WASM_I64_POPCNT(WASM_GET_LOCAL(0))); |
544 for (size_t i = 0; i < arraysize(values); i++) { | 534 for (size_t i = 0; i < arraysize(values); i++) { |
545 CHECK_EQ(values[i].expected, r.Call(values[i].input)); | 535 CHECK_EQ(values[i].expected, r.Call(values[i].input)); |
546 } | 536 } |
547 } | 537 } |
548 | 538 |
549 // kExprF32SConvertI64: | |
550 TEST(Run_WasmF32SConvertI64) { | 539 TEST(Run_WasmF32SConvertI64) { |
551 REQUIRE(F32SConvertI64); | 540 REQUIRE(F32SConvertI64); |
552 WasmRunner<float> r(MachineType::Int64()); | 541 WasmRunner<float> r(MachineType::Int64()); |
553 BUILD(r, WASM_F32_SCONVERT_I64(WASM_GET_LOCAL(0))); | 542 BUILD(r, WASM_F32_SCONVERT_I64(WASM_GET_LOCAL(0))); |
554 FOR_INT64_INPUTS(i) { CHECK_FLOAT_EQ(static_cast<float>(*i), r.Call(*i)); } | 543 FOR_INT64_INPUTS(i) { CHECK_FLOAT_EQ(static_cast<float>(*i), r.Call(*i)); } |
555 } | 544 } |
556 // kExprF32UConvertI64: | 545 |
557 TEST(Run_WasmF32UConvertI64) { | 546 TEST(Run_WasmF32UConvertI64) { |
558 REQUIRE(F32UConvertI64); | 547 REQUIRE(F32UConvertI64); |
559 struct { | 548 struct { |
560 uint64_t input; | 549 uint64_t input; |
561 uint32_t expected; | 550 uint32_t expected; |
562 } values[] = {{0x0, 0x0}, | 551 } values[] = {{0x0, 0x0}, |
563 {0x1, 0x3f800000}, | 552 {0x1, 0x3f800000}, |
564 {0xffffffff, 0x4f800000}, | 553 {0xffffffff, 0x4f800000}, |
565 {0x1b09788b, 0x4dd84bc4}, | 554 {0x1b09788b, 0x4dd84bc4}, |
566 {0x4c5fce8, 0x4c98bf9d}, | 555 {0x4c5fce8, 0x4c98bf9d}, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 {0x8000008000000000, 0x5f000000}, | 623 {0x8000008000000000, 0x5f000000}, |
635 {0x8000008000000001, 0x5f000001}, | 624 {0x8000008000000001, 0x5f000001}, |
636 {0x8000000000000400, 0x5f000000}, | 625 {0x8000000000000400, 0x5f000000}, |
637 {0x8000000000000401, 0x5f000000}}; | 626 {0x8000000000000401, 0x5f000000}}; |
638 WasmRunner<float> r(MachineType::Uint64()); | 627 WasmRunner<float> r(MachineType::Uint64()); |
639 BUILD(r, WASM_F32_UCONVERT_I64(WASM_GET_LOCAL(0))); | 628 BUILD(r, WASM_F32_UCONVERT_I64(WASM_GET_LOCAL(0))); |
640 for (size_t i = 0; i < arraysize(values); i++) { | 629 for (size_t i = 0; i < arraysize(values); i++) { |
641 CHECK_EQ(bit_cast<float>(values[i].expected), r.Call(values[i].input)); | 630 CHECK_EQ(bit_cast<float>(values[i].expected), r.Call(values[i].input)); |
642 } | 631 } |
643 } | 632 } |
644 // kExprF64SConvertI64: | 633 |
645 TEST(Run_WasmF64SConvertI64) { | 634 TEST(Run_WasmF64SConvertI64) { |
646 REQUIRE(F64SConvertI64); | 635 REQUIRE(F64SConvertI64); |
647 WasmRunner<double> r(MachineType::Int64()); | 636 WasmRunner<double> r(MachineType::Int64()); |
648 BUILD(r, WASM_F64_SCONVERT_I64(WASM_GET_LOCAL(0))); | 637 BUILD(r, WASM_F64_SCONVERT_I64(WASM_GET_LOCAL(0))); |
649 FOR_INT64_INPUTS(i) { CHECK_DOUBLE_EQ(static_cast<double>(*i), r.Call(*i)); } | 638 FOR_INT64_INPUTS(i) { CHECK_DOUBLE_EQ(static_cast<double>(*i), r.Call(*i)); } |
650 } | 639 } |
651 // kExprF64UConvertI64: | 640 |
652 TEST(Run_Wasm_F64UConvertI64) { | 641 TEST(Run_Wasm_F64UConvertI64) { |
653 REQUIRE(F64UConvertI64); | 642 REQUIRE(F64UConvertI64); |
654 struct { | 643 struct { |
655 uint64_t input; | 644 uint64_t input; |
656 uint64_t expected; | 645 uint64_t expected; |
657 } values[] = {{0x0, 0x0}, | 646 } values[] = {{0x0, 0x0}, |
658 {0x1, 0x3ff0000000000000}, | 647 {0x1, 0x3ff0000000000000}, |
659 {0xffffffff, 0x41efffffffe00000}, | 648 {0xffffffff, 0x41efffffffe00000}, |
660 {0x1b09788b, 0x41bb09788b000000}, | 649 {0x1b09788b, 0x41bb09788b000000}, |
661 {0x4c5fce8, 0x419317f3a0000000}, | 650 {0x4c5fce8, 0x419317f3a0000000}, |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 {0x8000008000000000, 0x43e0000010000000}, | 717 {0x8000008000000000, 0x43e0000010000000}, |
729 {0x8000008000000001, 0x43e0000010000000}, | 718 {0x8000008000000001, 0x43e0000010000000}, |
730 {0x8000000000000400, 0x43e0000000000000}, | 719 {0x8000000000000400, 0x43e0000000000000}, |
731 {0x8000000000000401, 0x43e0000000000001}}; | 720 {0x8000000000000401, 0x43e0000000000001}}; |
732 WasmRunner<double> r(MachineType::Uint64()); | 721 WasmRunner<double> r(MachineType::Uint64()); |
733 BUILD(r, WASM_F64_UCONVERT_I64(WASM_GET_LOCAL(0))); | 722 BUILD(r, WASM_F64_UCONVERT_I64(WASM_GET_LOCAL(0))); |
734 for (size_t i = 0; i < arraysize(values); i++) { | 723 for (size_t i = 0; i < arraysize(values); i++) { |
735 CHECK_EQ(bit_cast<double>(values[i].expected), r.Call(values[i].input)); | 724 CHECK_EQ(bit_cast<double>(values[i].expected), r.Call(values[i].input)); |
736 } | 725 } |
737 } | 726 } |
738 // kExprI64SConvertF32: | |
739 | 727 |
740 TEST(Run_Wasm_I64SConvertF32a) { | 728 TEST(Run_Wasm_I64SConvertF32a) { |
741 WasmRunner<int64_t> r(MachineType::Float32()); | 729 WasmRunner<int64_t> r(MachineType::Float32()); |
742 BUILD(r, WASM_I64_SCONVERT_F32(WASM_GET_LOCAL(0))); | 730 BUILD(r, WASM_I64_SCONVERT_F32(WASM_GET_LOCAL(0))); |
743 | 731 |
744 FOR_FLOAT32_INPUTS(i) { | 732 FOR_FLOAT32_INPUTS(i) { |
745 if (*i < static_cast<float>(std::numeric_limits<int64_t>::max()) && | 733 if (*i < static_cast<float>(std::numeric_limits<int64_t>::max()) && |
746 *i >= static_cast<float>(std::numeric_limits<int64_t>::min())) { | 734 *i >= static_cast<float>(std::numeric_limits<int64_t>::min())) { |
747 CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i)); | 735 CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i)); |
748 } else { | 736 } else { |
749 CHECK_TRAP64(r.Call(*i)); | 737 CHECK_TRAP64(r.Call(*i)); |
750 } | 738 } |
751 } | 739 } |
752 } | 740 } |
753 // kExprI64SConvertF64: | 741 |
754 TEST(Run_Wasm_I64SConvertF64a) { | 742 TEST(Run_Wasm_I64SConvertF64a) { |
755 WasmRunner<int64_t> r(MachineType::Float64()); | 743 WasmRunner<int64_t> r(MachineType::Float64()); |
756 BUILD(r, WASM_I64_SCONVERT_F64(WASM_GET_LOCAL(0))); | 744 BUILD(r, WASM_I64_SCONVERT_F64(WASM_GET_LOCAL(0))); |
757 | 745 |
758 FOR_FLOAT64_INPUTS(i) { | 746 FOR_FLOAT64_INPUTS(i) { |
759 if (*i < static_cast<double>(std::numeric_limits<int64_t>::max()) && | 747 if (*i < static_cast<double>(std::numeric_limits<int64_t>::max()) && |
760 *i >= static_cast<double>(std::numeric_limits<int64_t>::min())) { | 748 *i >= static_cast<double>(std::numeric_limits<int64_t>::min())) { |
761 CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i)); | 749 CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i)); |
762 } else { | 750 } else { |
763 CHECK_TRAP64(r.Call(*i)); | 751 CHECK_TRAP64(r.Call(*i)); |
764 } | 752 } |
765 } | 753 } |
766 } | 754 } |
767 | 755 |
768 // kExprI64UConvertF32: | |
769 TEST(Run_Wasm_I64UConvertF32a) { | 756 TEST(Run_Wasm_I64UConvertF32a) { |
770 WasmRunner<uint64_t> r(MachineType::Float32()); | 757 WasmRunner<uint64_t> r(MachineType::Float32()); |
771 BUILD(r, WASM_I64_UCONVERT_F32(WASM_GET_LOCAL(0))); | 758 BUILD(r, WASM_I64_UCONVERT_F32(WASM_GET_LOCAL(0))); |
772 | 759 |
773 FOR_FLOAT32_INPUTS(i) { | 760 FOR_FLOAT32_INPUTS(i) { |
774 if (*i < static_cast<float>(std::numeric_limits<uint64_t>::max()) && | 761 if (*i < static_cast<float>(std::numeric_limits<uint64_t>::max()) && |
775 *i > -1) { | 762 *i > -1) { |
776 CHECK_EQ(static_cast<uint64_t>(*i), r.Call(*i)); | 763 CHECK_EQ(static_cast<uint64_t>(*i), r.Call(*i)); |
777 } else { | 764 } else { |
778 CHECK_TRAP64(r.Call(*i)); | 765 CHECK_TRAP64(r.Call(*i)); |
779 } | 766 } |
780 } | 767 } |
781 } | 768 } |
782 | 769 |
783 // kExprI64UConvertF64: | |
784 TEST(Run_Wasm_I64UConvertF64a) { | 770 TEST(Run_Wasm_I64UConvertF64a) { |
785 WasmRunner<uint64_t> r(MachineType::Float64()); | 771 WasmRunner<uint64_t> r(MachineType::Float64()); |
786 BUILD(r, WASM_I64_UCONVERT_F64(WASM_GET_LOCAL(0))); | 772 BUILD(r, WASM_I64_UCONVERT_F64(WASM_GET_LOCAL(0))); |
787 | 773 |
788 FOR_FLOAT64_INPUTS(i) { | 774 FOR_FLOAT64_INPUTS(i) { |
789 if (*i < static_cast<float>(std::numeric_limits<uint64_t>::max()) && | 775 if (*i < static_cast<float>(std::numeric_limits<uint64_t>::max()) && |
790 *i > -1) { | 776 *i > -1) { |
791 CHECK_EQ(static_cast<uint64_t>(*i), r.Call(*i)); | 777 CHECK_EQ(static_cast<uint64_t>(*i), r.Call(*i)); |
792 } else { | 778 } else { |
793 CHECK_TRAP64(r.Call(*i)); | 779 CHECK_TRAP64(r.Call(*i)); |
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1349 WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); | 1335 WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); |
1350 BUILD(r, WASM_I64_ROL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 1336 BUILD(r, WASM_I64_ROL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
1351 | 1337 |
1352 FOR_UINT64_INPUTS(i) { | 1338 FOR_UINT64_INPUTS(i) { |
1353 FOR_UINT64_INPUTS(j) { | 1339 FOR_UINT64_INPUTS(j) { |
1354 int64_t expected = bits::RotateLeft64(*i, *j & 0x3f); | 1340 int64_t expected = bits::RotateLeft64(*i, *j & 0x3f); |
1355 CHECK_EQ(expected, r.Call(*i, *j)); | 1341 CHECK_EQ(expected, r.Call(*i, *j)); |
1356 } | 1342 } |
1357 } | 1343 } |
1358 } | 1344 } |
OLD | NEW |