OLD | NEW |
---|---|
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
383 | 383 |
384 size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseLsa); | 384 size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseLsa); |
385 for (size_t i = 0; i < nr_test_cases; ++i) { | 385 for (size_t i = 0; i < nr_test_cases; ++i) { |
386 uint32_t res = run_lsa(tc[i].rt, tc[i].rs, tc[i].sa); | 386 uint32_t res = run_lsa(tc[i].rt, tc[i].rs, tc[i].sa); |
387 PrintF("0x%x =? 0x%x == lsa(v0, %x, %x, %hhu)\n", tc[i].expected_res, res, | 387 PrintF("0x%x =? 0x%x == lsa(v0, %x, %x, %hhu)\n", tc[i].expected_res, res, |
388 tc[i].rt, tc[i].rs, tc[i].sa); | 388 tc[i].rt, tc[i].rs, tc[i].sa); |
389 CHECK_EQ(tc[i].expected_res, res); | 389 CHECK_EQ(tc[i].expected_res, res); |
390 } | 390 } |
391 } | 391 } |
392 | 392 |
393 static const std::vector<uint32_t> uint32_test_values() { | 393 static const std::vector<uint32_t> cvt_trunc_uint32_test_values() { |
394 static const uint32_t kValues[] = {0x00000000, 0x00000001, 0x00ffff00, | 394 static const uint32_t kValues[] = {0x00000000, 0x00000001, 0x00ffff00, |
395 0x7fffffff, 0x80000000, 0x80000001, | 395 0x7fffffff, 0x80000000, 0x80000001, |
396 0x80ffff00, 0x8fffffff, 0xffffffff}; | 396 0x80ffff00, 0x8fffffff, 0xffffffff}; |
397 return std::vector<uint32_t>(&kValues[0], &kValues[arraysize(kValues)]); | 397 return std::vector<uint32_t>(&kValues[0], &kValues[arraysize(kValues)]); |
398 } | 398 } |
399 | 399 |
400 static const std::vector<int32_t> int32_test_values() { | 400 static const std::vector<int32_t> cvt_trunc_int32_test_values() { |
401 static const int32_t kValues[] = { | 401 static const int32_t kValues[] = { |
402 static_cast<int32_t>(0x00000000), static_cast<int32_t>(0x00000001), | 402 static_cast<int32_t>(0x00000000), static_cast<int32_t>(0x00000001), |
403 static_cast<int32_t>(0x00ffff00), static_cast<int32_t>(0x7fffffff), | 403 static_cast<int32_t>(0x00ffff00), static_cast<int32_t>(0x7fffffff), |
404 static_cast<int32_t>(0x80000000), static_cast<int32_t>(0x80000001), | 404 static_cast<int32_t>(0x80000000), static_cast<int32_t>(0x80000001), |
405 static_cast<int32_t>(0x80ffff00), static_cast<int32_t>(0x8fffffff), | 405 static_cast<int32_t>(0x80ffff00), static_cast<int32_t>(0x8fffffff), |
406 static_cast<int32_t>(0xffffffff)}; | 406 static_cast<int32_t>(0xffffffff)}; |
407 return std::vector<int32_t>(&kValues[0], &kValues[arraysize(kValues)]); | 407 return std::vector<int32_t>(&kValues[0], &kValues[arraysize(kValues)]); |
408 } | 408 } |
409 | 409 |
410 // Helper macros that can be used in FOR_INT32_INPUTS(i) { ... *i ... } | 410 // Helper macros that can be used in FOR_INT32_INPUTS(i) { ... *i ... } |
411 #define FOR_INPUTS(ctype, itype, var) \ | 411 #define FOR_INPUTS(ctype, itype, var, test_vector) \ |
412 std::vector<ctype> var##_vec = itype##_test_values(); \ | 412 std::vector<ctype> var##_vec = test_vector(); \ |
413 for (std::vector<ctype>::iterator var = var##_vec.begin(); \ | 413 for (std::vector<ctype>::iterator var = var##_vec.begin(); \ |
414 var != var##_vec.end(); ++var) | 414 var != var##_vec.end(); ++var) |
415 | 415 |
416 #define FOR_UINT32_INPUTS(var) FOR_INPUTS(uint32_t, uint32, var) | 416 #define FOR_ENUM_INPUTS(var, type, test_vector) \ |
417 #define FOR_INT32_INPUTS(var) FOR_INPUTS(int32_t, int32, var) | 417 FOR_INPUTS(enum type, type, var, test_vector) |
418 #define FOR_STRUCT_INPUTS(var, type, test_vector) \ | |
419 FOR_INPUTS(struct type, type, var, test_vector) | |
420 #define FOR_UINT32_INPUTS(var, test_vector) \ | |
421 FOR_INPUTS(uint32_t, uint32, var, test_vector) | |
422 #define FOR_INT32_INPUTS(var, test_vector) \ | |
423 FOR_INPUTS(int32_t, int32, var, test_vector) | |
418 | 424 |
balazs.kilvady
2016/04/05 17:25:20
Instead of the above macro-magic I would prefer a
| |
419 template <typename RET_TYPE, typename IN_TYPE, typename Func> | 425 template <typename RET_TYPE, typename IN_TYPE, typename Func> |
420 RET_TYPE run_Cvt(IN_TYPE x, Func GenerateConvertInstructionFunc) { | 426 RET_TYPE run_Cvt(IN_TYPE x, Func GenerateConvertInstructionFunc) { |
421 typedef RET_TYPE (*F_CVT)(IN_TYPE x0, int x1, int x2, int x3, int x4); | 427 typedef RET_TYPE (*F_CVT)(IN_TYPE x0, int x1, int x2, int x3, int x4); |
422 | 428 |
423 Isolate* isolate = CcTest::i_isolate(); | 429 Isolate* isolate = CcTest::i_isolate(); |
424 HandleScope scope(isolate); | 430 HandleScope scope(isolate); |
425 MacroAssembler assm(isolate, nullptr, 0, | 431 MacroAssembler assm(isolate, nullptr, 0, |
426 v8::internal::CodeObjectRequired::kYes); | 432 v8::internal::CodeObjectRequired::kYes); |
427 MacroAssembler* masm = &assm; | 433 MacroAssembler* masm = &assm; |
428 | 434 |
429 __ mtc1(a0, f4); | 435 __ mtc1(a0, f4); |
430 GenerateConvertInstructionFunc(masm); | 436 GenerateConvertInstructionFunc(masm); |
431 __ mfc1(v0, f2); | 437 __ mfc1(v0, f2); |
432 __ jr(ra); | 438 __ jr(ra); |
433 __ nop(); | 439 __ nop(); |
434 | 440 |
435 CodeDesc desc; | 441 CodeDesc desc; |
436 assm.GetCode(&desc); | 442 assm.GetCode(&desc); |
437 Handle<Code> code = isolate->factory()->NewCode( | 443 Handle<Code> code = isolate->factory()->NewCode( |
438 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 444 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
439 | 445 |
440 F_CVT f = FUNCTION_CAST<F_CVT>(code->entry()); | 446 F_CVT f = FUNCTION_CAST<F_CVT>(code->entry()); |
441 | 447 |
442 return reinterpret_cast<RET_TYPE>( | 448 return reinterpret_cast<RET_TYPE>( |
443 CALL_GENERATED_CODE(isolate, f, x, 0, 0, 0, 0)); | 449 CALL_GENERATED_CODE(isolate, f, x, 0, 0, 0, 0)); |
444 } | 450 } |
445 | 451 |
446 TEST(cvt_s_w_Trunc_uw_s) { | 452 TEST(cvt_s_w_Trunc_uw_s) { |
447 CcTest::InitializeVM(); | 453 CcTest::InitializeVM(); |
448 FOR_UINT32_INPUTS(i) { | 454 FOR_UINT32_INPUTS(i, cvt_trunc_uint32_test_values) { |
449 uint32_t input = *i; | 455 uint32_t input = *i; |
450 CHECK_EQ(static_cast<float>(input), | 456 CHECK_EQ(static_cast<float>(input), |
451 run_Cvt<uint32_t>(input, [](MacroAssembler* masm) { | 457 run_Cvt<uint32_t>(input, [](MacroAssembler* masm) { |
452 __ cvt_s_w(f0, f4); | 458 __ cvt_s_w(f0, f4); |
453 __ Trunc_uw_s(f2, f0, f1); | 459 __ Trunc_uw_s(f2, f0, f1); |
454 })); | 460 })); |
455 } | 461 } |
456 } | 462 } |
457 | 463 |
458 TEST(cvt_d_w_Trunc_w_d) { | 464 TEST(cvt_d_w_Trunc_w_d) { |
459 CcTest::InitializeVM(); | 465 CcTest::InitializeVM(); |
460 FOR_INT32_INPUTS(i) { | 466 FOR_INT32_INPUTS(i, cvt_trunc_int32_test_values) { |
461 int32_t input = *i; | 467 int32_t input = *i; |
462 CHECK_EQ(static_cast<double>(input), | 468 CHECK_EQ(static_cast<double>(input), |
463 run_Cvt<int32_t>(input, [](MacroAssembler* masm) { | 469 run_Cvt<int32_t>(input, [](MacroAssembler* masm) { |
464 __ cvt_d_w(f0, f4); | 470 __ cvt_d_w(f0, f4); |
465 __ Trunc_w_d(f2, f0); | 471 __ Trunc_w_d(f2, f0); |
466 })); | 472 })); |
467 } | 473 } |
468 } | 474 } |
469 | 475 |
476 static const std::vector<int32_t> overflow_int32_test_values() { | |
477 static const int32_t kValues[] = { | |
478 static_cast<int32_t>(0xf0000000), static_cast<int32_t>(0x00000001), | |
479 static_cast<int32_t>(0xff000000), static_cast<int32_t>(0x0000f000), | |
480 static_cast<int32_t>(0x0f000000), static_cast<int32_t>(0x991234ab), | |
481 static_cast<int32_t>(0xb0ffff01), static_cast<int32_t>(0x00006fff), | |
482 static_cast<int32_t>(0xffffffff)}; | |
483 return std::vector<int32_t>(&kValues[0], &kValues[arraysize(kValues)]); | |
484 } | |
485 | |
486 enum OverflowBranchType { | |
487 kAddBranchOverflow, | |
488 kSubBranchOverflow, | |
489 }; | |
490 | |
491 struct OverflowRegisterCombination { | |
492 Register dst; | |
493 Register left; | |
494 Register right; | |
495 Register scratch; | |
496 }; | |
497 | |
498 static const std::vector<enum OverflowBranchType> overflow_branch_type() { | |
499 static const enum OverflowBranchType kValues[] = {kAddBranchOverflow, | |
500 kSubBranchOverflow}; | |
501 return std::vector<enum OverflowBranchType>(&kValues[0], | |
502 &kValues[arraysize(kValues)]); | |
503 } | |
504 | |
505 static const std::vector<struct OverflowRegisterCombination> | |
506 overflow_register_combination() { | |
507 static const struct OverflowRegisterCombination kValues[] = { | |
508 {t0, t1, t2, t3}, {t0, t0, t2, t3}, {t0, t1, t0, t3}, {t0, t1, t1, t3}}; | |
509 return std::vector<struct OverflowRegisterCombination>( | |
510 &kValues[0], &kValues[arraysize(kValues)]); | |
511 } | |
512 | |
513 template <typename T> | |
514 static bool IsAddOverflow(T x, T y) { | |
515 DCHECK(std::numeric_limits<T>::is_integer); | |
516 T max = std::numeric_limits<T>::max(); | |
517 T min = std::numeric_limits<T>::min(); | |
518 | |
519 return (x > 0 && y > (max - x)) || (x < 0 && y < (min - x)); | |
520 } | |
521 | |
522 template <typename T> | |
523 static bool IsSubOverflow(T x, T y) { | |
524 DCHECK(std::numeric_limits<T>::is_integer); | |
525 T max = std::numeric_limits<T>::max(); | |
526 T min = std::numeric_limits<T>::min(); | |
527 | |
528 return (y > 0 && x < (min + y)) || (y < 0 && x > (max + y)); | |
529 } | |
530 | |
531 template <typename IN_TYPE, typename Func> | |
532 bool run_Overflow(IN_TYPE valLeft, IN_TYPE valRight, | |
533 Func GenerateOverflowInstructions) { | |
balazs.kilvady
2016/04/05 17:25:20
Functionname should be run_overflow or RunOverflow
| |
534 typedef int32_t (*F_CVT)(char* x0, int x1, int x2, int x3, int x4); | |
535 | |
536 Isolate* isolate = CcTest::i_isolate(); | |
537 HandleScope scope(isolate); | |
538 MacroAssembler assm(isolate, nullptr, 0, | |
539 v8::internal::CodeObjectRequired::kYes); | |
540 MacroAssembler* masm = &assm; | |
541 | |
542 GenerateOverflowInstructions(masm, valLeft, valRight); | |
543 __ jr(ra); | |
544 __ nop(); | |
545 | |
546 CodeDesc desc; | |
547 assm.GetCode(&desc); | |
548 Handle<Code> code = isolate->factory()->NewCode( | |
549 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | |
550 | |
551 F_CVT f = FUNCTION_CAST<F_CVT>(code->entry()); | |
552 | |
553 int32_t r = | |
554 reinterpret_cast<int32_t>(CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); | |
555 | |
556 DCHECK(r == 0 || r == 1); | |
557 return static_cast<bool>(r); | |
balazs.kilvady
2016/04/05 17:25:20
Could be simply 'return r;' or 'return r != 0;'
| |
558 } | |
559 | |
560 TEST(BranchOverflowInt32BothLabels) { | |
561 FOR_INT32_INPUTS(i, overflow_int32_test_values) { | |
562 FOR_INT32_INPUTS(j, overflow_int32_test_values) { | |
563 FOR_ENUM_INPUTS(br, OverflowBranchType, overflow_branch_type) { | |
564 FOR_STRUCT_INPUTS(regComb, OverflowRegisterCombination, | |
565 overflow_register_combination) { | |
566 int32_t ii = *i; | |
567 int32_t jj = *j; | |
568 enum OverflowBranchType branchType = *br; | |
569 struct OverflowRegisterCombination rc = *regComb; | |
570 | |
571 // If left and right register are same then left and right | |
572 // test values must also be same, otherwise we skip the test | |
573 if (rc.left.code() == rc.right.code()) { | |
574 if (ii != jj) { | |
575 continue; | |
576 } | |
577 } | |
578 | |
579 bool res1 = run_Overflow<int32_t>( | |
580 ii, jj, [branchType, rc](MacroAssembler* masm, int32_t valLeft, | |
581 int32_t valRight) { | |
582 Label overflow, no_overflow, end; | |
583 __ li(rc.left, valLeft); | |
584 __ li(rc.right, valRight); | |
585 switch (branchType) { | |
586 case kAddBranchOverflow: | |
587 __ AddBranchOvf(rc.dst, rc.left, rc.right, &overflow, | |
588 &no_overflow, rc.scratch); | |
589 break; | |
590 case kSubBranchOverflow: | |
591 __ SubBranchOvf(rc.dst, rc.left, rc.right, &overflow, | |
592 &no_overflow, rc.scratch); | |
593 break; | |
594 } | |
595 __ li(v0, 2); | |
596 __ Branch(&end); | |
597 __ bind(&overflow); | |
598 __ li(v0, 1); | |
599 __ Branch(&end); | |
600 __ bind(&no_overflow); | |
601 __ li(v0, 0); | |
602 __ bind(&end); | |
603 }); | |
604 | |
605 bool res2 = run_Overflow<int32_t>( | |
606 ii, jj, [branchType, rc](MacroAssembler* masm, int32_t valLeft, | |
607 int32_t valRight) { | |
608 Label overflow, no_overflow, end; | |
609 __ li(rc.left, valLeft); | |
610 switch (branchType) { | |
611 case kAddBranchOverflow: | |
612 __ AddBranchOvf(rc.dst, rc.left, Operand(valRight), | |
613 &overflow, &no_overflow, rc.scratch); | |
614 break; | |
615 case kSubBranchOverflow: | |
616 __ SubBranchOvf(rc.dst, rc.left, Operand(valRight), | |
617 &overflow, &no_overflow, rc.scratch); | |
618 break; | |
619 } | |
620 __ li(v0, 2); | |
621 __ Branch(&end); | |
622 __ bind(&overflow); | |
623 __ li(v0, 1); | |
624 __ Branch(&end); | |
625 __ bind(&no_overflow); | |
626 __ li(v0, 0); | |
627 __ bind(&end); | |
628 }); | |
629 | |
630 switch (branchType) { | |
631 case kAddBranchOverflow: | |
632 CHECK_EQ(IsAddOverflow<int32_t>(ii, jj), res1); | |
633 CHECK_EQ(IsAddOverflow<int32_t>(ii, jj), res2); | |
634 break; | |
635 case kSubBranchOverflow: | |
636 CHECK_EQ(IsSubOverflow<int32_t>(ii, jj), res1); | |
637 CHECK_EQ(IsSubOverflow<int32_t>(ii, jj), res2); | |
638 break; | |
639 default: | |
640 UNREACHABLE(); | |
641 } | |
642 } | |
643 } | |
644 } | |
645 } | |
646 } | |
647 | |
648 TEST(BranchOverflowInt32LeftLabel) { | |
649 FOR_INT32_INPUTS(i, overflow_int32_test_values) { | |
650 FOR_INT32_INPUTS(j, overflow_int32_test_values) { | |
651 FOR_ENUM_INPUTS(br, OverflowBranchType, overflow_branch_type) { | |
652 FOR_STRUCT_INPUTS(regComb, OverflowRegisterCombination, | |
653 overflow_register_combination) { | |
654 int32_t ii = *i; | |
655 int32_t jj = *j; | |
656 enum OverflowBranchType branchType = *br; | |
657 struct OverflowRegisterCombination rc = *regComb; | |
658 | |
659 // If left and right register are same then left and right | |
660 // test values must also be same, otherwise we skip the test | |
661 if (rc.left.code() == rc.right.code()) { | |
662 if (ii != jj) { | |
663 continue; | |
664 } | |
665 } | |
666 | |
667 bool res1 = run_Overflow<int32_t>( | |
668 ii, jj, [branchType, rc](MacroAssembler* masm, int32_t valLeft, | |
669 int32_t valRight) { | |
670 Label overflow, end; | |
671 __ li(rc.left, valLeft); | |
672 __ li(rc.right, valRight); | |
673 switch (branchType) { | |
674 case kAddBranchOverflow: | |
675 __ AddBranchOvf(rc.dst, rc.left, rc.right, &overflow, NULL, | |
676 rc.scratch); | |
677 break; | |
678 case kSubBranchOverflow: | |
679 __ SubBranchOvf(rc.dst, rc.left, rc.right, &overflow, NULL, | |
680 rc.scratch); | |
681 break; | |
682 } | |
683 __ li(v0, 0); | |
684 __ Branch(&end); | |
685 __ bind(&overflow); | |
686 __ li(v0, 1); | |
687 __ bind(&end); | |
688 }); | |
689 | |
690 bool res2 = run_Overflow<int32_t>( | |
691 ii, jj, [branchType, rc](MacroAssembler* masm, int32_t valLeft, | |
692 int32_t valRight) { | |
693 Label overflow, end; | |
694 __ li(rc.left, valLeft); | |
695 switch (branchType) { | |
696 case kAddBranchOverflow: | |
697 __ AddBranchOvf(rc.dst, rc.left, Operand(valRight), | |
698 &overflow, NULL, rc.scratch); | |
699 break; | |
700 case kSubBranchOverflow: | |
701 __ SubBranchOvf(rc.dst, rc.left, Operand(valRight), | |
702 &overflow, NULL, rc.scratch); | |
703 break; | |
704 } | |
705 __ li(v0, 0); | |
706 __ Branch(&end); | |
707 __ bind(&overflow); | |
708 __ li(v0, 1); | |
709 __ bind(&end); | |
710 }); | |
711 | |
712 switch (branchType) { | |
713 case kAddBranchOverflow: | |
714 CHECK_EQ(IsAddOverflow<int32_t>(ii, jj), res1); | |
715 CHECK_EQ(IsAddOverflow<int32_t>(ii, jj), res2); | |
716 break; | |
717 case kSubBranchOverflow: | |
718 CHECK_EQ(IsSubOverflow<int32_t>(ii, jj), res1); | |
719 CHECK_EQ(IsSubOverflow<int32_t>(ii, jj), res2); | |
720 break; | |
721 default: | |
722 UNREACHABLE(); | |
723 } | |
724 } | |
725 } | |
726 } | |
727 } | |
728 } | |
729 | |
730 TEST(BranchOverflowInt32RightLabel) { | |
731 FOR_INT32_INPUTS(i, overflow_int32_test_values) { | |
732 FOR_INT32_INPUTS(j, overflow_int32_test_values) { | |
733 FOR_ENUM_INPUTS(br, OverflowBranchType, overflow_branch_type) { | |
734 FOR_STRUCT_INPUTS(regComb, OverflowRegisterCombination, | |
735 overflow_register_combination) { | |
736 int32_t ii = *i; | |
737 int32_t jj = *j; | |
738 enum OverflowBranchType branchType = *br; | |
739 struct OverflowRegisterCombination rc = *regComb; | |
740 | |
741 // If left and right register are same then left and right | |
742 // test values must also be same, otherwise we skip the test | |
743 if (rc.left.code() == rc.right.code()) { | |
744 if (ii != jj) { | |
745 continue; | |
746 } | |
747 } | |
748 | |
749 bool res1 = run_Overflow<int32_t>( | |
750 ii, jj, [branchType, rc](MacroAssembler* masm, int32_t valLeft, | |
751 int32_t valRight) { | |
752 Label no_overflow, end; | |
753 __ li(rc.left, valLeft); | |
754 __ li(rc.right, valRight); | |
755 switch (branchType) { | |
756 case kAddBranchOverflow: | |
757 __ AddBranchOvf(rc.dst, rc.left, rc.right, NULL, | |
758 &no_overflow, rc.scratch); | |
759 break; | |
760 case kSubBranchOverflow: | |
761 __ SubBranchOvf(rc.dst, rc.left, rc.right, NULL, | |
762 &no_overflow, rc.scratch); | |
763 break; | |
764 } | |
765 __ li(v0, 1); | |
766 __ Branch(&end); | |
767 __ bind(&no_overflow); | |
768 __ li(v0, 0); | |
769 __ bind(&end); | |
770 }); | |
771 | |
772 bool res2 = run_Overflow<int32_t>( | |
773 ii, jj, [branchType, rc](MacroAssembler* masm, int32_t valLeft, | |
774 int32_t valRight) { | |
775 Label no_overflow, end; | |
776 __ li(rc.left, valLeft); | |
777 switch (branchType) { | |
778 case kAddBranchOverflow: | |
779 __ AddBranchOvf(rc.dst, rc.left, Operand(valRight), NULL, | |
780 &no_overflow, rc.scratch); | |
781 break; | |
782 case kSubBranchOverflow: | |
783 __ SubBranchOvf(rc.dst, rc.left, Operand(valRight), NULL, | |
784 &no_overflow, rc.scratch); | |
785 break; | |
786 } | |
787 __ li(v0, 1); | |
788 __ Branch(&end); | |
789 __ bind(&no_overflow); | |
790 __ li(v0, 0); | |
791 __ bind(&end); | |
792 }); | |
793 | |
794 switch (branchType) { | |
795 case kAddBranchOverflow: | |
796 CHECK_EQ(IsAddOverflow<int32_t>(ii, jj), res1); | |
797 CHECK_EQ(IsAddOverflow<int32_t>(ii, jj), res2); | |
798 break; | |
799 case kSubBranchOverflow: | |
800 CHECK_EQ(IsSubOverflow<int32_t>(ii, jj), res1); | |
801 CHECK_EQ(IsSubOverflow<int32_t>(ii, jj), res2); | |
802 break; | |
803 default: | |
804 UNREACHABLE(); | |
805 } | |
806 } | |
807 } | |
808 } | |
809 } | |
810 } | |
811 | |
470 TEST(min_max_nan) { | 812 TEST(min_max_nan) { |
471 CcTest::InitializeVM(); | 813 CcTest::InitializeVM(); |
472 Isolate* isolate = CcTest::i_isolate(); | 814 Isolate* isolate = CcTest::i_isolate(); |
473 HandleScope scope(isolate); | 815 HandleScope scope(isolate); |
474 MacroAssembler assembler(isolate, nullptr, 0, | 816 MacroAssembler assembler(isolate, nullptr, 0, |
475 v8::internal::CodeObjectRequired::kYes); | 817 v8::internal::CodeObjectRequired::kYes); |
476 MacroAssembler* masm = &assembler; | 818 MacroAssembler* masm = &assembler; |
477 | 819 |
478 struct TestFloat { | 820 struct TestFloat { |
479 double a; | 821 double a; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
571 CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0); | 913 CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0); |
572 | 914 |
573 CHECK_EQ(0, memcmp(&test.c, &outputsdmin[i], sizeof(test.c))); | 915 CHECK_EQ(0, memcmp(&test.c, &outputsdmin[i], sizeof(test.c))); |
574 CHECK_EQ(0, memcmp(&test.d, &outputsdmax[i], sizeof(test.d))); | 916 CHECK_EQ(0, memcmp(&test.d, &outputsdmax[i], sizeof(test.d))); |
575 CHECK_EQ(0, memcmp(&test.g, &outputsfmin[i], sizeof(test.g))); | 917 CHECK_EQ(0, memcmp(&test.g, &outputsfmin[i], sizeof(test.g))); |
576 CHECK_EQ(0, memcmp(&test.h, &outputsfmax[i], sizeof(test.h))); | 918 CHECK_EQ(0, memcmp(&test.h, &outputsfmax[i], sizeof(test.h))); |
577 } | 919 } |
578 } | 920 } |
579 | 921 |
580 #undef __ | 922 #undef __ |
OLD | NEW |