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

Side by Side Diff: src/IceTargetLoweringMIPS32.cpp

Issue 1989303002: Subzero, MIPS32: Implements integer division instructions sdiv, udiv, srem, urem (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Workaround for DIV with three operands Created 4 years, 7 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 | « src/IceTargetLoweringMIPS32.h ('k') | tests_lit/llvm2ice_tests/arith.ll » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // 1 //
2 // The Subzero Code Generator 2 // The Subzero Code Generator
3 // 3 //
4 // This file is distributed under the University of Illinois Open Source 4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details. 5 // License. See LICENSE.TXT for details.
6 // 6 //
7 //===----------------------------------------------------------------------===// 7 //===----------------------------------------------------------------------===//
8 /// 8 ///
9 /// \file 9 /// \file
10 /// \brief Implements the TargetLoweringMIPS32 class, which consists almost 10 /// \brief Implements the TargetLoweringMIPS32 class, which consists almost
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 lowerInt64Arithmetic(Instr, Instr->getDest(), Src0, Src1); 685 lowerInt64Arithmetic(Instr, Instr->getDest(), Src0, Src1);
686 return; 686 return;
687 } 687 }
688 if (isVectorType(Dest->getType())) { 688 if (isVectorType(Dest->getType())) {
689 UnimplementedLoweringError(this, Instr); 689 UnimplementedLoweringError(this, Instr);
690 return; 690 return;
691 } 691 }
692 switch (Instr->getOp()) { 692 switch (Instr->getOp()) {
693 default: 693 default:
694 break; 694 break;
695 case InstArithmetic::Udiv:
696 case InstArithmetic::Sdiv:
697 case InstArithmetic::Urem:
698 case InstArithmetic::Srem:
699 case InstArithmetic::Fadd: 695 case InstArithmetic::Fadd:
700 case InstArithmetic::Fsub: 696 case InstArithmetic::Fsub:
701 case InstArithmetic::Fmul: 697 case InstArithmetic::Fmul:
702 case InstArithmetic::Fdiv: 698 case InstArithmetic::Fdiv:
703 case InstArithmetic::Frem: 699 case InstArithmetic::Frem:
704 UnimplementedLoweringError(this, Instr); 700 UnimplementedLoweringError(this, Instr);
705 return; 701 return;
706 } 702 }
707 703
708 // At this point Dest->getType() is non-i64 scalar 704 // At this point Dest->getType() is non-i64 scalar
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 case InstArithmetic::Lshr: { 743 case InstArithmetic::Lshr: {
748 _srlv(T, Src0R, Src1R); 744 _srlv(T, Src0R, Src1R);
749 _mov(Dest, T); 745 _mov(Dest, T);
750 return; 746 return;
751 } 747 }
752 case InstArithmetic::Ashr: { 748 case InstArithmetic::Ashr: {
753 _srav(T, Src0R, Src1R); 749 _srav(T, Src0R, Src1R);
754 _mov(Dest, T); 750 _mov(Dest, T);
755 return; 751 return;
756 } 752 }
757 case InstArithmetic::Udiv: 753 case InstArithmetic::Udiv: {
758 break; 754 auto *T_Zero = I32Reg(RegMIPS32::Reg_ZERO);
759 case InstArithmetic::Sdiv: 755 _divu(T_Zero, Src0R, Src1R);
760 break; 756 _mflo(T, T_Zero);
761 case InstArithmetic::Urem: 757 _mov(Dest, T);
762 break; 758 return;
763 case InstArithmetic::Srem: 759 }
764 break; 760 case InstArithmetic::Sdiv: {
761 auto *T_Zero = I32Reg(RegMIPS32::Reg_ZERO);
762 _div(T_Zero, Src0R, Src1R);
763 _mflo(T, T_Zero);
764 _mov(Dest, T);
765 return;
766 }
767 case InstArithmetic::Urem: {
768 auto *T_Zero = I32Reg(RegMIPS32::Reg_ZERO);
769 _divu(T_Zero, Src0R, Src1R);
770 _mfhi(T, T_Zero);
771 _mov(Dest, T);
772 return;
773 }
774 case InstArithmetic::Srem: {
775 auto *T_Zero = I32Reg(RegMIPS32::Reg_ZERO);
776 _div(T_Zero, Src0R, Src1R);
777 _mfhi(T, T_Zero);
778 _mov(Dest, T);
779 return;
780 }
765 case InstArithmetic::Fadd: 781 case InstArithmetic::Fadd:
766 break; 782 break;
767 case InstArithmetic::Fsub: 783 case InstArithmetic::Fsub:
768 break; 784 break;
769 case InstArithmetic::Fmul: 785 case InstArithmetic::Fmul:
770 break; 786 break;
771 case InstArithmetic::Fdiv: 787 case InstArithmetic::Fdiv:
772 break; 788 break;
773 case InstArithmetic::Frem: 789 case InstArithmetic::Frem:
774 break; 790 break;
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
1486 Str << "\t.set\t" 1502 Str << "\t.set\t"
1487 << "nomips16\n"; 1503 << "nomips16\n";
1488 } 1504 }
1489 1505
1490 SmallBitVector TargetMIPS32::TypeToRegisterSet[RCMIPS32_NUM]; 1506 SmallBitVector TargetMIPS32::TypeToRegisterSet[RCMIPS32_NUM];
1491 SmallBitVector TargetMIPS32::TypeToRegisterSetUnfiltered[RCMIPS32_NUM]; 1507 SmallBitVector TargetMIPS32::TypeToRegisterSetUnfiltered[RCMIPS32_NUM];
1492 SmallBitVector TargetMIPS32::RegisterAliases[RegMIPS32::Reg_NUM]; 1508 SmallBitVector TargetMIPS32::RegisterAliases[RegMIPS32::Reg_NUM];
1493 1509
1494 } // end of namespace MIPS32 1510 } // end of namespace MIPS32
1495 } // end of namespace Ice 1511 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceTargetLoweringMIPS32.h ('k') | tests_lit/llvm2ice_tests/arith.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698