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

Side by Side Diff: src/IceTargetLoweringMIPS32.cpp

Issue 2337023003: Subzero, MIPS32: lowerSelect for i1, i8, i16, i32, f32, f64 (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 4 years, 3 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/fp.cmp.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 2713 matching lines...) Expand 10 before | Expand all | Expand 10 after
2724 2724
2725 void TargetMIPS32::lowerPhi(const InstPhi * /*Instr*/) { 2725 void TargetMIPS32::lowerPhi(const InstPhi * /*Instr*/) {
2726 Func->setError("Phi found in regular instruction list"); 2726 Func->setError("Phi found in regular instruction list");
2727 } 2727 }
2728 2728
2729 void TargetMIPS32::lowerRet(const InstRet *Instr) { 2729 void TargetMIPS32::lowerRet(const InstRet *Instr) {
2730 Variable *Reg = nullptr; 2730 Variable *Reg = nullptr;
2731 if (Instr->hasRetValue()) { 2731 if (Instr->hasRetValue()) {
2732 Operand *Src0 = Instr->getRetValue(); 2732 Operand *Src0 = Instr->getRetValue();
2733 switch (Src0->getType()) { 2733 switch (Src0->getType()) {
2734 case IceType_f32: {
Jim Stichnoth 2016/09/13 13:56:22 What happens with an instruction like this? ret
obucinac 2016/09/13 17:26:18 Done.
2735 if (auto *Src0V = llvm::dyn_cast<Variable>(Src0)) {
2736 Reg = makeReg(Src0V->getType(), RegMIPS32::Reg_F0);
2737 _mov(Reg, Src0V);
2738 }
2739 break;
2740 }
2741 case IceType_f64: {
2742 if (auto *Src0V = llvm::dyn_cast<Variable>(Src0)) {
2743 Reg = makeReg(Src0V->getType(), RegMIPS32::Reg_F0F1);
2744 _mov(Reg, Src0V);
2745 }
2746 break;
2747 }
2734 case IceType_i1: 2748 case IceType_i1:
2735 case IceType_i8: 2749 case IceType_i8:
2736 case IceType_i16: 2750 case IceType_i16:
2737 case IceType_i32: { 2751 case IceType_i32: {
2738 // Reg = legalizeToReg(Src0, RegMIPS32::Reg_V0); 2752 // Reg = legalizeToReg(Src0, RegMIPS32::Reg_V0);
2739 Operand *Src0F = legalize(Src0, Legal_Reg); 2753 Operand *Src0F = legalize(Src0, Legal_Reg);
2740 Reg = makeReg(Src0F->getType(), RegMIPS32::Reg_V0); 2754 Reg = makeReg(Src0F->getType(), RegMIPS32::Reg_V0);
2741 _mov(Reg, Src0F); 2755 _mov(Reg, Src0F);
2742 break; 2756 break;
2743 } 2757 }
2744 case IceType_i64: { 2758 case IceType_i64: {
2745 Src0 = legalizeUndef(Src0); 2759 Src0 = legalizeUndef(Src0);
2746 Variable *R0 = legalizeToReg(loOperand(Src0), RegMIPS32::Reg_V0); 2760 Variable *R0 = legalizeToReg(loOperand(Src0), RegMIPS32::Reg_V0);
2747 Variable *R1 = legalizeToReg(hiOperand(Src0), RegMIPS32::Reg_V1); 2761 Variable *R1 = legalizeToReg(hiOperand(Src0), RegMIPS32::Reg_V1);
2748 Reg = R0; 2762 Reg = R0;
2749 Context.insert<InstFakeUse>(R1); 2763 Context.insert<InstFakeUse>(R1);
2750 break; 2764 break;
2751 } 2765 }
2752 default: 2766 default:
2753 UnimplementedLoweringError(this, Instr); 2767 UnimplementedLoweringError(this, Instr);
2754 } 2768 }
2755 } 2769 }
2756 _ret(getPhysicalRegister(RegMIPS32::Reg_RA), Reg); 2770 _ret(getPhysicalRegister(RegMIPS32::Reg_RA), Reg);
2757 } 2771 }
2758 2772
2759 void TargetMIPS32::lowerSelect(const InstSelect *Instr) { 2773 void TargetMIPS32::lowerSelect(const InstSelect *Instr) {
2760 UnimplementedLoweringError(this, Instr); 2774 Variable *Dest = Instr->getDest();
2775 Type DestTy = Dest->getType();
Jim Stichnoth 2016/09/13 13:56:22 const Type
obucinac 2016/09/13 17:26:18 Done.
2776
2777 if (DestTy == IceType_i64 || isVectorType(DestTy)) {
2778 UnimplementedLoweringError(this, Instr);
2779 return;
2780 }
2781
2782 Variable *DestR = legalizeToReg(Dest);
2783 Variable *SrcTR = legalizeToReg(Instr->getTrueOperand());
2784 Variable *SrcFR = legalizeToReg(Instr->getFalseOperand());
2785
2786 Variable *ConditionR = legalizeToReg(Instr->getCondition());
2787
2788 assert(Instr->getCondition()->getType() == IceType_i1);
2789
2790 switch (DestTy) {
2791 case IceType_i1:
2792 case IceType_i8:
2793 case IceType_i16:
2794 case IceType_i32:
2795 _movn(SrcFR, SrcTR, ConditionR);
Jim Stichnoth 2016/09/13 13:56:22 Have you tried running with "pnacl-sz -O2"? I sus
obucinac 2016/09/13 17:26:18 Checked, no problem here. O2 test added.
2796 _mov(DestR, SrcFR);
2797 _mov(Dest, DestR);
Jim Stichnoth 2016/09/13 13:56:22 Can you skip the previous _mov and just do _mov(
obucinac 2016/09/13 17:26:18 No. With previous changes, _mov handles only reg t
2798 break;
2799 case IceType_f32:
2800 _movn_s(SrcFR, SrcTR, ConditionR);
2801 _mov(DestR, SrcFR);
2802 _mov(Dest, DestR);
2803 break;
2804 case IceType_f64:
2805 _movn_d(SrcFR, SrcTR, ConditionR);
2806 _mov(DestR, SrcFR);
2807 _mov(Dest, DestR);
2808 break;
2809 default:
2810 UnimplementedLoweringError(this, Instr);
2811 }
2761 } 2812 }
2762 2813
2763 void TargetMIPS32::lowerShuffleVector(const InstShuffleVector *Instr) { 2814 void TargetMIPS32::lowerShuffleVector(const InstShuffleVector *Instr) {
2764 UnimplementedLoweringError(this, Instr); 2815 UnimplementedLoweringError(this, Instr);
2765 } 2816 }
2766 2817
2767 void TargetMIPS32::lowerStore(const InstStore *Instr) { 2818 void TargetMIPS32::lowerStore(const InstStore *Instr) {
2768 Operand *Value = Instr->getData(); 2819 Operand *Value = Instr->getData();
2769 Operand *Addr = Instr->getAddr(); 2820 Operand *Addr = Instr->getAddr();
2770 OperandMIPS32Mem *NewAddr = formMemoryOperand(Addr, Value->getType()); 2821 OperandMIPS32Mem *NewAddr = formMemoryOperand(Addr, Value->getType());
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
3131 Str << "\t.set\t" 3182 Str << "\t.set\t"
3132 << "nomips16\n"; 3183 << "nomips16\n";
3133 } 3184 }
3134 3185
3135 SmallBitVector TargetMIPS32::TypeToRegisterSet[RCMIPS32_NUM]; 3186 SmallBitVector TargetMIPS32::TypeToRegisterSet[RCMIPS32_NUM];
3136 SmallBitVector TargetMIPS32::TypeToRegisterSetUnfiltered[RCMIPS32_NUM]; 3187 SmallBitVector TargetMIPS32::TypeToRegisterSetUnfiltered[RCMIPS32_NUM];
3137 SmallBitVector TargetMIPS32::RegisterAliases[RegMIPS32::Reg_NUM]; 3188 SmallBitVector TargetMIPS32::RegisterAliases[RegMIPS32::Reg_NUM];
3138 3189
3139 } // end of namespace MIPS32 3190 } // end of namespace MIPS32
3140 } // end of namespace Ice 3191 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceTargetLoweringMIPS32.h ('k') | tests_lit/llvm2ice_tests/fp.cmp.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698