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 1571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1582 __ jr(ra); | 1582 __ jr(ra); |
1583 __ nop(); | 1583 __ nop(); |
1584 CodeDesc desc; | 1584 CodeDesc desc; |
1585 assm.GetCode(&desc); | 1585 assm.GetCode(&desc); |
1586 Handle<Code> code = isolate->factory()->NewCode( | 1586 Handle<Code> code = isolate->factory()->NewCode( |
1587 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 1587 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
1588 F3 f = FUNCTION_CAST<F3>(code->entry()); | 1588 F3 f = FUNCTION_CAST<F3>(code->entry()); |
1589 | 1589 |
1590 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); | 1590 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); |
1591 | 1591 |
1592 CHECK_EQ(test.a, 1); | 1592 CHECK_EQ(1, test.a); |
1593 CHECK_EQ(test.b, 0); | 1593 CHECK_EQ(0, test.b); |
1594 CHECK_EQ(test.c, 0); | 1594 CHECK_EQ(0, test.c); |
1595 CHECK_EQ(test.d, 1); | 1595 CHECK_EQ(1, test.d); |
1596 | 1596 |
1597 const int test_size = 3; | 1597 const int test_size = 3; |
1598 const int input_size = 5; | 1598 const int input_size = 5; |
1599 | 1599 |
1600 double inputs_D[input_size] = {0.0, 65.2, -70.32, | 1600 double inputs_D[input_size] = {0.0, 65.2, -70.32, |
1601 18446744073709551621.0, -18446744073709551621.0}; | 1601 18446744073709551621.0, -18446744073709551621.0}; |
1602 double outputs_D[input_size] = {0.0, 65.2, -70.32, | 1602 double outputs_D[input_size] = {0.0, 65.2, -70.32, |
1603 18446744073709551621.0, -18446744073709551621.0}; | 1603 18446744073709551621.0, -18446744073709551621.0}; |
1604 double tests_D[test_size*2] = {2.8, 2.9, -2.8, -2.9, | 1604 double tests_D[test_size*2] = {2.8, 2.9, -2.8, -2.9, |
1605 18446744073709551616.0, 18446744073709555712.0}; | 1605 18446744073709551616.0, 18446744073709555712.0}; |
1606 float inputs_S[input_size] = {0.0, 65.2, -70.32, | 1606 float inputs_S[input_size] = {0.0, 65.2, -70.32, |
1607 18446744073709551621.0, -18446744073709551621.0}; | 1607 18446744073709551621.0, -18446744073709551621.0}; |
1608 float outputs_S[input_size] = {0.0, 65.2, -70.32, | 1608 float outputs_S[input_size] = {0.0, 65.2, -70.32, |
1609 18446744073709551621.0, -18446744073709551621.0}; | 1609 18446744073709551621.0, -18446744073709551621.0}; |
1610 float tests_S[test_size*2] = {2.9, 2.8, -2.9, -2.8, | 1610 float tests_S[test_size*2] = {2.9, 2.8, -2.9, -2.8, |
1611 18446744073709551616.0, 18446746272732807168.0}; | 1611 18446744073709551616.0, 18446746272732807168.0}; |
1612 for (int j=0; j < test_size; j+=2) { | 1612 for (int j=0; j < test_size; j+=2) { |
1613 for (int i=0; i < input_size; i++) { | 1613 for (int i=0; i < input_size; i++) { |
1614 test.e = inputs_D[i]; | 1614 test.e = inputs_D[i]; |
1615 test.f = tests_D[j]; | 1615 test.f = tests_D[j]; |
1616 test.i = inputs_S[i]; | 1616 test.i = inputs_S[i]; |
1617 test.j = tests_S[j]; | 1617 test.j = tests_S[j]; |
1618 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); | 1618 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); |
1619 CHECK_EQ(test.g, outputs_D[i]); | 1619 CHECK_EQ(outputs_D[i], test.g); |
1620 CHECK_EQ(test.h, 0); | 1620 CHECK_EQ(0, test.h); |
1621 CHECK_EQ(test.k, outputs_S[i]); | 1621 CHECK_EQ(outputs_S[i], test.k); |
1622 CHECK_EQ(test.l, 0); | 1622 CHECK_EQ(0, test.l); |
1623 | 1623 |
1624 test.f = tests_D[j+1]; | 1624 test.f = tests_D[j+1]; |
1625 test.j = tests_S[j+1]; | 1625 test.j = tests_S[j+1]; |
1626 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); | 1626 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); |
1627 CHECK_EQ(test.g, 0); | 1627 CHECK_EQ(0, test.g); |
1628 CHECK_EQ(test.h, outputs_D[i]); | 1628 CHECK_EQ(outputs_D[i], test.h); |
1629 CHECK_EQ(test.k, 0); | 1629 CHECK_EQ(0, test.k); |
1630 CHECK_EQ(test.l, outputs_S[i]); | 1630 CHECK_EQ(outputs_S[i], test.l); |
1631 } | 1631 } |
1632 } | 1632 } |
1633 } | 1633 } |
1634 } | 1634 } |
1635 | 1635 |
1636 | 1636 |
1637 | 1637 |
1638 TEST(min_max) { | 1638 TEST(min_max) { |
1639 if (kArchVariant == kMips64r6) { | 1639 if (kArchVariant == kMips64r6) { |
1640 CcTest::InitializeVM(); | 1640 CcTest::InitializeVM(); |
(...skipping 1667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3308 __ b(&done); | 3308 __ b(&done); |
3309 __ nop(); | 3309 __ nop(); |
3310 } | 3310 } |
3311 | 3311 |
3312 __ bind(&done); | 3312 __ bind(&done); |
3313 __ ld(ra, MemOperand(sp)); | 3313 __ ld(ra, MemOperand(sp)); |
3314 __ daddiu(sp, sp, 8); | 3314 __ daddiu(sp, sp, 8); |
3315 __ jr(ra); | 3315 __ jr(ra); |
3316 __ nop(); | 3316 __ nop(); |
3317 | 3317 |
3318 CHECK_EQ(assm.UnboundLabelsCount(), 0); | 3318 CHECK_EQ(0, assm.UnboundLabelsCount()); |
3319 | 3319 |
3320 CodeDesc desc; | 3320 CodeDesc desc; |
3321 assm.GetCode(&desc); | 3321 assm.GetCode(&desc); |
3322 Handle<Code> code = isolate->factory()->NewCode( | 3322 Handle<Code> code = isolate->factory()->NewCode( |
3323 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 3323 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
3324 #ifdef OBJECT_PRINT | 3324 #ifdef OBJECT_PRINT |
3325 code->Print(std::cout); | 3325 code->Print(std::cout); |
3326 #endif | 3326 #endif |
3327 F1 f = FUNCTION_CAST<F1>(code->entry()); | 3327 F1 f = FUNCTION_CAST<F1>(code->entry()); |
3328 for (int i = 0; i < kNumCases; ++i) { | 3328 for (int i = 0; i < kNumCases; ++i) { |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3822 / std::numeric_limits<float>::min(); | 3822 / std::numeric_limits<float>::min(); |
3823 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); | 3823 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); |
3824 CHECK_EQ(test.a, std::numeric_limits<double>::max() | 3824 CHECK_EQ(test.a, std::numeric_limits<double>::max() |
3825 / std::numeric_limits<double>::min()); | 3825 / std::numeric_limits<double>::min()); |
3826 CHECK_EQ(test.b, std::numeric_limits<float>::max() | 3826 CHECK_EQ(test.b, std::numeric_limits<float>::max() |
3827 / std::numeric_limits<float>::min()); | 3827 / std::numeric_limits<float>::min()); |
3828 | 3828 |
3829 test.a = std::numeric_limits<double>::quiet_NaN(); | 3829 test.a = std::numeric_limits<double>::quiet_NaN(); |
3830 test.b = std::numeric_limits<float>::quiet_NaN(); | 3830 test.b = std::numeric_limits<float>::quiet_NaN(); |
3831 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); | 3831 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); |
3832 CHECK_EQ(std::isnan(test.a), true); | 3832 CHECK(std::isnan(test.a)); |
3833 CHECK_EQ(std::isnan(test.b), true); | 3833 CHECK(std::isnan(test.b)); |
3834 | 3834 |
3835 test.a = std::numeric_limits<double>::signaling_NaN(); | 3835 test.a = std::numeric_limits<double>::signaling_NaN(); |
3836 test.b = std::numeric_limits<float>::signaling_NaN(); | 3836 test.b = std::numeric_limits<float>::signaling_NaN(); |
3837 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); | 3837 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); |
3838 CHECK_EQ(std::isnan(test.a), true); | 3838 CHECK(std::isnan(test.a)); |
3839 CHECK_EQ(std::isnan(test.b), true); | 3839 CHECK(std::isnan(test.b)); |
3840 } | 3840 } |
3841 | 3841 |
3842 | 3842 |
3843 TEST(ADD_FMT) { | 3843 TEST(ADD_FMT) { |
3844 CcTest::InitializeVM(); | 3844 CcTest::InitializeVM(); |
3845 Isolate* isolate = CcTest::i_isolate(); | 3845 Isolate* isolate = CcTest::i_isolate(); |
3846 HandleScope scope(isolate); | 3846 HandleScope scope(isolate); |
3847 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes); | 3847 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes); |
3848 | 3848 |
3849 typedef struct test_float { | 3849 typedef struct test_float { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3889 test.fb = -std::numeric_limits<float>::max(); // lowest() | 3889 test.fb = -std::numeric_limits<float>::max(); // lowest() |
3890 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); | 3890 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); |
3891 CHECK_EQ(test.c, 0.0); | 3891 CHECK_EQ(test.c, 0.0); |
3892 CHECK_EQ(test.fc, 0.0); | 3892 CHECK_EQ(test.fc, 0.0); |
3893 | 3893 |
3894 test.a = std::numeric_limits<double>::max(); | 3894 test.a = std::numeric_limits<double>::max(); |
3895 test.b = std::numeric_limits<double>::max(); | 3895 test.b = std::numeric_limits<double>::max(); |
3896 test.fa = std::numeric_limits<float>::max(); | 3896 test.fa = std::numeric_limits<float>::max(); |
3897 test.fb = std::numeric_limits<float>::max(); | 3897 test.fb = std::numeric_limits<float>::max(); |
3898 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); | 3898 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); |
3899 CHECK_EQ(std::isfinite(test.c), false); | 3899 CHECK(!std::isfinite(test.c)); |
3900 CHECK_EQ(std::isfinite(test.fc), false); | 3900 CHECK(!std::isfinite(test.fc)); |
3901 | 3901 |
3902 test.a = 5.0; | 3902 test.a = 5.0; |
3903 test.b = std::numeric_limits<double>::signaling_NaN(); | 3903 test.b = std::numeric_limits<double>::signaling_NaN(); |
3904 test.fa = 5.0; | 3904 test.fa = 5.0; |
3905 test.fb = std::numeric_limits<float>::signaling_NaN(); | 3905 test.fb = std::numeric_limits<float>::signaling_NaN(); |
3906 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); | 3906 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); |
3907 CHECK_EQ(std::isnan(test.c), true); | 3907 CHECK(std::isnan(test.c)); |
3908 CHECK_EQ(std::isnan(test.fc), true); | 3908 CHECK(std::isnan(test.fc)); |
3909 } | 3909 } |
3910 | 3910 |
3911 | 3911 |
3912 TEST(C_COND_FMT) { | 3912 TEST(C_COND_FMT) { |
3913 if (kArchVariant == kMips64r2) { | 3913 if (kArchVariant == kMips64r2) { |
3914 CcTest::InitializeVM(); | 3914 CcTest::InitializeVM(); |
3915 Isolate* isolate = CcTest::i_isolate(); | 3915 Isolate* isolate = CcTest::i_isolate(); |
3916 HandleScope scope(isolate); | 3916 HandleScope scope(isolate); |
3917 MacroAssembler assm(isolate, NULL, 0, | 3917 MacroAssembler assm(isolate, NULL, 0, |
3918 v8::internal::CodeObjectRequired::kYes); | 3918 v8::internal::CodeObjectRequired::kYes); |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4418 test.cvt_s_d_in = -0.51; | 4418 test.cvt_s_d_in = -0.51; |
4419 test.cvt_s_w_in = -1; | 4419 test.cvt_s_w_in = -1; |
4420 test.cvt_s_l_in = -1; | 4420 test.cvt_s_l_in = -1; |
4421 test.cvt_w_s_in = -0.51; | 4421 test.cvt_w_s_in = -0.51; |
4422 test.cvt_w_d_in = -0.51; | 4422 test.cvt_w_d_in = -0.51; |
4423 | 4423 |
4424 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); | 4424 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); |
4425 CHECK_EQ(test.cvt_d_s_out, static_cast<double>(test.cvt_d_s_in)); | 4425 CHECK_EQ(test.cvt_d_s_out, static_cast<double>(test.cvt_d_s_in)); |
4426 CHECK_EQ(test.cvt_d_w_out, static_cast<double>(test.cvt_d_w_in)); | 4426 CHECK_EQ(test.cvt_d_w_out, static_cast<double>(test.cvt_d_w_in)); |
4427 CHECK_EQ(test.cvt_d_l_out, static_cast<double>(test.cvt_d_l_in)); | 4427 CHECK_EQ(test.cvt_d_l_out, static_cast<double>(test.cvt_d_l_in)); |
4428 CHECK_EQ(test.cvt_l_s_out, -1); | 4428 CHECK_EQ(-1, test.cvt_l_s_out); |
4429 CHECK_EQ(test.cvt_l_d_out, -1); | 4429 CHECK_EQ(-1, test.cvt_l_d_out); |
4430 CHECK_EQ(test.cvt_s_d_out, static_cast<float>(test.cvt_s_d_in)); | 4430 CHECK_EQ(test.cvt_s_d_out, static_cast<float>(test.cvt_s_d_in)); |
4431 CHECK_EQ(test.cvt_s_w_out, static_cast<float>(test.cvt_s_w_in)); | 4431 CHECK_EQ(test.cvt_s_w_out, static_cast<float>(test.cvt_s_w_in)); |
4432 CHECK_EQ(test.cvt_s_l_out, static_cast<float>(test.cvt_s_l_in)); | 4432 CHECK_EQ(test.cvt_s_l_out, static_cast<float>(test.cvt_s_l_in)); |
4433 CHECK_EQ(test.cvt_w_s_out, -1); | 4433 CHECK_EQ(-1, test.cvt_w_s_out); |
4434 CHECK_EQ(test.cvt_w_d_out, -1); | 4434 CHECK_EQ(-1, test.cvt_w_d_out); |
4435 | |
4436 | 4435 |
4437 test.cvt_d_s_in = 0.49; | 4436 test.cvt_d_s_in = 0.49; |
4438 test.cvt_d_w_in = 1; | 4437 test.cvt_d_w_in = 1; |
4439 test.cvt_d_l_in = 1; | 4438 test.cvt_d_l_in = 1; |
4440 test.cvt_l_s_in = 0.49; | 4439 test.cvt_l_s_in = 0.49; |
4441 test.cvt_l_d_in = 0.49; | 4440 test.cvt_l_d_in = 0.49; |
4442 test.cvt_s_d_in = 0.49; | 4441 test.cvt_s_d_in = 0.49; |
4443 test.cvt_s_w_in = 1; | 4442 test.cvt_s_w_in = 1; |
4444 test.cvt_s_l_in = 1; | 4443 test.cvt_s_l_in = 1; |
4445 test.cvt_w_s_in = 0.49; | 4444 test.cvt_w_s_in = 0.49; |
4446 test.cvt_w_d_in = 0.49; | 4445 test.cvt_w_d_in = 0.49; |
4447 | 4446 |
4448 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); | 4447 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); |
4449 CHECK_EQ(test.cvt_d_s_out, static_cast<double>(test.cvt_d_s_in)); | 4448 CHECK_EQ(test.cvt_d_s_out, static_cast<double>(test.cvt_d_s_in)); |
4450 CHECK_EQ(test.cvt_d_w_out, static_cast<double>(test.cvt_d_w_in)); | 4449 CHECK_EQ(test.cvt_d_w_out, static_cast<double>(test.cvt_d_w_in)); |
4451 CHECK_EQ(test.cvt_d_l_out, static_cast<double>(test.cvt_d_l_in)); | 4450 CHECK_EQ(test.cvt_d_l_out, static_cast<double>(test.cvt_d_l_in)); |
4452 CHECK_EQ(test.cvt_l_s_out, 0); | 4451 CHECK_EQ(0, test.cvt_l_s_out); |
4453 CHECK_EQ(test.cvt_l_d_out, 0); | 4452 CHECK_EQ(0, test.cvt_l_d_out); |
4454 CHECK_EQ(test.cvt_s_d_out, static_cast<float>(test.cvt_s_d_in)); | 4453 CHECK_EQ(test.cvt_s_d_out, static_cast<float>(test.cvt_s_d_in)); |
4455 CHECK_EQ(test.cvt_s_w_out, static_cast<float>(test.cvt_s_w_in)); | 4454 CHECK_EQ(test.cvt_s_w_out, static_cast<float>(test.cvt_s_w_in)); |
4456 CHECK_EQ(test.cvt_s_l_out, static_cast<float>(test.cvt_s_l_in)); | 4455 CHECK_EQ(test.cvt_s_l_out, static_cast<float>(test.cvt_s_l_in)); |
4457 CHECK_EQ(test.cvt_w_s_out, 0); | 4456 CHECK_EQ(0, test.cvt_w_s_out); |
4458 CHECK_EQ(test.cvt_w_d_out, 0); | 4457 CHECK_EQ(0, test.cvt_w_d_out); |
4459 | 4458 |
4460 test.cvt_d_s_in = std::numeric_limits<float>::max(); | 4459 test.cvt_d_s_in = std::numeric_limits<float>::max(); |
4461 test.cvt_d_w_in = std::numeric_limits<int32_t>::max(); | 4460 test.cvt_d_w_in = std::numeric_limits<int32_t>::max(); |
4462 test.cvt_d_l_in = std::numeric_limits<int64_t>::max(); | 4461 test.cvt_d_l_in = std::numeric_limits<int64_t>::max(); |
4463 test.cvt_l_s_in = std::numeric_limits<float>::max(); | 4462 test.cvt_l_s_in = std::numeric_limits<float>::max(); |
4464 test.cvt_l_d_in = std::numeric_limits<double>::max(); | 4463 test.cvt_l_d_in = std::numeric_limits<double>::max(); |
4465 test.cvt_s_d_in = std::numeric_limits<double>::max(); | 4464 test.cvt_s_d_in = std::numeric_limits<double>::max(); |
4466 test.cvt_s_w_in = std::numeric_limits<int32_t>::max(); | 4465 test.cvt_s_w_in = std::numeric_limits<int32_t>::max(); |
4467 test.cvt_s_l_in = std::numeric_limits<int64_t>::max(); | 4466 test.cvt_s_l_in = std::numeric_limits<int64_t>::max(); |
4468 test.cvt_w_s_in = std::numeric_limits<float>::max(); | 4467 test.cvt_w_s_in = std::numeric_limits<float>::max(); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4520 test.cvt_s_d_in = std::numeric_limits<double>::min(); | 4519 test.cvt_s_d_in = std::numeric_limits<double>::min(); |
4521 test.cvt_s_w_in = std::numeric_limits<int32_t>::min(); | 4520 test.cvt_s_w_in = std::numeric_limits<int32_t>::min(); |
4522 test.cvt_s_l_in = std::numeric_limits<int64_t>::min(); | 4521 test.cvt_s_l_in = std::numeric_limits<int64_t>::min(); |
4523 test.cvt_w_s_in = std::numeric_limits<float>::min(); | 4522 test.cvt_w_s_in = std::numeric_limits<float>::min(); |
4524 test.cvt_w_d_in = std::numeric_limits<double>::min(); | 4523 test.cvt_w_d_in = std::numeric_limits<double>::min(); |
4525 | 4524 |
4526 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); | 4525 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); |
4527 CHECK_EQ(test.cvt_d_s_out, static_cast<double>(test.cvt_d_s_in)); | 4526 CHECK_EQ(test.cvt_d_s_out, static_cast<double>(test.cvt_d_s_in)); |
4528 CHECK_EQ(test.cvt_d_w_out, static_cast<double>(test.cvt_d_w_in)); | 4527 CHECK_EQ(test.cvt_d_w_out, static_cast<double>(test.cvt_d_w_in)); |
4529 CHECK_EQ(test.cvt_d_l_out, static_cast<double>(test.cvt_d_l_in)); | 4528 CHECK_EQ(test.cvt_d_l_out, static_cast<double>(test.cvt_d_l_in)); |
4530 CHECK_EQ(test.cvt_l_s_out, 0); | 4529 CHECK_EQ(0, test.cvt_l_s_out); |
4531 CHECK_EQ(test.cvt_l_d_out, 0); | 4530 CHECK_EQ(0, test.cvt_l_d_out); |
4532 CHECK_EQ(test.cvt_s_d_out, static_cast<float>(test.cvt_s_d_in)); | 4531 CHECK_EQ(test.cvt_s_d_out, static_cast<float>(test.cvt_s_d_in)); |
4533 CHECK_EQ(test.cvt_s_w_out, static_cast<float>(test.cvt_s_w_in)); | 4532 CHECK_EQ(test.cvt_s_w_out, static_cast<float>(test.cvt_s_w_in)); |
4534 CHECK_EQ(test.cvt_s_l_out, static_cast<float>(test.cvt_s_l_in)); | 4533 CHECK_EQ(test.cvt_s_l_out, static_cast<float>(test.cvt_s_l_in)); |
4535 CHECK_EQ(test.cvt_w_s_out, 0); | 4534 CHECK_EQ(0, test.cvt_w_s_out); |
4536 CHECK_EQ(test.cvt_w_d_out, 0); | 4535 CHECK_EQ(0, test.cvt_w_d_out); |
4537 } | 4536 } |
4538 | 4537 |
4539 | 4538 |
4540 TEST(DIV_FMT) { | 4539 TEST(DIV_FMT) { |
4541 CcTest::InitializeVM(); | 4540 CcTest::InitializeVM(); |
4542 Isolate* isolate = CcTest::i_isolate(); | 4541 Isolate* isolate = CcTest::i_isolate(); |
4543 HandleScope scope(isolate); | 4542 HandleScope scope(isolate); |
4544 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes); | 4543 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes); |
4545 | 4544 |
4546 typedef struct test { | 4545 typedef struct test { |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4627 CHECK_EQ(test.dRes, dRes[i]); | 4626 CHECK_EQ(test.dRes, dRes[i]); |
4628 CHECK_EQ(test.fRes, fRes[i]); | 4627 CHECK_EQ(test.fRes, fRes[i]); |
4629 } | 4628 } |
4630 | 4629 |
4631 test.dOp1 = DBL_MAX; | 4630 test.dOp1 = DBL_MAX; |
4632 test.dOp2 = -0.0; | 4631 test.dOp2 = -0.0; |
4633 test.fOp1 = FLT_MAX; | 4632 test.fOp1 = FLT_MAX; |
4634 test.fOp2 = -0.0; | 4633 test.fOp2 = -0.0; |
4635 | 4634 |
4636 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); | 4635 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); |
4637 CHECK_EQ(false, std::isfinite(test.dRes)); | 4636 CHECK(!std::isfinite(test.dRes)); |
4638 CHECK_EQ(false, std::isfinite(test.fRes)); | 4637 CHECK(!std::isfinite(test.fRes)); |
4639 | 4638 |
4640 test.dOp1 = 0.0; | 4639 test.dOp1 = 0.0; |
4641 test.dOp2 = -0.0; | 4640 test.dOp2 = -0.0; |
4642 test.fOp1 = 0.0; | 4641 test.fOp1 = 0.0; |
4643 test.fOp2 = -0.0; | 4642 test.fOp2 = -0.0; |
4644 | 4643 |
4645 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); | 4644 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); |
4646 CHECK_EQ(true, std::isnan(test.dRes)); | 4645 CHECK(std::isnan(test.dRes)); |
4647 CHECK_EQ(true, std::isnan(test.fRes)); | 4646 CHECK(std::isnan(test.fRes)); |
4648 | 4647 |
4649 test.dOp1 = std::numeric_limits<double>::quiet_NaN(); | 4648 test.dOp1 = std::numeric_limits<double>::quiet_NaN(); |
4650 test.dOp2 = -5.0; | 4649 test.dOp2 = -5.0; |
4651 test.fOp1 = std::numeric_limits<float>::quiet_NaN(); | 4650 test.fOp1 = std::numeric_limits<float>::quiet_NaN(); |
4652 test.fOp2 = -5.0; | 4651 test.fOp2 = -5.0; |
4653 | 4652 |
4654 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); | 4653 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); |
4655 CHECK_EQ(true, std::isnan(test.dRes)); | 4654 CHECK(std::isnan(test.dRes)); |
4656 CHECK_EQ(true, std::isnan(test.fRes)); | 4655 CHECK(std::isnan(test.fRes)); |
4657 } | 4656 } |
4658 | 4657 |
4659 | 4658 |
4660 uint64_t run_align(uint64_t rs_value, uint64_t rt_value, uint8_t bp) { | 4659 uint64_t run_align(uint64_t rs_value, uint64_t rt_value, uint8_t bp) { |
4661 Isolate* isolate = CcTest::i_isolate(); | 4660 Isolate* isolate = CcTest::i_isolate(); |
4662 HandleScope scope(isolate); | 4661 HandleScope scope(isolate); |
4663 | 4662 |
4664 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes); | 4663 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes); |
4665 | 4664 |
4666 __ align(v0, a0, a1, bp); | 4665 __ align(v0, a0, a1, bp); |
(...skipping 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5924 __ mov(v0, zero_reg); | 5923 __ mov(v0, zero_reg); |
5925 | 5924 |
5926 CodeDesc desc; | 5925 CodeDesc desc; |
5927 assm.GetCode(&desc); | 5926 assm.GetCode(&desc); |
5928 Handle<Code> code = isolate->factory()->NewCode( | 5927 Handle<Code> code = isolate->factory()->NewCode( |
5929 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 5928 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
5930 F2 f = FUNCTION_CAST<F2>(code->entry()); | 5929 F2 f = FUNCTION_CAST<F2>(code->entry()); |
5931 | 5930 |
5932 int64_t res = reinterpret_cast<int64_t>( | 5931 int64_t res = reinterpret_cast<int64_t>( |
5933 CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0)); | 5932 CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0)); |
5934 CHECK_EQ(res, 0); | 5933 CHECK_EQ(0, res); |
5935 } | 5934 } |
5936 | 5935 |
5937 template <class T> | 5936 template <class T> |
5938 struct TestCaseMaddMsub { | 5937 struct TestCaseMaddMsub { |
5939 T fr, fs, ft, fd_add, fd_sub; | 5938 T fr, fs, ft, fd_add, fd_sub; |
5940 }; | 5939 }; |
5941 | 5940 |
5942 template <typename T, typename F> | 5941 template <typename T, typename F> |
5943 void helper_madd_msub_maddf_msubf(F func) { | 5942 void helper_madd_msub_maddf_msubf(F func) { |
5944 CcTest::InitializeVM(); | 5943 CcTest::InitializeVM(); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6054 if (kArchVariant != kMips64r6) return; | 6053 if (kArchVariant != kMips64r6) return; |
6055 helper_madd_msub_maddf_msubf<double>([](MacroAssembler& assm) { | 6054 helper_madd_msub_maddf_msubf<double>([](MacroAssembler& assm) { |
6056 __ maddf_d(f4, f6, f8); | 6055 __ maddf_d(f4, f6, f8); |
6057 __ sdc1(f4, MemOperand(a0, offsetof(TestCaseMaddMsub<double>, fd_add))); | 6056 __ sdc1(f4, MemOperand(a0, offsetof(TestCaseMaddMsub<double>, fd_add))); |
6058 __ msubf_d(f16, f6, f8); | 6057 __ msubf_d(f16, f6, f8); |
6059 __ sdc1(f16, MemOperand(a0, offsetof(TestCaseMaddMsub<double>, fd_sub))); | 6058 __ sdc1(f16, MemOperand(a0, offsetof(TestCaseMaddMsub<double>, fd_sub))); |
6060 }); | 6059 }); |
6061 } | 6060 } |
6062 | 6061 |
6063 #undef __ | 6062 #undef __ |
OLD | NEW |