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 1472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1483 double inputsb[kTableLength] = {3.0, 2.0, 3.0, dnan, 0.0, -0.0, dnan, | 1483 double inputsb[kTableLength] = {3.0, 2.0, 3.0, dnan, 0.0, -0.0, dnan, |
1484 dinf, dinf, 42.0, dinf, dminf, dnan}; | 1484 dinf, dinf, 42.0, dinf, dminf, dnan}; |
1485 double outputsdmin[kTableLength] = {2.0, 2.0, 3.0, 3.0, -0.0, | 1485 double outputsdmin[kTableLength] = {2.0, 2.0, 3.0, 3.0, -0.0, |
1486 -0.0, dinf, dinf, 42.0, 42.0, | 1486 -0.0, dinf, dinf, 42.0, 42.0, |
1487 dminf, dminf, dnan}; | 1487 dminf, dminf, dnan}; |
1488 double outputsdmax[kTableLength] = {3.0, 3.0, 3.0, 3.0, 0.0, 0.0, dinf, | 1488 double outputsdmax[kTableLength] = {3.0, 3.0, 3.0, 3.0, 0.0, 0.0, dinf, |
1489 dinf, dinf, dinf, dinf, dinf, dnan}; | 1489 dinf, dinf, dinf, dinf, dinf, dnan}; |
1490 | 1490 |
1491 float inputse[kTableLength] = {2.0, 3.0, fnan, 3.0, -0.0, 0.0, finf, | 1491 float inputse[kTableLength] = {2.0, 3.0, fnan, 3.0, -0.0, 0.0, finf, |
1492 fnan, 42.0, finf, fminf, finf, fnan}; | 1492 fnan, 42.0, finf, fminf, finf, fnan}; |
1493 float inputsf[kTableLength] = {3.0, 2.0, 3.0, fnan, -0.0, 0.0, fnan, | 1493 float inputsf[kTableLength] = {3.0, 2.0, 3.0, fnan, 0.0, -0.0, fnan, |
1494 finf, finf, 42.0, finf, fminf, fnan}; | 1494 finf, finf, 42.0, finf, fminf, fnan}; |
1495 float outputsfmin[kTableLength] = {2.0, 2.0, 3.0, 3.0, -0.0, | 1495 float outputsfmin[kTableLength] = {2.0, 2.0, 3.0, 3.0, -0.0, |
1496 -0.0, finf, finf, 42.0, 42.0, | 1496 -0.0, finf, finf, 42.0, 42.0, |
1497 fminf, fminf, fnan}; | 1497 fminf, fminf, fnan}; |
1498 float outputsfmax[kTableLength] = {3.0, 3.0, 3.0, 3.0, 0.0, 0.0, finf, | 1498 float outputsfmax[kTableLength] = {3.0, 3.0, 3.0, 3.0, 0.0, 0.0, finf, |
1499 finf, finf, finf, finf, finf, fnan}; | 1499 finf, finf, finf, finf, finf, fnan}; |
1500 | 1500 |
1501 __ ldc1(f4, MemOperand(a0, offsetof(TestFloat, a))); | 1501 __ ldc1(f4, MemOperand(a0, offsetof(TestFloat, a))); |
1502 __ ldc1(f8, MemOperand(a0, offsetof(TestFloat, b))); | 1502 __ ldc1(f8, MemOperand(a0, offsetof(TestFloat, b))); |
1503 __ lwc1(f2, MemOperand(a0, offsetof(TestFloat, e))); | 1503 __ lwc1(f2, MemOperand(a0, offsetof(TestFloat, e))); |
(...skipping 13 matching lines...) Expand all Loading... |
1517 assm.GetCode(&desc); | 1517 assm.GetCode(&desc); |
1518 Handle<Code> code = isolate->factory()->NewCode( | 1518 Handle<Code> code = isolate->factory()->NewCode( |
1519 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 1519 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
1520 F3 f = FUNCTION_CAST<F3>(code->entry()); | 1520 F3 f = FUNCTION_CAST<F3>(code->entry()); |
1521 for (int i = 0; i < kTableLength; i++) { | 1521 for (int i = 0; i < kTableLength; i++) { |
1522 test.a = inputsa[i]; | 1522 test.a = inputsa[i]; |
1523 test.b = inputsb[i]; | 1523 test.b = inputsb[i]; |
1524 test.e = inputse[i]; | 1524 test.e = inputse[i]; |
1525 test.f = inputsf[i]; | 1525 test.f = inputsf[i]; |
1526 | 1526 |
1527 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); | 1527 CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0); |
1528 | 1528 |
1529 if (i < kTableLength - 1) { | 1529 CHECK_EQ(0, memcmp(&test.c, &outputsdmin[i], sizeof(test.c))); |
1530 CHECK_EQ(test.c, outputsdmin[i]); | 1530 CHECK_EQ(0, memcmp(&test.d, &outputsdmax[i], sizeof(test.d))); |
1531 CHECK_EQ(test.d, outputsdmax[i]); | 1531 CHECK_EQ(0, memcmp(&test.g, &outputsfmin[i], sizeof(test.g))); |
1532 CHECK_EQ(test.g, outputsfmin[i]); | 1532 CHECK_EQ(0, memcmp(&test.h, &outputsfmax[i], sizeof(test.h))); |
1533 CHECK_EQ(test.h, outputsfmax[i]); | |
1534 } else { | |
1535 CHECK(std::isnan(test.c)); | |
1536 CHECK(std::isnan(test.d)); | |
1537 CHECK(std::isnan(test.g)); | |
1538 CHECK(std::isnan(test.h)); | |
1539 } | |
1540 } | 1533 } |
1541 } | 1534 } |
1542 } | 1535 } |
1543 | 1536 |
1544 | 1537 |
1545 TEST(rint_d) { | 1538 TEST(rint_d) { |
1546 if (IsMipsArchVariant(kMips32r6)) { | 1539 if (IsMipsArchVariant(kMips32r6)) { |
1547 const int kTableLength = 30; | 1540 const int kTableLength = 30; |
1548 CcTest::InitializeVM(); | 1541 CcTest::InitializeVM(); |
1549 Isolate* isolate = CcTest::i_isolate(); | 1542 Isolate* isolate = CcTest::i_isolate(); |
(...skipping 3835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5385 Handle<Code> code = isolate->factory()->NewCode( | 5378 Handle<Code> code = isolate->factory()->NewCode( |
5386 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 5379 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
5387 F2 f = FUNCTION_CAST<F2>(code->entry()); | 5380 F2 f = FUNCTION_CAST<F2>(code->entry()); |
5388 | 5381 |
5389 int32_t res = reinterpret_cast<int32_t>( | 5382 int32_t res = reinterpret_cast<int32_t>( |
5390 CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0)); | 5383 CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0)); |
5391 CHECK_EQ(res, 0); | 5384 CHECK_EQ(res, 0); |
5392 } | 5385 } |
5393 | 5386 |
5394 #undef __ | 5387 #undef __ |
OLD | NEW |