Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(383)

Side by Side Diff: test/cctest/wasm/test-run-wasm-64.cc

Issue 1775903002: [wasm] Int64Lowering of I64XConvertFXX instructions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/cctest/wasm/test-run-wasm.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 {0x8000008000000001, 0x43e0000010000000}, 435 {0x8000008000000001, 0x43e0000010000000},
436 {0x8000000000000400, 0x43e0000000000000}, 436 {0x8000000000000400, 0x43e0000000000000},
437 {0x8000000000000401, 0x43e0000000000001}}; 437 {0x8000000000000401, 0x43e0000000000001}};
438 WasmRunner<double> r(MachineType::Uint64()); 438 WasmRunner<double> r(MachineType::Uint64());
439 BUILD(r, WASM_F64_UCONVERT_I64(WASM_GET_LOCAL(0))); 439 BUILD(r, WASM_F64_UCONVERT_I64(WASM_GET_LOCAL(0)));
440 for (size_t i = 0; i < arraysize(values); i++) { 440 for (size_t i = 0; i < arraysize(values); i++) {
441 CHECK_EQ(bit_cast<double>(values[i].expected), r.Call(values[i].input)); 441 CHECK_EQ(bit_cast<double>(values[i].expected), r.Call(values[i].input));
442 } 442 }
443 } 443 }
444 // kExprI64SConvertF32: 444 // kExprI64SConvertF32:
445
446 TEST(Run_Wasm_I64SConvertF32) {
447 WasmRunner<int64_t> r(MachineType::Float32());
448 BUILD(r, WASM_I64_SCONVERT_F32(WASM_GET_LOCAL(0)));
449
450 FOR_FLOAT32_INPUTS(i) {
451 if (*i < static_cast<float>(std::numeric_limits<int64_t>::max()) &&
452 *i >= static_cast<float>(std::numeric_limits<int64_t>::min())) {
453 CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i));
454 } else {
455 CHECK_TRAP64(r.Call(*i));
456 }
457 }
458 }
445 // kExprI64SConvertF64: 459 // kExprI64SConvertF64:
460 TEST(Run_Wasm_I64SConvertF64) {
461 WasmRunner<int64_t> r(MachineType::Float64());
462 BUILD(r, WASM_I64_SCONVERT_F64(WASM_GET_LOCAL(0)));
463
464 FOR_FLOAT64_INPUTS(i) {
465 if (*i < static_cast<double>(std::numeric_limits<int64_t>::max()) &&
466 *i >= static_cast<double>(std::numeric_limits<int64_t>::min())) {
467 CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i));
468 } else {
469 CHECK_TRAP64(r.Call(*i));
470 }
471 }
472 }
473
446 // kExprI64UConvertF32: 474 // kExprI64UConvertF32:
475 TEST(Run_Wasm_I64UConvertF32) {
476 WasmRunner<uint64_t> r(MachineType::Float32());
477 BUILD(r, WASM_I64_UCONVERT_F32(WASM_GET_LOCAL(0)));
478
479 FOR_FLOAT32_INPUTS(i) {
480 if (*i < static_cast<float>(std::numeric_limits<uint64_t>::max()) &&
481 *i > -1) {
482 CHECK_EQ(static_cast<uint64_t>(*i), r.Call(*i));
483 } else {
484 CHECK_TRAP64(r.Call(*i));
485 }
486 }
487 }
488
447 // kExprI64UConvertF64: 489 // kExprI64UConvertF64:
490 TEST(Run_Wasm_I64UConvertF64) {
491 WasmRunner<uint64_t> r(MachineType::Float64());
492 BUILD(r, WASM_I64_UCONVERT_F64(WASM_GET_LOCAL(0)));
493
494 FOR_FLOAT64_INPUTS(i) {
495 if (*i < static_cast<float>(std::numeric_limits<uint64_t>::max()) &&
496 *i > -1) {
497 CHECK_EQ(static_cast<uint64_t>(*i), r.Call(*i));
498 } else {
499 CHECK_TRAP64(r.Call(*i));
500 }
501 }
502 }
448 503
449 TEST(Run_WasmCallI64Parameter) { 504 TEST(Run_WasmCallI64Parameter) {
450 // Build the target function. 505 // Build the target function.
451 LocalType param_types[20]; 506 LocalType param_types[20];
452 for (int i = 0; i < 20; i++) param_types[i] = kAstI64; 507 for (int i = 0; i < 20; i++) param_types[i] = kAstI64;
453 param_types[3] = kAstI32; 508 param_types[3] = kAstI32;
454 param_types[4] = kAstI32; 509 param_types[4] = kAstI32;
455 FunctionSig sig(1, 19, param_types); 510 FunctionSig sig(1, 19, param_types);
456 for (int i = 0; i < 19; i++) { 511 for (int i = 0; i < 19; i++) {
457 TestingModule module; 512 TestingModule module;
(...skipping 18 matching lines...) Expand all
476 WASM_I64V_10(0xbcd1234000000013), WASM_I64V_10(0xbcd1234000000014), 531 WASM_I64V_10(0xbcd1234000000013), WASM_I64V_10(0xbcd1234000000014),
477 WASM_I64V_10(0xbcd1234000000015), WASM_I64V_10(0xbcd1234000000016), 532 WASM_I64V_10(0xbcd1234000000015), WASM_I64V_10(0xbcd1234000000016),
478 WASM_I64V_10(0xbcd1234000000017), WASM_I64V_10(0xbcd1234000000018), 533 WASM_I64V_10(0xbcd1234000000017), WASM_I64V_10(0xbcd1234000000018),
479 WASM_I64V_10(0xbcd1234000000019), WASM_I64V_10(0xbcd123400000001a), 534 WASM_I64V_10(0xbcd1234000000019), WASM_I64V_10(0xbcd123400000001a),
480 WASM_I64V_10(0xbcd123400000001b), WASM_I64V_10(0xbcd123400000001c), 535 WASM_I64V_10(0xbcd123400000001b), WASM_I64V_10(0xbcd123400000001c),
481 WASM_I64V_10(0xbcd123400000001d)))); 536 WASM_I64V_10(0xbcd123400000001d))));
482 537
483 CHECK_EQ(i + 0xb, r.Call()); 538 CHECK_EQ(i + 0xb, r.Call());
484 } 539 }
485 } 540 }
OLDNEW
« no previous file with comments | « test/cctest/wasm/test-run-wasm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698