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

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: Addressing review comments 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
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 3117 matching lines...) Expand 10 before | Expand all | Expand 10 after
3128 3128
3129 void TargetMIPS32::lowerPhi(const InstPhi * /*Instr*/) { 3129 void TargetMIPS32::lowerPhi(const InstPhi * /*Instr*/) {
3130 Func->setError("Phi found in regular instruction list"); 3130 Func->setError("Phi found in regular instruction list");
3131 } 3131 }
3132 3132
3133 void TargetMIPS32::lowerRet(const InstRet *Instr) { 3133 void TargetMIPS32::lowerRet(const InstRet *Instr) {
3134 Variable *Reg = nullptr; 3134 Variable *Reg = nullptr;
3135 if (Instr->hasRetValue()) { 3135 if (Instr->hasRetValue()) {
3136 Operand *Src0 = Instr->getRetValue(); 3136 Operand *Src0 = Instr->getRetValue();
3137 switch (Src0->getType()) { 3137 switch (Src0->getType()) {
3138 case IceType_f32: {
3139 Operand *Src0F = legalize(Src0, Legal_Reg);
Jim Stichnoth 2016/09/14 06:02:17 legalizeToReg(Src0) ? here and below
obucinac 2016/09/14 12:39:02 Done.
3140 Reg = makeReg(Src0F->getType(), RegMIPS32::Reg_F0);
3141 _mov(Reg, Src0F);
3142 break;
3143 }
3144 case IceType_f64: {
3145 Operand *Src0F = legalize(Src0, Legal_Reg);
3146 Reg = makeReg(Src0F->getType(), RegMIPS32::Reg_F0F1);
3147 _mov(Reg, Src0F);
3148 break;
3149 }
3138 case IceType_i1: 3150 case IceType_i1:
3139 case IceType_i8: 3151 case IceType_i8:
3140 case IceType_i16: 3152 case IceType_i16:
3141 case IceType_i32: { 3153 case IceType_i32: {
3142 // Reg = legalizeToReg(Src0, RegMIPS32::Reg_V0);
3143 Operand *Src0F = legalize(Src0, Legal_Reg); 3154 Operand *Src0F = legalize(Src0, Legal_Reg);
3144 Reg = makeReg(Src0F->getType(), RegMIPS32::Reg_V0); 3155 Reg = makeReg(Src0F->getType(), RegMIPS32::Reg_V0);
3145 _mov(Reg, Src0F); 3156 _mov(Reg, Src0F);
3146 break; 3157 break;
3147 } 3158 }
3148 case IceType_i64: { 3159 case IceType_i64: {
3149 Src0 = legalizeUndef(Src0); 3160 Src0 = legalizeUndef(Src0);
3150 Variable *R0 = legalizeToReg(loOperand(Src0), RegMIPS32::Reg_V0); 3161 Variable *R0 = legalizeToReg(loOperand(Src0), RegMIPS32::Reg_V0);
3151 Variable *R1 = legalizeToReg(hiOperand(Src0), RegMIPS32::Reg_V1); 3162 Variable *R1 = legalizeToReg(hiOperand(Src0), RegMIPS32::Reg_V1);
3152 Reg = R0; 3163 Reg = R0;
3153 Context.insert<InstFakeUse>(R1); 3164 Context.insert<InstFakeUse>(R1);
3154 break; 3165 break;
3155 } 3166 }
3156 default: 3167 default:
3157 UnimplementedLoweringError(this, Instr); 3168 UnimplementedLoweringError(this, Instr);
3158 } 3169 }
3159 } 3170 }
3160 _ret(getPhysicalRegister(RegMIPS32::Reg_RA), Reg); 3171 _ret(getPhysicalRegister(RegMIPS32::Reg_RA), Reg);
3161 } 3172 }
3162 3173
3163 void TargetMIPS32::lowerSelect(const InstSelect *Instr) { 3174 void TargetMIPS32::lowerSelect(const InstSelect *Instr) {
3164 UnimplementedLoweringError(this, Instr); 3175 Variable *Dest = Instr->getDest();
3176 const Type DestTy = Dest->getType();
3177
3178 if (DestTy == IceType_i64 || isVectorType(DestTy)) {
3179 UnimplementedLoweringError(this, Instr);
3180 return;
3181 }
3182
3183 Variable *DestR = legalizeToReg(Dest);
3184 Variable *SrcTR = legalizeToReg(Instr->getTrueOperand());
3185 Variable *SrcFR = legalizeToReg(Instr->getFalseOperand());
3186
3187 Variable *ConditionR = legalizeToReg(Instr->getCondition());
3188
3189 assert(Instr->getCondition()->getType() == IceType_i1);
3190
3191 switch (DestTy) {
3192 case IceType_i1:
3193 case IceType_i8:
3194 case IceType_i16:
3195 case IceType_i32:
3196 _movn(SrcFR, SrcTR, ConditionR);
3197 _mov(DestR, SrcFR);
3198 _mov(Dest, DestR);
3199 break;
3200 case IceType_f32:
3201 _movn_s(SrcFR, SrcTR, ConditionR);
3202 _mov(DestR, SrcFR);
3203 _mov(Dest, DestR);
3204 break;
3205 case IceType_f64:
3206 _movn_d(SrcFR, SrcTR, ConditionR);
3207 _mov(DestR, SrcFR);
3208 _mov(Dest, DestR);
3209 break;
3210 default:
3211 UnimplementedLoweringError(this, Instr);
3212 }
3165 } 3213 }
3166 3214
3167 void TargetMIPS32::lowerShuffleVector(const InstShuffleVector *Instr) { 3215 void TargetMIPS32::lowerShuffleVector(const InstShuffleVector *Instr) {
3168 UnimplementedLoweringError(this, Instr); 3216 UnimplementedLoweringError(this, Instr);
3169 } 3217 }
3170 3218
3171 void TargetMIPS32::lowerStore(const InstStore *Instr) { 3219 void TargetMIPS32::lowerStore(const InstStore *Instr) {
3172 Operand *Value = Instr->getData(); 3220 Operand *Value = Instr->getData();
3173 Operand *Addr = Instr->getAddr(); 3221 Operand *Addr = Instr->getAddr();
3174 OperandMIPS32Mem *NewAddr = formMemoryOperand(Addr, Value->getType()); 3222 OperandMIPS32Mem *NewAddr = formMemoryOperand(Addr, Value->getType());
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
3545 Str << "\t.set\t" 3593 Str << "\t.set\t"
3546 << "nomips16\n"; 3594 << "nomips16\n";
3547 } 3595 }
3548 3596
3549 SmallBitVector TargetMIPS32::TypeToRegisterSet[RCMIPS32_NUM]; 3597 SmallBitVector TargetMIPS32::TypeToRegisterSet[RCMIPS32_NUM];
3550 SmallBitVector TargetMIPS32::TypeToRegisterSetUnfiltered[RCMIPS32_NUM]; 3598 SmallBitVector TargetMIPS32::TypeToRegisterSetUnfiltered[RCMIPS32_NUM];
3551 SmallBitVector TargetMIPS32::RegisterAliases[RegMIPS32::Reg_NUM]; 3599 SmallBitVector TargetMIPS32::RegisterAliases[RegMIPS32::Reg_NUM];
3552 3600
3553 } // end of namespace MIPS32 3601 } // end of namespace MIPS32
3554 } // end of namespace Ice 3602 } // end of namespace Ice
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698