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 3493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3504 t.fNegSubnorm = -FLT_MIN / 1.5; | 3504 t.fNegSubnorm = -FLT_MIN / 1.5; |
3505 t.fNegZero = -0.0; | 3505 t.fNegZero = -0.0; |
3506 t.fPosInf = 100000.0 / 0.0; | 3506 t.fPosInf = 100000.0 / 0.0; |
3507 t.fPosNorm = FLT_MAX; | 3507 t.fPosNorm = FLT_MAX; |
3508 t.fPosSubnorm = FLT_MIN / 20.0; | 3508 t.fPosSubnorm = FLT_MIN / 20.0; |
3509 t.fPosZero = +0.0; | 3509 t.fPosZero = +0.0; |
3510 | 3510 |
3511 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); | 3511 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); |
3512 USE(dummy); | 3512 USE(dummy); |
3513 // Expected double results. | 3513 // Expected double results. |
3514 CHECK_EQ(bit_cast<uint64_t>(t.dNegInf), 0x004); | 3514 CHECK_EQ(bit_cast<int64_t>(t.dNegInf), 0x004); |
3515 CHECK_EQ(bit_cast<uint64_t>(t.dNegNorm), 0x008); | 3515 CHECK_EQ(bit_cast<int64_t>(t.dNegNorm), 0x008); |
3516 CHECK_EQ(bit_cast<uint64_t>(t.dNegSubnorm), 0x010); | 3516 CHECK_EQ(bit_cast<int64_t>(t.dNegSubnorm), 0x010); |
3517 CHECK_EQ(bit_cast<uint64_t>(t.dNegZero), 0x020); | 3517 CHECK_EQ(bit_cast<int64_t>(t.dNegZero), 0x020); |
3518 CHECK_EQ(bit_cast<uint64_t>(t.dPosInf), 0x040); | 3518 CHECK_EQ(bit_cast<int64_t>(t.dPosInf), 0x040); |
3519 CHECK_EQ(bit_cast<uint64_t>(t.dPosNorm), 0x080); | 3519 CHECK_EQ(bit_cast<int64_t>(t.dPosNorm), 0x080); |
3520 CHECK_EQ(bit_cast<uint64_t>(t.dPosSubnorm), 0x100); | 3520 CHECK_EQ(bit_cast<int64_t>(t.dPosSubnorm), 0x100); |
3521 CHECK_EQ(bit_cast<uint64_t>(t.dPosZero), 0x200); | 3521 CHECK_EQ(bit_cast<int64_t>(t.dPosZero), 0x200); |
3522 | 3522 |
3523 // Expected float results. | 3523 // Expected float results. |
3524 CHECK_EQ(bit_cast<uint32_t>(t.fNegInf), 0x004); | 3524 CHECK_EQ(bit_cast<int32_t>(t.fNegInf), 0x004); |
3525 CHECK_EQ(bit_cast<uint32_t>(t.fNegNorm), 0x008); | 3525 CHECK_EQ(bit_cast<int32_t>(t.fNegNorm), 0x008); |
3526 CHECK_EQ(bit_cast<uint32_t>(t.fNegSubnorm), 0x010); | 3526 CHECK_EQ(bit_cast<int32_t>(t.fNegSubnorm), 0x010); |
3527 CHECK_EQ(bit_cast<uint32_t>(t.fNegZero), 0x020); | 3527 CHECK_EQ(bit_cast<int32_t>(t.fNegZero), 0x020); |
3528 CHECK_EQ(bit_cast<uint32_t>(t.fPosInf), 0x040); | 3528 CHECK_EQ(bit_cast<int32_t>(t.fPosInf), 0x040); |
3529 CHECK_EQ(bit_cast<uint32_t>(t.fPosNorm), 0x080); | 3529 CHECK_EQ(bit_cast<int32_t>(t.fPosNorm), 0x080); |
3530 CHECK_EQ(bit_cast<uint32_t>(t.fPosSubnorm), 0x100); | 3530 CHECK_EQ(bit_cast<int32_t>(t.fPosSubnorm), 0x100); |
3531 CHECK_EQ(bit_cast<uint32_t>(t.fPosZero), 0x200); | 3531 CHECK_EQ(bit_cast<int32_t>(t.fPosZero), 0x200); |
3532 } | 3532 } |
3533 } | 3533 } |
3534 | 3534 |
3535 | 3535 |
3536 TEST(ABS) { | 3536 TEST(ABS) { |
3537 CcTest::InitializeVM(); | 3537 CcTest::InitializeVM(); |
3538 Isolate* isolate = CcTest::i_isolate(); | 3538 Isolate* isolate = CcTest::i_isolate(); |
3539 HandleScope scope(isolate); | 3539 HandleScope scope(isolate); |
3540 MacroAssembler assm(isolate, NULL, 0); | 3540 MacroAssembler assm(isolate, NULL, 0); |
3541 | 3541 |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3818 CodeDesc desc; | 3818 CodeDesc desc; |
3819 assm.GetCode(&desc); | 3819 assm.GetCode(&desc); |
3820 Handle<Code> code = isolate->factory()->NewCode( | 3820 Handle<Code> code = isolate->factory()->NewCode( |
3821 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 3821 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
3822 F3 f = FUNCTION_CAST<F3>(code->entry()); | 3822 F3 f = FUNCTION_CAST<F3>(code->entry()); |
3823 test.dOp1 = 2.0; | 3823 test.dOp1 = 2.0; |
3824 test.dOp2 = 3.0; | 3824 test.dOp2 = 3.0; |
3825 test.fOp1 = 2.0; | 3825 test.fOp1 = 2.0; |
3826 test.fOp2 = 3.0; | 3826 test.fOp2 = 3.0; |
3827 (CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0)); | 3827 (CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0)); |
3828 CHECK_EQ(test.dF, 0); | 3828 CHECK_EQ(test.dF, 0U); |
3829 CHECK_EQ(test.dUn, 0); | 3829 CHECK_EQ(test.dUn, 0U); |
3830 CHECK_EQ(test.dEq, 0); | 3830 CHECK_EQ(test.dEq, 0U); |
3831 CHECK_EQ(test.dUeq, 0); | 3831 CHECK_EQ(test.dUeq, 0U); |
3832 CHECK_EQ(test.dOlt, 1); | 3832 CHECK_EQ(test.dOlt, 1U); |
3833 CHECK_EQ(test.dUlt, 1); | 3833 CHECK_EQ(test.dUlt, 1U); |
3834 CHECK_EQ(test.dOle, 1); | 3834 CHECK_EQ(test.dOle, 1U); |
3835 CHECK_EQ(test.dUle, 1); | 3835 CHECK_EQ(test.dUle, 1U); |
3836 CHECK_EQ(test.fF, 0); | 3836 CHECK_EQ(test.fF, 0U); |
3837 CHECK_EQ(test.fUn, 0); | 3837 CHECK_EQ(test.fUn, 0U); |
3838 CHECK_EQ(test.fEq, 0); | 3838 CHECK_EQ(test.fEq, 0U); |
3839 CHECK_EQ(test.fUeq, 0); | 3839 CHECK_EQ(test.fUeq, 0U); |
3840 CHECK_EQ(test.fOlt, 1); | 3840 CHECK_EQ(test.fOlt, 1U); |
3841 CHECK_EQ(test.fUlt, 1); | 3841 CHECK_EQ(test.fUlt, 1U); |
3842 CHECK_EQ(test.fOle, 1); | 3842 CHECK_EQ(test.fOle, 1U); |
3843 CHECK_EQ(test.fUle, 1); | 3843 CHECK_EQ(test.fUle, 1U); |
3844 | 3844 |
3845 test.dOp1 = std::numeric_limits<double>::max(); | 3845 test.dOp1 = std::numeric_limits<double>::max(); |
3846 test.dOp2 = std::numeric_limits<double>::min(); | 3846 test.dOp2 = std::numeric_limits<double>::min(); |
3847 test.fOp1 = std::numeric_limits<float>::min(); | 3847 test.fOp1 = std::numeric_limits<float>::min(); |
3848 test.fOp2 = std::numeric_limits<float>::lowest(); | 3848 test.fOp2 = std::numeric_limits<float>::lowest(); |
3849 (CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0)); | 3849 (CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0)); |
3850 CHECK_EQ(test.dF, 0); | 3850 CHECK_EQ(test.dF, 0U); |
3851 CHECK_EQ(test.dUn, 0); | 3851 CHECK_EQ(test.dUn, 0U); |
3852 CHECK_EQ(test.dEq, 0); | 3852 CHECK_EQ(test.dEq, 0U); |
3853 CHECK_EQ(test.dUeq, 0); | 3853 CHECK_EQ(test.dUeq, 0U); |
3854 CHECK_EQ(test.dOlt, 0); | 3854 CHECK_EQ(test.dOlt, 0U); |
3855 CHECK_EQ(test.dUlt, 0); | 3855 CHECK_EQ(test.dUlt, 0U); |
3856 CHECK_EQ(test.dOle, 0); | 3856 CHECK_EQ(test.dOle, 0U); |
3857 CHECK_EQ(test.dUle, 0); | 3857 CHECK_EQ(test.dUle, 0U); |
3858 CHECK_EQ(test.fF, 0); | 3858 CHECK_EQ(test.fF, 0U); |
3859 CHECK_EQ(test.fUn, 0); | 3859 CHECK_EQ(test.fUn, 0U); |
3860 CHECK_EQ(test.fEq, 0); | 3860 CHECK_EQ(test.fEq, 0U); |
3861 CHECK_EQ(test.fUeq, 0); | 3861 CHECK_EQ(test.fUeq, 0U); |
3862 CHECK_EQ(test.fOlt, 0); | 3862 CHECK_EQ(test.fOlt, 0U); |
3863 CHECK_EQ(test.fUlt, 0); | 3863 CHECK_EQ(test.fUlt, 0U); |
3864 CHECK_EQ(test.fOle, 0); | 3864 CHECK_EQ(test.fOle, 0U); |
3865 CHECK_EQ(test.fUle, 0); | 3865 CHECK_EQ(test.fUle, 0U); |
3866 | 3866 |
3867 test.dOp1 = std::numeric_limits<double>::lowest(); | 3867 test.dOp1 = std::numeric_limits<double>::lowest(); |
3868 test.dOp2 = std::numeric_limits<double>::lowest(); | 3868 test.dOp2 = std::numeric_limits<double>::lowest(); |
3869 test.fOp1 = std::numeric_limits<float>::max(); | 3869 test.fOp1 = std::numeric_limits<float>::max(); |
3870 test.fOp2 = std::numeric_limits<float>::max(); | 3870 test.fOp2 = std::numeric_limits<float>::max(); |
3871 (CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0)); | 3871 (CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0)); |
3872 CHECK_EQ(test.dF, 0); | 3872 CHECK_EQ(test.dF, 0U); |
3873 CHECK_EQ(test.dUn, 0); | 3873 CHECK_EQ(test.dUn, 0U); |
3874 CHECK_EQ(test.dEq, 1); | 3874 CHECK_EQ(test.dEq, 1U); |
3875 CHECK_EQ(test.dUeq, 1); | 3875 CHECK_EQ(test.dUeq, 1U); |
3876 CHECK_EQ(test.dOlt, 0); | 3876 CHECK_EQ(test.dOlt, 0U); |
3877 CHECK_EQ(test.dUlt, 0); | 3877 CHECK_EQ(test.dUlt, 0U); |
3878 CHECK_EQ(test.dOle, 1); | 3878 CHECK_EQ(test.dOle, 1U); |
3879 CHECK_EQ(test.dUle, 1); | 3879 CHECK_EQ(test.dUle, 1U); |
3880 CHECK_EQ(test.fF, 0); | 3880 CHECK_EQ(test.fF, 0U); |
3881 CHECK_EQ(test.fUn, 0); | 3881 CHECK_EQ(test.fUn, 0U); |
3882 CHECK_EQ(test.fEq, 1); | 3882 CHECK_EQ(test.fEq, 1U); |
3883 CHECK_EQ(test.fUeq, 1); | 3883 CHECK_EQ(test.fUeq, 1U); |
3884 CHECK_EQ(test.fOlt, 0); | 3884 CHECK_EQ(test.fOlt, 0U); |
3885 CHECK_EQ(test.fUlt, 0); | 3885 CHECK_EQ(test.fUlt, 0U); |
3886 CHECK_EQ(test.fOle, 1); | 3886 CHECK_EQ(test.fOle, 1U); |
3887 CHECK_EQ(test.fUle, 1); | 3887 CHECK_EQ(test.fUle, 1U); |
3888 | 3888 |
3889 test.dOp1 = std::numeric_limits<double>::quiet_NaN(); | 3889 test.dOp1 = std::numeric_limits<double>::quiet_NaN(); |
3890 test.dOp2 = 0.0; | 3890 test.dOp2 = 0.0; |
3891 test.fOp1 = std::numeric_limits<float>::quiet_NaN(); | 3891 test.fOp1 = std::numeric_limits<float>::quiet_NaN(); |
3892 test.fOp2 = 0.0; | 3892 test.fOp2 = 0.0; |
3893 (CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0)); | 3893 (CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0)); |
3894 CHECK_EQ(test.dF, 0); | 3894 CHECK_EQ(test.dF, 0U); |
3895 CHECK_EQ(test.dUn, 1); | 3895 CHECK_EQ(test.dUn, 1U); |
3896 CHECK_EQ(test.dEq, 0); | 3896 CHECK_EQ(test.dEq, 0U); |
3897 CHECK_EQ(test.dUeq, 1); | 3897 CHECK_EQ(test.dUeq, 1U); |
3898 CHECK_EQ(test.dOlt, 0); | 3898 CHECK_EQ(test.dOlt, 0U); |
3899 CHECK_EQ(test.dUlt, 1); | 3899 CHECK_EQ(test.dUlt, 1U); |
3900 CHECK_EQ(test.dOle, 0); | 3900 CHECK_EQ(test.dOle, 0U); |
3901 CHECK_EQ(test.dUle, 1); | 3901 CHECK_EQ(test.dUle, 1U); |
3902 CHECK_EQ(test.fF, 0); | 3902 CHECK_EQ(test.fF, 0U); |
3903 CHECK_EQ(test.fUn, 1); | 3903 CHECK_EQ(test.fUn, 1U); |
3904 CHECK_EQ(test.fEq, 0); | 3904 CHECK_EQ(test.fEq, 0U); |
3905 CHECK_EQ(test.fUeq, 1); | 3905 CHECK_EQ(test.fUeq, 1U); |
3906 CHECK_EQ(test.fOlt, 0); | 3906 CHECK_EQ(test.fOlt, 0U); |
3907 CHECK_EQ(test.fUlt, 1); | 3907 CHECK_EQ(test.fUlt, 1U); |
3908 CHECK_EQ(test.fOle, 0); | 3908 CHECK_EQ(test.fOle, 0U); |
3909 CHECK_EQ(test.fUle, 1); | 3909 CHECK_EQ(test.fUle, 1U); |
3910 } | 3910 } |
3911 } | 3911 } |
3912 | 3912 |
3913 | 3913 |
3914 TEST(CMP_COND_FMT) { | 3914 TEST(CMP_COND_FMT) { |
3915 if (kArchVariant == kMips64r6) { | 3915 if (kArchVariant == kMips64r6) { |
3916 CcTest::InitializeVM(); | 3916 CcTest::InitializeVM(); |
3917 Isolate* isolate = CcTest::i_isolate(); | 3917 Isolate* isolate = CcTest::i_isolate(); |
3918 HandleScope scope(isolate); | 3918 HandleScope scope(isolate); |
3919 MacroAssembler assm(isolate, NULL, 0); | 3919 MacroAssembler assm(isolate, NULL, 0); |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4440 test.fOp1 = std::numeric_limits<float>::quiet_NaN(); | 4440 test.fOp1 = std::numeric_limits<float>::quiet_NaN(); |
4441 test.fOp2 = -5.0; | 4441 test.fOp2 = -5.0; |
4442 | 4442 |
4443 (CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0)); | 4443 (CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0)); |
4444 CHECK_EQ(true, std::isnan(test.dRes)); | 4444 CHECK_EQ(true, std::isnan(test.dRes)); |
4445 CHECK_EQ(true, std::isnan(test.fRes)); | 4445 CHECK_EQ(true, std::isnan(test.fRes)); |
4446 } | 4446 } |
4447 | 4447 |
4448 | 4448 |
4449 #undef __ | 4449 #undef __ |
OLD | NEW |