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

Side by Side Diff: src/compiler/ppc/code-generator-ppc.cc

Issue 1049253004: PPC: [turbofan] Add backend support for float32 operations. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « no previous file | src/compiler/ppc/instruction-codes-ppc.h » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/code-generator.h" 5 #include "src/compiler/code-generator.h"
6 6
7 #include "src/compiler/code-generator-impl.h" 7 #include "src/compiler/code-generator-impl.h"
8 #include "src/compiler/gap-resolver.h" 8 #include "src/compiler/gap-resolver.h"
9 #include "src/compiler/node-matchers.h" 9 #include "src/compiler/node-matchers.h"
10 #include "src/ppc/macro-assembler-ppc.h" 10 #include "src/ppc/macro-assembler-ppc.h"
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 MemOperand operand = i.MemoryOperand(&mode); \ 376 MemOperand operand = i.MemoryOperand(&mode); \
377 if (mode == kMode_MRI) { \ 377 if (mode == kMode_MRI) { \
378 __ asm_instr(result, operand); \ 378 __ asm_instr(result, operand); \
379 } else { \ 379 } else { \
380 __ asm_instrx(result, operand); \ 380 __ asm_instrx(result, operand); \
381 } \ 381 } \
382 DCHECK_EQ(LeaveRC, i.OutputRCBit()); \ 382 DCHECK_EQ(LeaveRC, i.OutputRCBit()); \
383 } while (0) 383 } while (0)
384 384
385 385
386 #define ASSEMBLE_STORE_FLOAT(asm_instr, asm_instrx) \ 386 #define ASSEMBLE_STORE_FLOAT32() \
387 do { \
388 size_t index = 0; \
389 AddressingMode mode = kMode_None; \
390 MemOperand operand = i.MemoryOperand(&mode, &index); \
391 DoubleRegister value = i.InputDoubleRegister(index); \
392 __ frsp(kScratchDoubleReg, value); \
393 if (mode == kMode_MRI) { \
394 __ stfs(kScratchDoubleReg, operand); \
395 } else { \
396 __ stfsx(kScratchDoubleReg, operand); \
397 } \
398 DCHECK_EQ(LeaveRC, i.OutputRCBit()); \
399 } while (0)
400
401
402 #define ASSEMBLE_STORE_DOUBLE() \
387 do { \ 403 do { \
388 size_t index = 0; \ 404 size_t index = 0; \
389 AddressingMode mode = kMode_None; \ 405 AddressingMode mode = kMode_None; \
390 MemOperand operand = i.MemoryOperand(&mode, &index); \ 406 MemOperand operand = i.MemoryOperand(&mode, &index); \
391 DoubleRegister value = i.InputDoubleRegister(index); \ 407 DoubleRegister value = i.InputDoubleRegister(index); \
392 if (mode == kMode_MRI) { \ 408 if (mode == kMode_MRI) { \
393 __ asm_instr(value, operand); \ 409 __ stfd(value, operand); \
394 } else { \ 410 } else { \
395 __ asm_instrx(value, operand); \ 411 __ stfdx(value, operand); \
396 } \ 412 } \
397 DCHECK_EQ(LeaveRC, i.OutputRCBit()); \ 413 DCHECK_EQ(LeaveRC, i.OutputRCBit()); \
398 } while (0) 414 } while (0)
399 415
400 416
401 #define ASSEMBLE_STORE_INTEGER(asm_instr, asm_instrx) \ 417 #define ASSEMBLE_STORE_INTEGER(asm_instr, asm_instrx) \
402 do { \ 418 do { \
403 size_t index = 0; \ 419 size_t index = 0; \
404 AddressingMode mode = kMode_None; \ 420 AddressingMode mode = kMode_None; \
405 MemOperand operand = i.MemoryOperand(&mode, &index); \ 421 MemOperand operand = i.MemoryOperand(&mode, &index); \
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 __ asm_instr(result, operand); \ 477 __ asm_instr(result, operand); \
462 } else { \ 478 } else { \
463 __ asm_instrx(result, operand); \ 479 __ asm_instrx(result, operand); \
464 } \ 480 } \
465 __ bind(ool->exit()); \ 481 __ bind(ool->exit()); \
466 DCHECK_EQ(LeaveRC, i.OutputRCBit()); \ 482 DCHECK_EQ(LeaveRC, i.OutputRCBit()); \
467 } while (0) 483 } while (0)
468 484
469 485
470 // TODO(mbrandy): fix paths that produce garbage in offset's upper 32-bits. 486 // TODO(mbrandy): fix paths that produce garbage in offset's upper 32-bits.
471 #define ASSEMBLE_CHECKED_STORE_FLOAT(asm_instr, asm_instrx) \ 487 #define ASSEMBLE_CHECKED_STORE_FLOAT32() \
472 do { \ 488 do { \
473 Label done; \ 489 Label done; \
474 size_t index = 0; \ 490 size_t index = 0; \
475 AddressingMode mode = kMode_None; \ 491 AddressingMode mode = kMode_None; \
476 MemOperand operand = i.MemoryOperand(&mode, index); \ 492 MemOperand operand = i.MemoryOperand(&mode, index); \
477 DCHECK_EQ(kMode_MRR, mode); \ 493 DCHECK_EQ(kMode_MRR, mode); \
478 Register offset = operand.rb(); \ 494 Register offset = operand.rb(); \
479 __ extsw(offset, offset); \ 495 __ extsw(offset, offset); \
480 if (HasRegisterInput(instr, 2)) { \ 496 if (HasRegisterInput(instr, 2)) { \
481 __ cmplw(offset, i.InputRegister(2)); \ 497 __ cmplw(offset, i.InputRegister(2)); \
482 } else { \ 498 } else { \
483 __ cmplwi(offset, i.InputImmediate(2)); \ 499 __ cmplwi(offset, i.InputImmediate(2)); \
484 } \ 500 } \
485 __ bge(&done); \ 501 __ bge(&done); \
486 DoubleRegister value = i.InputDoubleRegister(3); \ 502 DoubleRegister value = i.InputDoubleRegister(3); \
487 if (mode == kMode_MRI) { \ 503 __ frsp(kScratchDoubleReg, value); \
488 __ asm_instr(value, operand); \ 504 if (mode == kMode_MRI) { \
489 } else { \ 505 __ stfs(kScratchDoubleReg, operand); \
490 __ asm_instrx(value, operand); \ 506 } else { \
491 } \ 507 __ stfsx(kScratchDoubleReg, operand); \
492 __ bind(&done); \ 508 } \
493 DCHECK_EQ(LeaveRC, i.OutputRCBit()); \ 509 __ bind(&done); \
510 DCHECK_EQ(LeaveRC, i.OutputRCBit()); \
494 } while (0) 511 } while (0)
495 512
496 513
514 // TODO(mbrandy): fix paths that produce garbage in offset's upper 32-bits.
515 #define ASSEMBLE_CHECKED_STORE_DOUBLE() \
516 do { \
517 Label done; \
518 size_t index = 0; \
519 AddressingMode mode = kMode_None; \
520 MemOperand operand = i.MemoryOperand(&mode, index); \
521 DCHECK_EQ(kMode_MRR, mode); \
522 Register offset = operand.rb(); \
523 __ extsw(offset, offset); \
524 if (HasRegisterInput(instr, 2)) { \
525 __ cmplw(offset, i.InputRegister(2)); \
526 } else { \
527 __ cmplwi(offset, i.InputImmediate(2)); \
528 } \
529 __ bge(&done); \
530 DoubleRegister value = i.InputDoubleRegister(3); \
531 if (mode == kMode_MRI) { \
532 __ stfd(value, operand); \
533 } else { \
534 __ stfdx(value, operand); \
535 } \
536 __ bind(&done); \
537 DCHECK_EQ(LeaveRC, i.OutputRCBit()); \
538 } while (0)
539
540
497 // TODO(mbrandy): fix paths that produce garbage in offset's upper 32-bits. 541 // TODO(mbrandy): fix paths that produce garbage in offset's upper 32-bits.
498 #define ASSEMBLE_CHECKED_STORE_INTEGER(asm_instr, asm_instrx) \ 542 #define ASSEMBLE_CHECKED_STORE_INTEGER(asm_instr, asm_instrx) \
499 do { \ 543 do { \
500 Label done; \ 544 Label done; \
501 size_t index = 0; \ 545 size_t index = 0; \
502 AddressingMode mode = kMode_None; \ 546 AddressingMode mode = kMode_None; \
503 MemOperand operand = i.MemoryOperand(&mode, index); \ 547 MemOperand operand = i.MemoryOperand(&mode, index); \
504 DCHECK_EQ(kMode_MRR, mode); \ 548 DCHECK_EQ(kMode_MRR, mode); \
505 Register offset = operand.rb(); \ 549 Register offset = operand.rb(); \
506 __ extsw(offset, offset); \ 550 __ extsw(offset, offset); \
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 break; 644 break;
601 case kArchStackPointer: 645 case kArchStackPointer:
602 __ mr(i.OutputRegister(), sp); 646 __ mr(i.OutputRegister(), sp);
603 DCHECK_EQ(LeaveRC, i.OutputRCBit()); 647 DCHECK_EQ(LeaveRC, i.OutputRCBit());
604 break; 648 break;
605 case kArchTruncateDoubleToI: 649 case kArchTruncateDoubleToI:
606 // TODO(mbrandy): move slow call to stub out of line. 650 // TODO(mbrandy): move slow call to stub out of line.
607 __ TruncateDoubleToI(i.OutputRegister(), i.InputDoubleRegister(0)); 651 __ TruncateDoubleToI(i.OutputRegister(), i.InputDoubleRegister(0));
608 DCHECK_EQ(LeaveRC, i.OutputRCBit()); 652 DCHECK_EQ(LeaveRC, i.OutputRCBit());
609 break; 653 break;
610 case kPPC_And32: 654 case kPPC_And:
611 case kPPC_And64:
612 if (HasRegisterInput(instr, 1)) { 655 if (HasRegisterInput(instr, 1)) {
613 __ and_(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1), 656 __ and_(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1),
614 i.OutputRCBit()); 657 i.OutputRCBit());
615 } else { 658 } else {
616 __ andi(i.OutputRegister(), i.InputRegister(0), i.InputImmediate(1)); 659 __ andi(i.OutputRegister(), i.InputRegister(0), i.InputImmediate(1));
617 } 660 }
618 break; 661 break;
619 case kPPC_AndComplement32: 662 case kPPC_AndComplement:
620 case kPPC_AndComplement64:
621 __ andc(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1), 663 __ andc(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1),
622 i.OutputRCBit()); 664 i.OutputRCBit());
623 break; 665 break;
624 case kPPC_Or32: 666 case kPPC_Or:
625 case kPPC_Or64:
626 if (HasRegisterInput(instr, 1)) { 667 if (HasRegisterInput(instr, 1)) {
627 __ orx(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1), 668 __ orx(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1),
628 i.OutputRCBit()); 669 i.OutputRCBit());
629 } else { 670 } else {
630 __ ori(i.OutputRegister(), i.InputRegister(0), i.InputImmediate(1)); 671 __ ori(i.OutputRegister(), i.InputRegister(0), i.InputImmediate(1));
631 DCHECK_EQ(LeaveRC, i.OutputRCBit()); 672 DCHECK_EQ(LeaveRC, i.OutputRCBit());
632 } 673 }
633 break; 674 break;
634 case kPPC_OrComplement32: 675 case kPPC_OrComplement:
635 case kPPC_OrComplement64:
636 __ orc(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1), 676 __ orc(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1),
637 i.OutputRCBit()); 677 i.OutputRCBit());
638 break; 678 break;
639 case kPPC_Xor32: 679 case kPPC_Xor:
640 case kPPC_Xor64:
641 if (HasRegisterInput(instr, 1)) { 680 if (HasRegisterInput(instr, 1)) {
642 __ xor_(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1), 681 __ xor_(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1),
643 i.OutputRCBit()); 682 i.OutputRCBit());
644 } else { 683 } else {
645 __ xori(i.OutputRegister(), i.InputRegister(0), i.InputImmediate(1)); 684 __ xori(i.OutputRegister(), i.InputRegister(0), i.InputImmediate(1));
646 DCHECK_EQ(LeaveRC, i.OutputRCBit()); 685 DCHECK_EQ(LeaveRC, i.OutputRCBit());
647 } 686 }
648 break; 687 break;
649 case kPPC_ShiftLeft32: 688 case kPPC_ShiftLeft32:
650 ASSEMBLE_BINOP_RC(slw, slwi); 689 ASSEMBLE_BINOP_RC(slw, slwi);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 if (HasRegisterInput(instr, 1)) { 724 if (HasRegisterInput(instr, 1)) {
686 __ subfic(kScratchReg, i.InputRegister(1), Operand(64)); 725 __ subfic(kScratchReg, i.InputRegister(1), Operand(64));
687 __ rotld(i.OutputRegister(), i.InputRegister(0), kScratchReg, 726 __ rotld(i.OutputRegister(), i.InputRegister(0), kScratchReg,
688 i.OutputRCBit()); 727 i.OutputRCBit());
689 } else { 728 } else {
690 int sh = i.InputInt32(1); 729 int sh = i.InputInt32(1);
691 __ rotrdi(i.OutputRegister(), i.InputRegister(0), sh, i.OutputRCBit()); 730 __ rotrdi(i.OutputRegister(), i.InputRegister(0), sh, i.OutputRCBit());
692 } 731 }
693 break; 732 break;
694 #endif 733 #endif
695 case kPPC_Not32: 734 case kPPC_Not:
696 case kPPC_Not64:
697 __ notx(i.OutputRegister(), i.InputRegister(0), i.OutputRCBit()); 735 __ notx(i.OutputRegister(), i.InputRegister(0), i.OutputRCBit());
698 break; 736 break;
699 case kPPC_RotLeftAndMask32: 737 case kPPC_RotLeftAndMask32:
700 __ rlwinm(i.OutputRegister(), i.InputRegister(0), i.InputInt32(1), 738 __ rlwinm(i.OutputRegister(), i.InputRegister(0), i.InputInt32(1),
701 31 - i.InputInt32(2), 31 - i.InputInt32(3), i.OutputRCBit()); 739 31 - i.InputInt32(2), 31 - i.InputInt32(3), i.OutputRCBit());
702 break; 740 break;
703 #if V8_TARGET_ARCH_PPC64 741 #if V8_TARGET_ARCH_PPC64
704 case kPPC_RotLeftAndClear64: 742 case kPPC_RotLeftAndClear64:
705 __ rldic(i.OutputRegister(), i.InputRegister(0), i.InputInt32(1), 743 __ rldic(i.OutputRegister(), i.InputRegister(0), i.InputInt32(1),
706 63 - i.InputInt32(2), i.OutputRCBit()); 744 63 - i.InputInt32(2), i.OutputRCBit());
707 break; 745 break;
708 case kPPC_RotLeftAndClearLeft64: 746 case kPPC_RotLeftAndClearLeft64:
709 __ rldicl(i.OutputRegister(), i.InputRegister(0), i.InputInt32(1), 747 __ rldicl(i.OutputRegister(), i.InputRegister(0), i.InputInt32(1),
710 63 - i.InputInt32(2), i.OutputRCBit()); 748 63 - i.InputInt32(2), i.OutputRCBit());
711 break; 749 break;
712 case kPPC_RotLeftAndClearRight64: 750 case kPPC_RotLeftAndClearRight64:
713 __ rldicr(i.OutputRegister(), i.InputRegister(0), i.InputInt32(1), 751 __ rldicr(i.OutputRegister(), i.InputRegister(0), i.InputInt32(1),
714 63 - i.InputInt32(2), i.OutputRCBit()); 752 63 - i.InputInt32(2), i.OutputRCBit());
715 break; 753 break;
716 #endif 754 #endif
717 case kPPC_Add32: 755 case kPPC_Add:
718 case kPPC_Add64:
719 if (HasRegisterInput(instr, 1)) { 756 if (HasRegisterInput(instr, 1)) {
720 __ add(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1), 757 __ add(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1),
721 LeaveOE, i.OutputRCBit()); 758 LeaveOE, i.OutputRCBit());
722 } else { 759 } else {
723 __ addi(i.OutputRegister(), i.InputRegister(0), i.InputImmediate(1)); 760 __ addi(i.OutputRegister(), i.InputRegister(0), i.InputImmediate(1));
724 DCHECK_EQ(LeaveRC, i.OutputRCBit()); 761 DCHECK_EQ(LeaveRC, i.OutputRCBit());
725 } 762 }
726 break; 763 break;
727 case kPPC_AddWithOverflow32: 764 case kPPC_AddWithOverflow32:
728 ASSEMBLE_ADD_WITH_OVERFLOW(); 765 ASSEMBLE_ADD_WITH_OVERFLOW();
729 break; 766 break;
730 case kPPC_AddFloat64: 767 case kPPC_AddDouble:
731 ASSEMBLE_FLOAT_BINOP_RC(fadd); 768 ASSEMBLE_FLOAT_BINOP_RC(fadd);
732 break; 769 break;
733 case kPPC_Sub32: 770 case kPPC_Sub:
734 case kPPC_Sub64:
735 if (HasRegisterInput(instr, 1)) { 771 if (HasRegisterInput(instr, 1)) {
736 __ sub(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1), 772 __ sub(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1),
737 LeaveOE, i.OutputRCBit()); 773 LeaveOE, i.OutputRCBit());
738 } else { 774 } else {
739 __ subi(i.OutputRegister(), i.InputRegister(0), i.InputImmediate(1)); 775 __ subi(i.OutputRegister(), i.InputRegister(0), i.InputImmediate(1));
740 DCHECK_EQ(LeaveRC, i.OutputRCBit()); 776 DCHECK_EQ(LeaveRC, i.OutputRCBit());
741 } 777 }
742 break; 778 break;
743 case kPPC_SubWithOverflow32: 779 case kPPC_SubWithOverflow32:
744 ASSEMBLE_SUB_WITH_OVERFLOW(); 780 ASSEMBLE_SUB_WITH_OVERFLOW();
745 break; 781 break;
746 case kPPC_SubFloat64: 782 case kPPC_SubDouble:
747 ASSEMBLE_FLOAT_BINOP_RC(fsub); 783 ASSEMBLE_FLOAT_BINOP_RC(fsub);
748 break; 784 break;
749 case kPPC_Mul32: 785 case kPPC_Mul32:
750 __ mullw(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1), 786 __ mullw(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1),
751 LeaveOE, i.OutputRCBit()); 787 LeaveOE, i.OutputRCBit());
752 break; 788 break;
753 #if V8_TARGET_ARCH_PPC64 789 #if V8_TARGET_ARCH_PPC64
754 case kPPC_Mul64: 790 case kPPC_Mul64:
755 __ mulld(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1), 791 __ mulld(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1),
756 LeaveOE, i.OutputRCBit()); 792 LeaveOE, i.OutputRCBit());
757 break; 793 break;
758 #endif 794 #endif
759 case kPPC_MulHigh32: 795 case kPPC_MulHigh32:
760 __ mulhw(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1), 796 __ mulhw(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1),
761 i.OutputRCBit()); 797 i.OutputRCBit());
762 break; 798 break;
763 case kPPC_MulHighU32: 799 case kPPC_MulHighU32:
764 __ mulhwu(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1), 800 __ mulhwu(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1),
765 i.OutputRCBit()); 801 i.OutputRCBit());
766 break; 802 break;
767 case kPPC_MulFloat64: 803 case kPPC_MulDouble:
768 ASSEMBLE_FLOAT_BINOP_RC(fmul); 804 ASSEMBLE_FLOAT_BINOP_RC(fmul);
769 break; 805 break;
770 case kPPC_Div32: 806 case kPPC_Div32:
771 __ divw(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1)); 807 __ divw(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1));
772 DCHECK_EQ(LeaveRC, i.OutputRCBit()); 808 DCHECK_EQ(LeaveRC, i.OutputRCBit());
773 break; 809 break;
774 #if V8_TARGET_ARCH_PPC64 810 #if V8_TARGET_ARCH_PPC64
775 case kPPC_Div64: 811 case kPPC_Div64:
776 __ divd(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1)); 812 __ divd(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1));
777 DCHECK_EQ(LeaveRC, i.OutputRCBit()); 813 DCHECK_EQ(LeaveRC, i.OutputRCBit());
778 break; 814 break;
779 #endif 815 #endif
780 case kPPC_DivU32: 816 case kPPC_DivU32:
781 __ divwu(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1)); 817 __ divwu(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1));
782 DCHECK_EQ(LeaveRC, i.OutputRCBit()); 818 DCHECK_EQ(LeaveRC, i.OutputRCBit());
783 break; 819 break;
784 #if V8_TARGET_ARCH_PPC64 820 #if V8_TARGET_ARCH_PPC64
785 case kPPC_DivU64: 821 case kPPC_DivU64:
786 __ divdu(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1)); 822 __ divdu(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1));
787 DCHECK_EQ(LeaveRC, i.OutputRCBit()); 823 DCHECK_EQ(LeaveRC, i.OutputRCBit());
788 break; 824 break;
789 #endif 825 #endif
790 case kPPC_DivFloat64: 826 case kPPC_DivDouble:
791 ASSEMBLE_FLOAT_BINOP_RC(fdiv); 827 ASSEMBLE_FLOAT_BINOP_RC(fdiv);
792 break; 828 break;
793 case kPPC_Mod32: 829 case kPPC_Mod32:
794 ASSEMBLE_MODULO(divw, mullw); 830 ASSEMBLE_MODULO(divw, mullw);
795 break; 831 break;
796 #if V8_TARGET_ARCH_PPC64 832 #if V8_TARGET_ARCH_PPC64
797 case kPPC_Mod64: 833 case kPPC_Mod64:
798 ASSEMBLE_MODULO(divd, mulld); 834 ASSEMBLE_MODULO(divd, mulld);
799 break; 835 break;
800 #endif 836 #endif
801 case kPPC_ModU32: 837 case kPPC_ModU32:
802 ASSEMBLE_MODULO(divwu, mullw); 838 ASSEMBLE_MODULO(divwu, mullw);
803 break; 839 break;
804 #if V8_TARGET_ARCH_PPC64 840 #if V8_TARGET_ARCH_PPC64
805 case kPPC_ModU64: 841 case kPPC_ModU64:
806 ASSEMBLE_MODULO(divdu, mulld); 842 ASSEMBLE_MODULO(divdu, mulld);
807 break; 843 break;
808 #endif 844 #endif
809 case kPPC_ModFloat64: 845 case kPPC_ModDouble:
810 // TODO(bmeurer): We should really get rid of this special instruction, 846 // TODO(bmeurer): We should really get rid of this special instruction,
811 // and generate a CallAddress instruction instead. 847 // and generate a CallAddress instruction instead.
812 ASSEMBLE_FLOAT_MODULO(); 848 ASSEMBLE_FLOAT_MODULO();
813 break; 849 break;
814 case kPPC_Neg32: 850 case kPPC_Neg:
815 case kPPC_Neg64:
816 __ neg(i.OutputRegister(), i.InputRegister(0), LeaveOE, i.OutputRCBit()); 851 __ neg(i.OutputRegister(), i.InputRegister(0), LeaveOE, i.OutputRCBit());
817 break; 852 break;
818 case kPPC_MaxFloat64: 853 case kPPC_MaxDouble:
819 ASSEMBLE_FLOAT_MAX(kScratchDoubleReg); 854 ASSEMBLE_FLOAT_MAX(kScratchDoubleReg);
820 break; 855 break;
821 case kPPC_MinFloat64: 856 case kPPC_MinDouble:
822 ASSEMBLE_FLOAT_MIN(kScratchDoubleReg); 857 ASSEMBLE_FLOAT_MIN(kScratchDoubleReg);
823 break; 858 break;
824 case kPPC_SqrtFloat64: 859 case kPPC_SqrtDouble:
825 ASSEMBLE_FLOAT_UNOP_RC(fsqrt); 860 ASSEMBLE_FLOAT_UNOP_RC(fsqrt);
826 break; 861 break;
827 case kPPC_FloorFloat64: 862 case kPPC_FloorDouble:
828 ASSEMBLE_FLOAT_UNOP_RC(frim); 863 ASSEMBLE_FLOAT_UNOP_RC(frim);
829 break; 864 break;
830 case kPPC_CeilFloat64: 865 case kPPC_CeilDouble:
831 ASSEMBLE_FLOAT_UNOP_RC(frip); 866 ASSEMBLE_FLOAT_UNOP_RC(frip);
832 break; 867 break;
833 case kPPC_TruncateFloat64: 868 case kPPC_TruncateDouble:
834 ASSEMBLE_FLOAT_UNOP_RC(friz); 869 ASSEMBLE_FLOAT_UNOP_RC(friz);
835 break; 870 break;
836 case kPPC_RoundFloat64: 871 case kPPC_RoundDouble:
837 ASSEMBLE_FLOAT_UNOP_RC(frin); 872 ASSEMBLE_FLOAT_UNOP_RC(frin);
838 break; 873 break;
839 case kPPC_NegFloat64: 874 case kPPC_NegDouble:
840 ASSEMBLE_FLOAT_UNOP_RC(fneg); 875 ASSEMBLE_FLOAT_UNOP_RC(fneg);
841 break; 876 break;
842 case kPPC_Cntlz32: 877 case kPPC_Cntlz32:
843 __ cntlzw_(i.OutputRegister(), i.InputRegister(0)); 878 __ cntlzw_(i.OutputRegister(), i.InputRegister(0));
844 DCHECK_EQ(LeaveRC, i.OutputRCBit()); 879 DCHECK_EQ(LeaveRC, i.OutputRCBit());
845 break; 880 break;
846 case kPPC_Cmp32: 881 case kPPC_Cmp32:
847 ASSEMBLE_COMPARE(cmpw, cmplw); 882 ASSEMBLE_COMPARE(cmpw, cmplw);
848 break; 883 break;
849 #if V8_TARGET_ARCH_PPC64 884 #if V8_TARGET_ARCH_PPC64
850 case kPPC_Cmp64: 885 case kPPC_Cmp64:
851 ASSEMBLE_COMPARE(cmp, cmpl); 886 ASSEMBLE_COMPARE(cmp, cmpl);
852 break; 887 break;
853 #endif 888 #endif
854 case kPPC_CmpFloat64: 889 case kPPC_CmpDouble:
855 ASSEMBLE_FLOAT_COMPARE(fcmpu); 890 ASSEMBLE_FLOAT_COMPARE(fcmpu);
856 break; 891 break;
857 case kPPC_Tst32: 892 case kPPC_Tst32:
858 if (HasRegisterInput(instr, 1)) { 893 if (HasRegisterInput(instr, 1)) {
859 __ and_(r0, i.InputRegister(0), i.InputRegister(1), i.OutputRCBit()); 894 __ and_(r0, i.InputRegister(0), i.InputRegister(1), i.OutputRCBit());
860 } else { 895 } else {
861 __ andi(r0, i.InputRegister(0), i.InputImmediate(1)); 896 __ andi(r0, i.InputRegister(0), i.InputImmediate(1));
862 } 897 }
863 #if V8_TARGET_ARCH_PPC64 898 #if V8_TARGET_ARCH_PPC64
864 __ extsw(r0, r0, i.OutputRCBit()); 899 __ extsw(r0, r0, i.OutputRCBit());
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 // Zero extend 931 // Zero extend
897 __ clrldi(i.OutputRegister(), i.InputRegister(0), Operand(32)); 932 __ clrldi(i.OutputRegister(), i.InputRegister(0), Operand(32));
898 DCHECK_EQ(LeaveRC, i.OutputRCBit()); 933 DCHECK_EQ(LeaveRC, i.OutputRCBit());
899 break; 934 break;
900 case kPPC_Int64ToInt32: 935 case kPPC_Int64ToInt32:
901 // TODO(mbrandy): sign extend? 936 // TODO(mbrandy): sign extend?
902 __ Move(i.OutputRegister(), i.InputRegister(0)); 937 __ Move(i.OutputRegister(), i.InputRegister(0));
903 DCHECK_EQ(LeaveRC, i.OutputRCBit()); 938 DCHECK_EQ(LeaveRC, i.OutputRCBit());
904 break; 939 break;
905 #endif 940 #endif
906 case kPPC_Int32ToFloat64: 941 case kPPC_Int32ToDouble:
907 __ ConvertIntToDouble(i.InputRegister(0), i.OutputDoubleRegister()); 942 __ ConvertIntToDouble(i.InputRegister(0), i.OutputDoubleRegister());
908 DCHECK_EQ(LeaveRC, i.OutputRCBit()); 943 DCHECK_EQ(LeaveRC, i.OutputRCBit());
909 break; 944 break;
910 case kPPC_Uint32ToFloat64: 945 case kPPC_Uint32ToDouble:
911 __ ConvertUnsignedIntToDouble(i.InputRegister(0), 946 __ ConvertUnsignedIntToDouble(i.InputRegister(0),
912 i.OutputDoubleRegister()); 947 i.OutputDoubleRegister());
913 DCHECK_EQ(LeaveRC, i.OutputRCBit()); 948 DCHECK_EQ(LeaveRC, i.OutputRCBit());
914 break; 949 break;
915 case kPPC_Float64ToInt32: 950 case kPPC_DoubleToInt32:
916 case kPPC_Float64ToUint32: 951 case kPPC_DoubleToUint32:
917 __ ConvertDoubleToInt64(i.InputDoubleRegister(0), 952 __ ConvertDoubleToInt64(i.InputDoubleRegister(0),
918 #if !V8_TARGET_ARCH_PPC64 953 #if !V8_TARGET_ARCH_PPC64
919 kScratchReg, 954 kScratchReg,
920 #endif 955 #endif
921 i.OutputRegister(), kScratchDoubleReg); 956 i.OutputRegister(), kScratchDoubleReg);
922 DCHECK_EQ(LeaveRC, i.OutputRCBit()); 957 DCHECK_EQ(LeaveRC, i.OutputRCBit());
923 break; 958 break;
924 case kPPC_Float64ToFloat32: 959 case kPPC_DoubleToFloat32:
925 ASSEMBLE_FLOAT_UNOP_RC(frsp); 960 ASSEMBLE_FLOAT_UNOP_RC(frsp);
926 break; 961 break;
927 case kPPC_Float32ToFloat64: 962 case kPPC_Float32ToDouble:
928 // Nothing to do. 963 // Nothing to do.
929 __ Move(i.OutputDoubleRegister(), i.InputDoubleRegister(0)); 964 __ Move(i.OutputDoubleRegister(), i.InputDoubleRegister(0));
930 DCHECK_EQ(LeaveRC, i.OutputRCBit()); 965 DCHECK_EQ(LeaveRC, i.OutputRCBit());
931 break; 966 break;
932 case kPPC_Float64ExtractLowWord32: 967 case kPPC_DoubleExtractLowWord32:
933 __ MovDoubleLowToInt(i.OutputRegister(), i.InputDoubleRegister(0)); 968 __ MovDoubleLowToInt(i.OutputRegister(), i.InputDoubleRegister(0));
934 DCHECK_EQ(LeaveRC, i.OutputRCBit()); 969 DCHECK_EQ(LeaveRC, i.OutputRCBit());
935 break; 970 break;
936 case kPPC_Float64ExtractHighWord32: 971 case kPPC_DoubleExtractHighWord32:
937 __ MovDoubleHighToInt(i.OutputRegister(), i.InputDoubleRegister(0)); 972 __ MovDoubleHighToInt(i.OutputRegister(), i.InputDoubleRegister(0));
938 DCHECK_EQ(LeaveRC, i.OutputRCBit()); 973 DCHECK_EQ(LeaveRC, i.OutputRCBit());
939 break; 974 break;
940 case kPPC_Float64InsertLowWord32: 975 case kPPC_DoubleInsertLowWord32:
941 __ InsertDoubleLow(i.OutputDoubleRegister(), i.InputRegister(1), r0); 976 __ InsertDoubleLow(i.OutputDoubleRegister(), i.InputRegister(1), r0);
942 DCHECK_EQ(LeaveRC, i.OutputRCBit()); 977 DCHECK_EQ(LeaveRC, i.OutputRCBit());
943 break; 978 break;
944 case kPPC_Float64InsertHighWord32: 979 case kPPC_DoubleInsertHighWord32:
945 __ InsertDoubleHigh(i.OutputDoubleRegister(), i.InputRegister(1), r0); 980 __ InsertDoubleHigh(i.OutputDoubleRegister(), i.InputRegister(1), r0);
946 DCHECK_EQ(LeaveRC, i.OutputRCBit()); 981 DCHECK_EQ(LeaveRC, i.OutputRCBit());
947 break; 982 break;
948 case kPPC_Float64Construct: 983 case kPPC_DoubleConstruct:
949 #if V8_TARGET_ARCH_PPC64 984 #if V8_TARGET_ARCH_PPC64
950 __ MovInt64ComponentsToDouble(i.OutputDoubleRegister(), 985 __ MovInt64ComponentsToDouble(i.OutputDoubleRegister(),
951 i.InputRegister(0), i.InputRegister(1), r0); 986 i.InputRegister(0), i.InputRegister(1), r0);
952 #else 987 #else
953 __ MovInt64ToDouble(i.OutputDoubleRegister(), i.InputRegister(0), 988 __ MovInt64ToDouble(i.OutputDoubleRegister(), i.InputRegister(0),
954 i.InputRegister(1)); 989 i.InputRegister(1));
955 #endif 990 #endif
956 DCHECK_EQ(LeaveRC, i.OutputRCBit()); 991 DCHECK_EQ(LeaveRC, i.OutputRCBit());
957 break; 992 break;
958 case kPPC_LoadWordU8: 993 case kPPC_LoadWordU8:
(...skipping 13 matching lines...) Expand all
972 ASSEMBLE_LOAD_INTEGER(lwa, lwax); 1007 ASSEMBLE_LOAD_INTEGER(lwa, lwax);
973 break; 1008 break;
974 #if V8_TARGET_ARCH_PPC64 1009 #if V8_TARGET_ARCH_PPC64
975 case kPPC_LoadWord64: 1010 case kPPC_LoadWord64:
976 ASSEMBLE_LOAD_INTEGER(ld, ldx); 1011 ASSEMBLE_LOAD_INTEGER(ld, ldx);
977 break; 1012 break;
978 #endif 1013 #endif
979 case kPPC_LoadFloat32: 1014 case kPPC_LoadFloat32:
980 ASSEMBLE_LOAD_FLOAT(lfs, lfsx); 1015 ASSEMBLE_LOAD_FLOAT(lfs, lfsx);
981 break; 1016 break;
982 case kPPC_LoadFloat64: 1017 case kPPC_LoadDouble:
983 ASSEMBLE_LOAD_FLOAT(lfd, lfdx); 1018 ASSEMBLE_LOAD_FLOAT(lfd, lfdx);
984 break; 1019 break;
985 case kPPC_StoreWord8: 1020 case kPPC_StoreWord8:
986 ASSEMBLE_STORE_INTEGER(stb, stbx); 1021 ASSEMBLE_STORE_INTEGER(stb, stbx);
987 break; 1022 break;
988 case kPPC_StoreWord16: 1023 case kPPC_StoreWord16:
989 ASSEMBLE_STORE_INTEGER(sth, sthx); 1024 ASSEMBLE_STORE_INTEGER(sth, sthx);
990 break; 1025 break;
991 case kPPC_StoreWord32: 1026 case kPPC_StoreWord32:
992 ASSEMBLE_STORE_INTEGER(stw, stwx); 1027 ASSEMBLE_STORE_INTEGER(stw, stwx);
993 break; 1028 break;
994 #if V8_TARGET_ARCH_PPC64 1029 #if V8_TARGET_ARCH_PPC64
995 case kPPC_StoreWord64: 1030 case kPPC_StoreWord64:
996 ASSEMBLE_STORE_INTEGER(std, stdx); 1031 ASSEMBLE_STORE_INTEGER(std, stdx);
997 break; 1032 break;
998 #endif 1033 #endif
999 case kPPC_StoreFloat32: 1034 case kPPC_StoreFloat32:
1000 ASSEMBLE_STORE_FLOAT(stfs, stfsx); 1035 ASSEMBLE_STORE_FLOAT32();
1001 break; 1036 break;
1002 case kPPC_StoreFloat64: 1037 case kPPC_StoreDouble:
1003 ASSEMBLE_STORE_FLOAT(stfd, stfdx); 1038 ASSEMBLE_STORE_DOUBLE();
1004 break; 1039 break;
1005 case kPPC_StoreWriteBarrier: 1040 case kPPC_StoreWriteBarrier:
1006 ASSEMBLE_STORE_WRITE_BARRIER(); 1041 ASSEMBLE_STORE_WRITE_BARRIER();
1007 break; 1042 break;
1008 case kCheckedLoadInt8: 1043 case kCheckedLoadInt8:
1009 ASSEMBLE_CHECKED_LOAD_INTEGER(lbz, lbzx); 1044 ASSEMBLE_CHECKED_LOAD_INTEGER(lbz, lbzx);
1010 __ extsb(i.OutputRegister(), i.OutputRegister()); 1045 __ extsb(i.OutputRegister(), i.OutputRegister());
1011 break; 1046 break;
1012 case kCheckedLoadUint8: 1047 case kCheckedLoadUint8:
1013 ASSEMBLE_CHECKED_LOAD_INTEGER(lbz, lbzx); 1048 ASSEMBLE_CHECKED_LOAD_INTEGER(lbz, lbzx);
(...skipping 16 matching lines...) Expand all
1030 case kCheckedStoreWord8: 1065 case kCheckedStoreWord8:
1031 ASSEMBLE_CHECKED_STORE_INTEGER(stb, stbx); 1066 ASSEMBLE_CHECKED_STORE_INTEGER(stb, stbx);
1032 break; 1067 break;
1033 case kCheckedStoreWord16: 1068 case kCheckedStoreWord16:
1034 ASSEMBLE_CHECKED_STORE_INTEGER(sth, sthx); 1069 ASSEMBLE_CHECKED_STORE_INTEGER(sth, sthx);
1035 break; 1070 break;
1036 case kCheckedStoreWord32: 1071 case kCheckedStoreWord32:
1037 ASSEMBLE_CHECKED_STORE_INTEGER(stw, stwx); 1072 ASSEMBLE_CHECKED_STORE_INTEGER(stw, stwx);
1038 break; 1073 break;
1039 case kCheckedStoreFloat32: 1074 case kCheckedStoreFloat32:
1040 ASSEMBLE_CHECKED_STORE_FLOAT(stfs, stfsx); 1075 ASSEMBLE_CHECKED_STORE_FLOAT32();
1041 break; 1076 break;
1042 case kCheckedStoreFloat64: 1077 case kCheckedStoreFloat64:
1043 ASSEMBLE_CHECKED_STORE_FLOAT(stfd, stfdx); 1078 ASSEMBLE_CHECKED_STORE_DOUBLE();
1044 break; 1079 break;
1045 default: 1080 default:
1046 UNREACHABLE(); 1081 UNREACHABLE();
1047 break; 1082 break;
1048 } 1083 }
1049 } 1084 }
1050 1085
1051 1086
1052 // Assembles branches after an instruction. 1087 // Assembles branches after an instruction.
1053 void CodeGenerator::AssembleArchBranch(Instruction* instr, BranchInfo* branch) { 1088 void CodeGenerator::AssembleArchBranch(Instruction* instr, BranchInfo* branch) {
1054 PPCOperandConverter i(this, instr); 1089 PPCOperandConverter i(this, instr);
1055 Label* tlabel = branch->true_label; 1090 Label* tlabel = branch->true_label;
1056 Label* flabel = branch->false_label; 1091 Label* flabel = branch->false_label;
1057 ArchOpcode op = instr->arch_opcode(); 1092 ArchOpcode op = instr->arch_opcode();
1058 FlagsCondition condition = branch->condition; 1093 FlagsCondition condition = branch->condition;
1059 CRegister cr = cr0; 1094 CRegister cr = cr0;
1060 1095
1061 // Overflow checked for add/sub only. 1096 // Overflow checked for add/sub only.
1062 DCHECK((condition != kOverflow && condition != kNotOverflow) || 1097 DCHECK((condition != kOverflow && condition != kNotOverflow) ||
1063 (op == kPPC_AddWithOverflow32 || op == kPPC_SubWithOverflow32)); 1098 (op == kPPC_AddWithOverflow32 || op == kPPC_SubWithOverflow32));
1064 1099
1065 Condition cond = FlagsConditionToCondition(condition); 1100 Condition cond = FlagsConditionToCondition(condition);
1066 if (op == kPPC_CmpFloat64) { 1101 if (op == kPPC_CmpDouble) {
1067 // check for unordered if necessary 1102 // check for unordered if necessary
1068 if (cond == le) { 1103 if (cond == le) {
1069 __ bunordered(flabel, cr); 1104 __ bunordered(flabel, cr);
1070 // Unnecessary for eq/lt since only FU bit will be set. 1105 // Unnecessary for eq/lt since only FU bit will be set.
1071 } else if (cond == gt) { 1106 } else if (cond == gt) {
1072 __ bunordered(tlabel, cr); 1107 __ bunordered(tlabel, cr);
1073 // Unnecessary for ne/ge since only FU bit will be set. 1108 // Unnecessary for ne/ge since only FU bit will be set.
1074 } 1109 }
1075 } 1110 }
1076 __ b(cond, tlabel, cr); 1111 __ b(cond, tlabel, cr);
1077 if (!branch->fallthru) __ b(flabel); // no fallthru to flabel. 1112 if (!branch->fallthru) __ b(flabel); // no fallthru to flabel.
1078 } 1113 }
1079 1114
1080 1115
1081 void CodeGenerator::AssembleArchJump(RpoNumber target) { 1116 void CodeGenerator::AssembleArchJump(RpoNumber target) {
1082 if (!IsNextInAssemblyOrder(target)) __ b(GetLabel(target)); 1117 if (!IsNextInAssemblyOrder(target)) __ b(GetLabel(target));
1083 } 1118 }
1084 1119
1085 1120
1086 // Assembles boolean materializations after an instruction. 1121 // Assembles boolean materializations after an instruction.
1087 void CodeGenerator::AssembleArchBoolean(Instruction* instr, 1122 void CodeGenerator::AssembleArchBoolean(Instruction* instr,
1088 FlagsCondition condition) { 1123 FlagsCondition condition) {
1089 PPCOperandConverter i(this, instr); 1124 PPCOperandConverter i(this, instr);
1090 Label done; 1125 Label done;
1091 ArchOpcode op = instr->arch_opcode(); 1126 ArchOpcode op = instr->arch_opcode();
1092 bool check_unordered = (op == kPPC_CmpFloat64); 1127 bool check_unordered = (op == kPPC_CmpDouble);
1093 CRegister cr = cr0; 1128 CRegister cr = cr0;
1094 1129
1095 // Overflow checked for add/sub only. 1130 // Overflow checked for add/sub only.
1096 DCHECK((condition != kOverflow && condition != kNotOverflow) || 1131 DCHECK((condition != kOverflow && condition != kNotOverflow) ||
1097 (op == kPPC_AddWithOverflow32 || op == kPPC_SubWithOverflow32)); 1132 (op == kPPC_AddWithOverflow32 || op == kPPC_SubWithOverflow32));
1098 1133
1099 // Materialize a full 32-bit 1 or 0 value. The result register is always the 1134 // Materialize a full 32-bit 1 or 0 value. The result register is always the
1100 // last output of the instruction. 1135 // last output of the instruction.
1101 DCHECK_NE(0u, instr->OutputCount()); 1136 DCHECK_NE(0u, instr->OutputCount());
1102 Register reg = i.OutputRegister(instr->OutputCount() - 1); 1137 Register reg = i.OutputRegister(instr->OutputCount() - 1);
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
1452 } 1487 }
1453 } 1488 }
1454 MarkLazyDeoptSite(); 1489 MarkLazyDeoptSite();
1455 } 1490 }
1456 1491
1457 #undef __ 1492 #undef __
1458 1493
1459 } // namespace compiler 1494 } // namespace compiler
1460 } // namespace internal 1495 } // namespace internal
1461 } // namespace v8 1496 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/ppc/instruction-codes-ppc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698