| 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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 BUILD(r, WASM_I64_UCONVERT_I32(WASM_GET_LOCAL(0))); | 255 BUILD(r, WASM_I64_UCONVERT_I32(WASM_GET_LOCAL(0))); |
| 256 FOR_UINT32_INPUTS(i) { CHECK_EQ(static_cast<uint64_t>(*i), r.Call(*i)); } | 256 FOR_UINT32_INPUTS(i) { CHECK_EQ(static_cast<uint64_t>(*i), r.Call(*i)); } |
| 257 } | 257 } |
| 258 | 258 |
| 259 // kExprF64ReinterpretI64: | 259 // kExprF64ReinterpretI64: |
| 260 // kExprI64ReinterpretF64: | 260 // kExprI64ReinterpretF64: |
| 261 | 261 |
| 262 // kExprI64Clz: | 262 // kExprI64Clz: |
| 263 // kExprI64Ctz: | 263 // kExprI64Ctz: |
| 264 // kExprI64Popcnt: | 264 // kExprI64Popcnt: |
| 265 TEST(Run_WasmI64Popcnt) { |
| 266 struct { |
| 267 int64_t expected; |
| 268 uint64_t input; |
| 269 } values[] = {{64, 0xffffffffffffffff}, |
| 270 {0, 0x0000000000000000}, |
| 271 {2, 0x0000080000008000}, |
| 272 {26, 0x1123456782345678}, |
| 273 {38, 0xffedcba09edcba09}}; |
| 274 |
| 275 WasmRunner<int64_t> r(MachineType::Uint64()); |
| 276 BUILD(r, WASM_I64_POPCNT(WASM_GET_LOCAL(0))); |
| 277 for (size_t i = 0; i < arraysize(values); i++) { |
| 278 CHECK_EQ(values[i].expected, r.Call(values[i].input)); |
| 279 } |
| 280 } |
| 265 | 281 |
| 266 // kExprF32SConvertI64: | 282 // kExprF32SConvertI64: |
| 267 TEST(Run_WasmF32SConvertI64) { | 283 TEST(Run_WasmF32SConvertI64) { |
| 268 WasmRunner<float> r(MachineType::Int64()); | 284 WasmRunner<float> r(MachineType::Int64()); |
| 269 BUILD(r, WASM_F32_SCONVERT_I64(WASM_GET_LOCAL(0))); | 285 BUILD(r, WASM_F32_SCONVERT_I64(WASM_GET_LOCAL(0))); |
| 270 FOR_INT64_INPUTS(i) { CHECK_EQ(static_cast<float>(*i), r.Call(*i)); } | 286 FOR_INT64_INPUTS(i) { CHECK_EQ(static_cast<float>(*i), r.Call(*i)); } |
| 271 } | 287 } |
| 272 // kExprF32UConvertI64: | 288 // kExprF32UConvertI64: |
| 273 TEST(Run_WasmF32UConvertI64) { | 289 TEST(Run_WasmF32UConvertI64) { |
| 274 struct { | 290 struct { |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 WASM_I64V_10(0xbcd1234000000013), WASM_I64V_10(0xbcd1234000000014), | 499 WASM_I64V_10(0xbcd1234000000013), WASM_I64V_10(0xbcd1234000000014), |
| 484 WASM_I64V_10(0xbcd1234000000015), WASM_I64V_10(0xbcd1234000000016), | 500 WASM_I64V_10(0xbcd1234000000015), WASM_I64V_10(0xbcd1234000000016), |
| 485 WASM_I64V_10(0xbcd1234000000017), WASM_I64V_10(0xbcd1234000000018), | 501 WASM_I64V_10(0xbcd1234000000017), WASM_I64V_10(0xbcd1234000000018), |
| 486 WASM_I64V_10(0xbcd1234000000019), WASM_I64V_10(0xbcd123400000001a), | 502 WASM_I64V_10(0xbcd1234000000019), WASM_I64V_10(0xbcd123400000001a), |
| 487 WASM_I64V_10(0xbcd123400000001b), WASM_I64V_10(0xbcd123400000001c), | 503 WASM_I64V_10(0xbcd123400000001b), WASM_I64V_10(0xbcd123400000001c), |
| 488 WASM_I64V_10(0xbcd123400000001d)))); | 504 WASM_I64V_10(0xbcd123400000001d)))); |
| 489 | 505 |
| 490 CHECK_EQ(i + 0xb, r.Call()); | 506 CHECK_EQ(i + 0xb, r.Call()); |
| 491 } | 507 } |
| 492 } | 508 } |
| OLD | NEW |