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 2493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2504 | 2504 |
2505 float outputs_S[tableLength] = { | 2505 float outputs_S[tableLength] = { |
2506 0.0, 2.0, sqrt2_s, 2e-14 | 2506 0.0, 2.0, sqrt2_s, 2e-14 |
2507 }; | 2507 }; |
2508 | 2508 |
2509 | 2509 |
2510 __ lwc1(f2, MemOperand(a0, offsetof(TestFloat, a)) ); | 2510 __ lwc1(f2, MemOperand(a0, offsetof(TestFloat, a)) ); |
2511 __ ldc1(f8, MemOperand(a0, offsetof(TestFloat, c)) ); | 2511 __ ldc1(f8, MemOperand(a0, offsetof(TestFloat, c)) ); |
2512 __ sqrt_s(f6, f2); | 2512 __ sqrt_s(f6, f2); |
2513 __ sqrt_d(f12, f8); | 2513 __ sqrt_d(f12, f8); |
2514 __ rsqrt_d(f14, f8); | 2514 |
2515 __ rsqrt_s(f16, f2); | 2515 if (IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) { |
2516 __ recip_d(f18, f8); | 2516 __ rsqrt_d(f14, f8); |
2517 __ recip_s(f20, f2); | 2517 __ rsqrt_s(f16, f2); |
| 2518 __ recip_d(f18, f8); |
| 2519 __ recip_s(f20, f2); |
| 2520 } |
2518 __ swc1(f6, MemOperand(a0, offsetof(TestFloat, resultS)) ); | 2521 __ swc1(f6, MemOperand(a0, offsetof(TestFloat, resultS)) ); |
2519 __ sdc1(f12, MemOperand(a0, offsetof(TestFloat, resultD)) ); | 2522 __ sdc1(f12, MemOperand(a0, offsetof(TestFloat, resultD)) ); |
2520 __ swc1(f16, MemOperand(a0, offsetof(TestFloat, resultS1)) ); | 2523 |
2521 __ sdc1(f14, MemOperand(a0, offsetof(TestFloat, resultD1)) ); | 2524 if (IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) { |
2522 __ swc1(f20, MemOperand(a0, offsetof(TestFloat, resultS2)) ); | 2525 __ swc1(f16, MemOperand(a0, offsetof(TestFloat, resultS1)) ); |
2523 __ sdc1(f18, MemOperand(a0, offsetof(TestFloat, resultD2)) ); | 2526 __ sdc1(f14, MemOperand(a0, offsetof(TestFloat, resultD1)) ); |
| 2527 __ swc1(f20, MemOperand(a0, offsetof(TestFloat, resultS2)) ); |
| 2528 __ sdc1(f18, MemOperand(a0, offsetof(TestFloat, resultD2)) ); |
| 2529 } |
2524 __ jr(ra); | 2530 __ jr(ra); |
2525 __ nop(); | 2531 __ nop(); |
2526 | 2532 |
2527 CodeDesc desc; | 2533 CodeDesc desc; |
2528 assm.GetCode(&desc); | 2534 assm.GetCode(&desc); |
2529 Handle<Code> code = isolate->factory()->NewCode( | 2535 Handle<Code> code = isolate->factory()->NewCode( |
2530 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 2536 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
2531 F3 f = FUNCTION_CAST<F3>(code->entry()); | 2537 F3 f = FUNCTION_CAST<F3>(code->entry()); |
2532 | 2538 |
2533 for (int i = 0; i < tableLength; i++) { | 2539 for (int i = 0; i < tableLength; i++) { |
2534 float f1; | 2540 float f1; |
2535 double d1; | 2541 double d1; |
2536 test.a = inputs_S[i]; | 2542 test.a = inputs_S[i]; |
2537 test.c = inputs_D[i]; | 2543 test.c = inputs_D[i]; |
2538 | 2544 |
2539 (CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0)); | 2545 (CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0)); |
2540 | 2546 |
2541 CHECK_EQ(test.resultS, outputs_S[i]); | 2547 CHECK_EQ(test.resultS, outputs_S[i]); |
2542 CHECK_EQ(test.resultD, outputs_D[i]); | 2548 CHECK_EQ(test.resultD, outputs_D[i]); |
2543 | 2549 |
2544 if (i != 0) { | 2550 if (IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) { |
2545 f1 = test.resultS1 - 1.0F/outputs_S[i]; | 2551 if (i != 0) { |
2546 f1 = (f1 < 0) ? f1 : -f1; | 2552 f1 = test.resultS1 - 1.0F/outputs_S[i]; |
2547 CHECK(f1 <= deltaFloat); | 2553 f1 = (f1 < 0) ? f1 : -f1; |
2548 d1 = test.resultD1 - 1.0L/outputs_D[i]; | 2554 CHECK(f1 <= deltaFloat); |
2549 d1 = (d1 < 0) ? d1 : -d1; | 2555 d1 = test.resultD1 - 1.0L/outputs_D[i]; |
2550 CHECK(d1 <= deltaDouble); | 2556 d1 = (d1 < 0) ? d1 : -d1; |
2551 f1 = test.resultS2 - 1.0F/inputs_S[i]; | 2557 CHECK(d1 <= deltaDouble); |
2552 f1 = (f1 < 0) ? f1 : -f1; | 2558 f1 = test.resultS2 - 1.0F/inputs_S[i]; |
2553 CHECK(f1 <= deltaFloat); | 2559 f1 = (f1 < 0) ? f1 : -f1; |
2554 d1 = test.resultD2 - 1.0L/inputs_D[i]; | 2560 CHECK(f1 <= deltaFloat); |
2555 d1 = (d1 < 0) ? d1 : -d1; | 2561 d1 = test.resultD2 - 1.0L/inputs_D[i]; |
2556 CHECK(d1 <= deltaDouble); | 2562 d1 = (d1 < 0) ? d1 : -d1; |
2557 } else { | 2563 CHECK(d1 <= deltaDouble); |
2558 CHECK_EQ(test.resultS1, 1.0F/outputs_S[i]); | 2564 } else { |
2559 CHECK_EQ(test.resultD1, 1.0L/outputs_D[i]); | 2565 CHECK_EQ(test.resultS1, 1.0F/outputs_S[i]); |
2560 CHECK_EQ(test.resultS2, 1.0F/inputs_S[i]); | 2566 CHECK_EQ(test.resultD1, 1.0L/outputs_D[i]); |
2561 CHECK_EQ(test.resultD2, 1.0L/inputs_D[i]); | 2567 CHECK_EQ(test.resultS2, 1.0F/inputs_S[i]); |
| 2568 CHECK_EQ(test.resultD2, 1.0L/inputs_D[i]); |
| 2569 } |
2562 } | 2570 } |
2563 } | 2571 } |
2564 } | 2572 } |
2565 | 2573 |
2566 | 2574 |
2567 TEST(neg) { | 2575 TEST(neg) { |
2568 const int tableLength = 3; | 2576 const int tableLength = 3; |
2569 CcTest::InitializeVM(); | 2577 CcTest::InitializeVM(); |
2570 Isolate* isolate = CcTest::i_isolate(); | 2578 Isolate* isolate = CcTest::i_isolate(); |
2571 HandleScope scope(isolate); | 2579 HandleScope scope(isolate); |
(...skipping 2470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5042 size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseBalc); | 5050 size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseBalc); |
5043 for (size_t i = 0; i < nr_test_cases; ++i) { | 5051 for (size_t i = 0; i < nr_test_cases; ++i) { |
5044 int32_t res = run_balc(tc[i].offset); | 5052 int32_t res = run_balc(tc[i].offset); |
5045 CHECK_EQ(tc[i].expected_res, res); | 5053 CHECK_EQ(tc[i].expected_res, res); |
5046 } | 5054 } |
5047 } | 5055 } |
5048 } | 5056 } |
5049 | 5057 |
5050 | 5058 |
5051 #undef __ | 5059 #undef __ |
OLD | NEW |