OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 3351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3362 t.fNegSubnorm = -FLT_MIN / 1.5; | 3362 t.fNegSubnorm = -FLT_MIN / 1.5; |
3363 t.fNegZero = -0.0; | 3363 t.fNegZero = -0.0; |
3364 t.fPosInf = 100000.0 / 0.0; | 3364 t.fPosInf = 100000.0 / 0.0; |
3365 t.fPosNorm = FLT_MAX; | 3365 t.fPosNorm = FLT_MAX; |
3366 t.fPosSubnorm = FLT_MIN / 20.0; | 3366 t.fPosSubnorm = FLT_MIN / 20.0; |
3367 t.fPosZero = +0.0; | 3367 t.fPosZero = +0.0; |
3368 | 3368 |
3369 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); | 3369 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); |
3370 USE(dummy); | 3370 USE(dummy); |
3371 // Expected double results. | 3371 // Expected double results. |
3372 CHECK_EQ(bit_cast<uint64_t>(t.dSignalingNan), 0x001); | 3372 CHECK_EQ(bit_cast<int64_t>(t.dSignalingNan), 0x001); |
3373 CHECK_EQ(bit_cast<uint64_t>(t.dQuietNan), 0x002); | 3373 CHECK_EQ(bit_cast<int64_t>(t.dQuietNan), 0x002); |
3374 CHECK_EQ(bit_cast<uint64_t>(t.dNegInf), 0x004); | 3374 CHECK_EQ(bit_cast<int64_t>(t.dNegInf), 0x004); |
3375 CHECK_EQ(bit_cast<uint64_t>(t.dNegNorm), 0x008); | 3375 CHECK_EQ(bit_cast<int64_t>(t.dNegNorm), 0x008); |
3376 CHECK_EQ(bit_cast<uint64_t>(t.dNegSubnorm), 0x010); | 3376 CHECK_EQ(bit_cast<int64_t>(t.dNegSubnorm), 0x010); |
3377 CHECK_EQ(bit_cast<uint64_t>(t.dNegZero), 0x020); | 3377 CHECK_EQ(bit_cast<int64_t>(t.dNegZero), 0x020); |
3378 CHECK_EQ(bit_cast<uint64_t>(t.dPosInf), 0x040); | 3378 CHECK_EQ(bit_cast<int64_t>(t.dPosInf), 0x040); |
3379 CHECK_EQ(bit_cast<uint64_t>(t.dPosNorm), 0x080); | 3379 CHECK_EQ(bit_cast<int64_t>(t.dPosNorm), 0x080); |
3380 CHECK_EQ(bit_cast<uint64_t>(t.dPosSubnorm), 0x100); | 3380 CHECK_EQ(bit_cast<int64_t>(t.dPosSubnorm), 0x100); |
3381 CHECK_EQ(bit_cast<uint64_t>(t.dPosZero), 0x200); | 3381 CHECK_EQ(bit_cast<int64_t>(t.dPosZero), 0x200); |
3382 | 3382 |
3383 // Expected float results. | 3383 // Expected float results. |
3384 CHECK_EQ(bit_cast<uint32_t>(t.fSignalingNan), 0x001); | 3384 CHECK_EQ(bit_cast<int32_t>(t.fSignalingNan), 0x001); |
3385 CHECK_EQ(bit_cast<uint32_t>(t.fQuietNan), 0x002); | 3385 CHECK_EQ(bit_cast<int32_t>(t.fQuietNan), 0x002); |
3386 CHECK_EQ(bit_cast<uint32_t>(t.fNegInf), 0x004); | 3386 CHECK_EQ(bit_cast<int32_t>(t.fNegInf), 0x004); |
3387 CHECK_EQ(bit_cast<uint32_t>(t.fNegNorm), 0x008); | 3387 CHECK_EQ(bit_cast<int32_t>(t.fNegNorm), 0x008); |
3388 CHECK_EQ(bit_cast<uint32_t>(t.fNegSubnorm), 0x010); | 3388 CHECK_EQ(bit_cast<int32_t>(t.fNegSubnorm), 0x010); |
3389 CHECK_EQ(bit_cast<uint32_t>(t.fNegZero), 0x020); | 3389 CHECK_EQ(bit_cast<int32_t>(t.fNegZero), 0x020); |
3390 CHECK_EQ(bit_cast<uint32_t>(t.fPosInf), 0x040); | 3390 CHECK_EQ(bit_cast<int32_t>(t.fPosInf), 0x040); |
3391 CHECK_EQ(bit_cast<uint32_t>(t.fPosNorm), 0x080); | 3391 CHECK_EQ(bit_cast<int32_t>(t.fPosNorm), 0x080); |
3392 CHECK_EQ(bit_cast<uint32_t>(t.fPosSubnorm), 0x100); | 3392 CHECK_EQ(bit_cast<int32_t>(t.fPosSubnorm), 0x100); |
3393 CHECK_EQ(bit_cast<uint32_t>(t.fPosZero), 0x200); | 3393 CHECK_EQ(bit_cast<int32_t>(t.fPosZero), 0x200); |
3394 } | 3394 } |
3395 } | 3395 } |
3396 | 3396 |
3397 | 3397 |
3398 TEST(ABS) { | 3398 TEST(ABS) { |
3399 CcTest::InitializeVM(); | 3399 CcTest::InitializeVM(); |
3400 Isolate* isolate = CcTest::i_isolate(); | 3400 Isolate* isolate = CcTest::i_isolate(); |
3401 HandleScope scope(isolate); | 3401 HandleScope scope(isolate); |
3402 MacroAssembler assm(isolate, NULL, 0); | 3402 MacroAssembler assm(isolate, NULL, 0); |
3403 | 3403 |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3679 CodeDesc desc; | 3679 CodeDesc desc; |
3680 assm.GetCode(&desc); | 3680 assm.GetCode(&desc); |
3681 Handle<Code> code = isolate->factory()->NewCode( | 3681 Handle<Code> code = isolate->factory()->NewCode( |
3682 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 3682 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
3683 F3 f = FUNCTION_CAST<F3>(code->entry()); | 3683 F3 f = FUNCTION_CAST<F3>(code->entry()); |
3684 test.dOp1 = 2.0; | 3684 test.dOp1 = 2.0; |
3685 test.dOp2 = 3.0; | 3685 test.dOp2 = 3.0; |
3686 test.fOp1 = 2.0; | 3686 test.fOp1 = 2.0; |
3687 test.fOp2 = 3.0; | 3687 test.fOp2 = 3.0; |
3688 (CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0)); | 3688 (CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0)); |
3689 CHECK_EQ(test.dF, 0); | 3689 CHECK_EQ(test.dF, 0U); |
3690 CHECK_EQ(test.dUn, 0); | 3690 CHECK_EQ(test.dUn, 0U); |
3691 CHECK_EQ(test.dEq, 0); | 3691 CHECK_EQ(test.dEq, 0U); |
3692 CHECK_EQ(test.dUeq, 0); | 3692 CHECK_EQ(test.dUeq, 0U); |
3693 CHECK_EQ(test.dOlt, 1); | 3693 CHECK_EQ(test.dOlt, 1U); |
3694 CHECK_EQ(test.dUlt, 1); | 3694 CHECK_EQ(test.dUlt, 1U); |
3695 CHECK_EQ(test.dOle, 1); | 3695 CHECK_EQ(test.dOle, 1U); |
3696 CHECK_EQ(test.dUle, 1); | 3696 CHECK_EQ(test.dUle, 1U); |
3697 CHECK_EQ(test.fF, 0); | 3697 CHECK_EQ(test.fF, 0U); |
3698 CHECK_EQ(test.fUn, 0); | 3698 CHECK_EQ(test.fUn, 0U); |
3699 CHECK_EQ(test.fEq, 0); | 3699 CHECK_EQ(test.fEq, 0U); |
3700 CHECK_EQ(test.fUeq, 0); | 3700 CHECK_EQ(test.fUeq, 0U); |
3701 CHECK_EQ(test.fOlt, 1); | 3701 CHECK_EQ(test.fOlt, 1U); |
3702 CHECK_EQ(test.fUlt, 1); | 3702 CHECK_EQ(test.fUlt, 1U); |
3703 CHECK_EQ(test.fOle, 1); | 3703 CHECK_EQ(test.fOle, 1U); |
3704 CHECK_EQ(test.fUle, 1); | 3704 CHECK_EQ(test.fUle, 1U); |
3705 | 3705 |
3706 test.dOp1 = std::numeric_limits<double>::max(); | 3706 test.dOp1 = std::numeric_limits<double>::max(); |
3707 test.dOp2 = std::numeric_limits<double>::min(); | 3707 test.dOp2 = std::numeric_limits<double>::min(); |
3708 test.fOp1 = std::numeric_limits<float>::min(); | 3708 test.fOp1 = std::numeric_limits<float>::min(); |
3709 test.fOp2 = std::numeric_limits<float>::lowest(); | 3709 test.fOp2 = std::numeric_limits<float>::lowest(); |
3710 (CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0)); | 3710 (CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0)); |
3711 CHECK_EQ(test.dF, 0); | 3711 CHECK_EQ(test.dF, 0U); |
3712 CHECK_EQ(test.dUn, 0); | 3712 CHECK_EQ(test.dUn, 0U); |
3713 CHECK_EQ(test.dEq, 0); | 3713 CHECK_EQ(test.dEq, 0U); |
3714 CHECK_EQ(test.dUeq, 0); | 3714 CHECK_EQ(test.dUeq, 0U); |
3715 CHECK_EQ(test.dOlt, 0); | 3715 CHECK_EQ(test.dOlt, 0U); |
3716 CHECK_EQ(test.dUlt, 0); | 3716 CHECK_EQ(test.dUlt, 0U); |
3717 CHECK_EQ(test.dOle, 0); | 3717 CHECK_EQ(test.dOle, 0U); |
3718 CHECK_EQ(test.dUle, 0); | 3718 CHECK_EQ(test.dUle, 0U); |
3719 CHECK_EQ(test.fF, 0); | 3719 CHECK_EQ(test.fF, 0U); |
3720 CHECK_EQ(test.fUn, 0); | 3720 CHECK_EQ(test.fUn, 0U); |
3721 CHECK_EQ(test.fEq, 0); | 3721 CHECK_EQ(test.fEq, 0U); |
3722 CHECK_EQ(test.fUeq, 0); | 3722 CHECK_EQ(test.fUeq, 0U); |
3723 CHECK_EQ(test.fOlt, 0); | 3723 CHECK_EQ(test.fOlt, 0U); |
3724 CHECK_EQ(test.fUlt, 0); | 3724 CHECK_EQ(test.fUlt, 0U); |
3725 CHECK_EQ(test.fOle, 0); | 3725 CHECK_EQ(test.fOle, 0U); |
3726 CHECK_EQ(test.fUle, 0); | 3726 CHECK_EQ(test.fUle, 0U); |
3727 | 3727 |
3728 test.dOp1 = std::numeric_limits<double>::lowest(); | 3728 test.dOp1 = std::numeric_limits<double>::lowest(); |
3729 test.dOp2 = std::numeric_limits<double>::lowest(); | 3729 test.dOp2 = std::numeric_limits<double>::lowest(); |
3730 test.fOp1 = std::numeric_limits<float>::max(); | 3730 test.fOp1 = std::numeric_limits<float>::max(); |
3731 test.fOp2 = std::numeric_limits<float>::max(); | 3731 test.fOp2 = std::numeric_limits<float>::max(); |
3732 (CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0)); | 3732 (CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0)); |
3733 CHECK_EQ(test.dF, 0); | 3733 CHECK_EQ(test.dF, 0U); |
3734 CHECK_EQ(test.dUn, 0); | 3734 CHECK_EQ(test.dUn, 0U); |
3735 CHECK_EQ(test.dEq, 1); | 3735 CHECK_EQ(test.dEq, 1U); |
3736 CHECK_EQ(test.dUeq, 1); | 3736 CHECK_EQ(test.dUeq, 1U); |
3737 CHECK_EQ(test.dOlt, 0); | 3737 CHECK_EQ(test.dOlt, 0U); |
3738 CHECK_EQ(test.dUlt, 0); | 3738 CHECK_EQ(test.dUlt, 0U); |
3739 CHECK_EQ(test.dOle, 1); | 3739 CHECK_EQ(test.dOle, 1U); |
3740 CHECK_EQ(test.dUle, 1); | 3740 CHECK_EQ(test.dUle, 1U); |
3741 CHECK_EQ(test.fF, 0); | 3741 CHECK_EQ(test.fF, 0U); |
3742 CHECK_EQ(test.fUn, 0); | 3742 CHECK_EQ(test.fUn, 0U); |
3743 CHECK_EQ(test.fEq, 1); | 3743 CHECK_EQ(test.fEq, 1U); |
3744 CHECK_EQ(test.fUeq, 1); | 3744 CHECK_EQ(test.fUeq, 1U); |
3745 CHECK_EQ(test.fOlt, 0); | 3745 CHECK_EQ(test.fOlt, 0U); |
3746 CHECK_EQ(test.fUlt, 0); | 3746 CHECK_EQ(test.fUlt, 0U); |
3747 CHECK_EQ(test.fOle, 1); | 3747 CHECK_EQ(test.fOle, 1U); |
3748 CHECK_EQ(test.fUle, 1); | 3748 CHECK_EQ(test.fUle, 1U); |
3749 | 3749 |
3750 test.dOp1 = std::numeric_limits<double>::quiet_NaN(); | 3750 test.dOp1 = std::numeric_limits<double>::quiet_NaN(); |
3751 test.dOp2 = 0.0; | 3751 test.dOp2 = 0.0; |
3752 test.fOp1 = std::numeric_limits<float>::quiet_NaN(); | 3752 test.fOp1 = std::numeric_limits<float>::quiet_NaN(); |
3753 test.fOp2 = 0.0; | 3753 test.fOp2 = 0.0; |
3754 (CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0)); | 3754 (CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0)); |
3755 CHECK_EQ(test.dF, 0); | 3755 CHECK_EQ(test.dF, 0U); |
3756 CHECK_EQ(test.dUn, 1); | 3756 CHECK_EQ(test.dUn, 1U); |
3757 CHECK_EQ(test.dEq, 0); | 3757 CHECK_EQ(test.dEq, 0U); |
3758 CHECK_EQ(test.dUeq, 1); | 3758 CHECK_EQ(test.dUeq, 1U); |
3759 CHECK_EQ(test.dOlt, 0); | 3759 CHECK_EQ(test.dOlt, 0U); |
3760 CHECK_EQ(test.dUlt, 1); | 3760 CHECK_EQ(test.dUlt, 1U); |
3761 CHECK_EQ(test.dOle, 0); | 3761 CHECK_EQ(test.dOle, 0U); |
3762 CHECK_EQ(test.dUle, 1); | 3762 CHECK_EQ(test.dUle, 1U); |
3763 CHECK_EQ(test.fF, 0); | 3763 CHECK_EQ(test.fF, 0U); |
3764 CHECK_EQ(test.fUn, 1); | 3764 CHECK_EQ(test.fUn, 1U); |
3765 CHECK_EQ(test.fEq, 0); | 3765 CHECK_EQ(test.fEq, 0U); |
3766 CHECK_EQ(test.fUeq, 1); | 3766 CHECK_EQ(test.fUeq, 1U); |
3767 CHECK_EQ(test.fOlt, 0); | 3767 CHECK_EQ(test.fOlt, 0U); |
3768 CHECK_EQ(test.fUlt, 1); | 3768 CHECK_EQ(test.fUlt, 1U); |
3769 CHECK_EQ(test.fOle, 0); | 3769 CHECK_EQ(test.fOle, 0U); |
3770 CHECK_EQ(test.fUle, 1); | 3770 CHECK_EQ(test.fUle, 1U); |
3771 } | 3771 } |
3772 } | 3772 } |
3773 | 3773 |
3774 | 3774 |
3775 TEST(CMP_COND_FMT) { | 3775 TEST(CMP_COND_FMT) { |
3776 if (IsMipsArchVariant(kMips32r6)) { | 3776 if (IsMipsArchVariant(kMips32r6)) { |
3777 CcTest::InitializeVM(); | 3777 CcTest::InitializeVM(); |
3778 Isolate* isolate = CcTest::i_isolate(); | 3778 Isolate* isolate = CcTest::i_isolate(); |
3779 HandleScope scope(isolate); | 3779 HandleScope scope(isolate); |
3780 MacroAssembler assm(isolate, NULL, 0); | 3780 MacroAssembler assm(isolate, NULL, 0); |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4337 test.fOp1 = std::numeric_limits<float>::quiet_NaN(); | 4337 test.fOp1 = std::numeric_limits<float>::quiet_NaN(); |
4338 test.fOp2 = -5.0; | 4338 test.fOp2 = -5.0; |
4339 | 4339 |
4340 (CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0)); | 4340 (CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0)); |
4341 CHECK_EQ(true, std::isnan(test.dRes)); | 4341 CHECK_EQ(true, std::isnan(test.dRes)); |
4342 CHECK_EQ(true, std::isnan(test.fRes)); | 4342 CHECK_EQ(true, std::isnan(test.fRes)); |
4343 } | 4343 } |
4344 | 4344 |
4345 | 4345 |
4346 #undef __ | 4346 #undef __ |
OLD | NEW |