Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: src/mips/codegen-mips.cc

Issue 24654002: MIPS: Tweak Math.exp. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/mips/codegen-mips.h ('k') | src/mips/lithium-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 ASSERT(!input.is(double_scratch1)); 533 ASSERT(!input.is(double_scratch1));
534 ASSERT(!input.is(double_scratch2)); 534 ASSERT(!input.is(double_scratch2));
535 ASSERT(!result.is(double_scratch1)); 535 ASSERT(!result.is(double_scratch1));
536 ASSERT(!result.is(double_scratch2)); 536 ASSERT(!result.is(double_scratch2));
537 ASSERT(!double_scratch1.is(double_scratch2)); 537 ASSERT(!double_scratch1.is(double_scratch2));
538 ASSERT(!temp1.is(temp2)); 538 ASSERT(!temp1.is(temp2));
539 ASSERT(!temp1.is(temp3)); 539 ASSERT(!temp1.is(temp3));
540 ASSERT(!temp2.is(temp3)); 540 ASSERT(!temp2.is(temp3));
541 ASSERT(ExternalReference::math_exp_constants(0).address() != NULL); 541 ASSERT(ExternalReference::math_exp_constants(0).address() != NULL);
542 542
543 Label done; 543 Label zero, infinity, done;
544 544
545 __ li(temp3, Operand(ExternalReference::math_exp_constants(0))); 545 __ li(temp3, Operand(ExternalReference::math_exp_constants(0)));
546 546
547 __ ldc1(double_scratch1, ExpConstant(0, temp3)); 547 __ ldc1(double_scratch1, ExpConstant(0, temp3));
548 __ Move(result, kDoubleRegZero); 548 __ BranchF(&zero, NULL, ge, double_scratch1, input);
549 __ BranchF(&done, NULL, ge, double_scratch1, input); 549
550 __ ldc1(double_scratch2, ExpConstant(1, temp3)); 550 __ ldc1(double_scratch2, ExpConstant(1, temp3));
551 __ ldc1(result, ExpConstant(2, temp3)); 551 __ BranchF(&infinity, NULL, ge, input, double_scratch2);
552 __ BranchF(&done, NULL, ge, input, double_scratch2); 552
553 __ ldc1(double_scratch1, ExpConstant(3, temp3)); 553 __ ldc1(double_scratch1, ExpConstant(3, temp3));
554 __ ldc1(result, ExpConstant(4, temp3)); 554 __ ldc1(result, ExpConstant(4, temp3));
555 __ mul_d(double_scratch1, double_scratch1, input); 555 __ mul_d(double_scratch1, double_scratch1, input);
556 __ add_d(double_scratch1, double_scratch1, result); 556 __ add_d(double_scratch1, double_scratch1, result);
557 __ Move(temp2, temp1, double_scratch1); 557 __ FmoveLow(temp2, double_scratch1);
558 __ sub_d(double_scratch1, double_scratch1, result); 558 __ sub_d(double_scratch1, double_scratch1, result);
559 __ ldc1(result, ExpConstant(6, temp3)); 559 __ ldc1(result, ExpConstant(6, temp3));
560 __ ldc1(double_scratch2, ExpConstant(5, temp3)); 560 __ ldc1(double_scratch2, ExpConstant(5, temp3));
561 __ mul_d(double_scratch1, double_scratch1, double_scratch2); 561 __ mul_d(double_scratch1, double_scratch1, double_scratch2);
562 __ sub_d(double_scratch1, double_scratch1, input); 562 __ sub_d(double_scratch1, double_scratch1, input);
563 __ sub_d(result, result, double_scratch1); 563 __ sub_d(result, result, double_scratch1);
564 __ mul_d(input, double_scratch1, double_scratch1); 564 __ mul_d(double_scratch2, double_scratch1, double_scratch1);
565 __ mul_d(result, result, input); 565 __ mul_d(result, result, double_scratch2);
566 __ srl(temp1, temp2, 11);
567 __ ldc1(double_scratch2, ExpConstant(7, temp3)); 566 __ ldc1(double_scratch2, ExpConstant(7, temp3));
568 __ mul_d(result, result, double_scratch2); 567 __ mul_d(result, result, double_scratch2);
569 __ sub_d(result, result, double_scratch1); 568 __ sub_d(result, result, double_scratch1);
570 __ ldc1(double_scratch2, ExpConstant(8, temp3)); 569 // Mov 1 in double_scratch2 as math_exp_constants_array[8] == 1.
570 ASSERT(*reinterpret_cast<double*>
571 (ExternalReference::math_exp_constants(8).address()) == 1);
572 __ Move(double_scratch2, 1);
571 __ add_d(result, result, double_scratch2); 573 __ add_d(result, result, double_scratch2);
572 __ li(at, 0x7ff); 574 __ srl(temp1, temp2, 11);
573 __ And(temp2, temp2, at); 575 __ Ext(temp2, temp2, 0, 11);
574 __ Addu(temp1, temp1, Operand(0x3ff)); 576 __ Addu(temp1, temp1, Operand(0x3ff));
575 __ sll(temp1, temp1, 20);
576 577
577 // Must not call ExpConstant() after overwriting temp3! 578 // Must not call ExpConstant() after overwriting temp3!
578 __ li(temp3, Operand(ExternalReference::math_exp_log_table())); 579 __ li(temp3, Operand(ExternalReference::math_exp_log_table()));
579 __ sll(at, temp2, 3); 580 __ sll(at, temp2, 3);
580 __ addu(at, at, temp3); 581 __ Addu(temp3, temp3, Operand(at));
581 __ lw(at, MemOperand(at)); 582 __ lw(temp2, MemOperand(temp3, 0));
582 __ Addu(temp3, temp3, Operand(kPointerSize)); 583 __ lw(temp3, MemOperand(temp3, kPointerSize));
583 __ sll(temp2, temp2, 3); 584 // The first word is loaded is the lower number register.
584 __ addu(temp2, temp2, temp3); 585 if (temp2.code() < temp3.code()) {
585 __ lw(temp2, MemOperand(temp2)); 586 __ sll(at, temp1, 20);
586 __ Or(temp1, temp1, temp2); 587 __ Or(temp1, temp3, at);
587 __ Move(input, at, temp1); 588 __ Move(double_scratch1, temp2, temp1);
588 __ mul_d(result, result, input); 589 } else {
590 __ sll(at, temp1, 20);
591 __ Or(temp1, temp2, at);
592 __ Move(double_scratch1, temp3, temp1);
593 }
594 __ mul_d(result, result, double_scratch1);
595 __ Branch(&done);
596
597 __ bind(&zero);
598 __ Move(result, kDoubleRegZero);
599 __ Branch(&done);
600
601 __ bind(&infinity);
602 __ ldc1(result, ExpConstant(2, temp3));
603
589 __ bind(&done); 604 __ bind(&done);
590 } 605 }
591 606
592 607
593 // nop(CODE_AGE_MARKER_NOP) 608 // nop(CODE_AGE_MARKER_NOP)
594 static const uint32_t kCodeAgePatchFirstInstruction = 0x00010180; 609 static const uint32_t kCodeAgePatchFirstInstruction = 0x00010180;
595 610
596 static byte* GetNoCodeAgeSequence(uint32_t* length) { 611 static byte* GetNoCodeAgeSequence(uint32_t* length) {
597 // The sequence of instructions that is patched out for aging code is the 612 // The sequence of instructions that is patched out for aging code is the
598 // following boilerplate stack-building prologue that is found in FUNCTIONS 613 // following boilerplate stack-building prologue that is found in FUNCTIONS
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start())); 675 patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start()));
661 } 676 }
662 } 677 }
663 678
664 679
665 #undef __ 680 #undef __
666 681
667 } } // namespace v8::internal 682 } } // namespace v8::internal
668 683
669 #endif // V8_TARGET_ARCH_MIPS 684 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/codegen-mips.h ('k') | src/mips/lithium-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698