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

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, fix invalid condition in Mov::emitSingleDestSingleSource 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 3191 matching lines...) Expand 10 before | Expand all | Expand 10 after
3202 3202
3203 void TargetMIPS32::lowerPhi(const InstPhi * /*Instr*/) { 3203 void TargetMIPS32::lowerPhi(const InstPhi * /*Instr*/) {
3204 Func->setError("Phi found in regular instruction list"); 3204 Func->setError("Phi found in regular instruction list");
3205 } 3205 }
3206 3206
3207 void TargetMIPS32::lowerRet(const InstRet *Instr) { 3207 void TargetMIPS32::lowerRet(const InstRet *Instr) {
3208 Variable *Reg = nullptr; 3208 Variable *Reg = nullptr;
3209 if (Instr->hasRetValue()) { 3209 if (Instr->hasRetValue()) {
3210 Operand *Src0 = Instr->getRetValue(); 3210 Operand *Src0 = Instr->getRetValue();
3211 switch (Src0->getType()) { 3211 switch (Src0->getType()) {
3212 case IceType_f32: {
3213 Operand *Src0F = legalizeToReg(Src0);
3214 Reg = makeReg(Src0F->getType(), RegMIPS32::Reg_F0);
3215 _mov(Reg, Src0F);
3216 break;
3217 }
3218 case IceType_f64: {
3219 Operand *Src0F = legalizeToReg(Src0);
3220 Reg = makeReg(Src0F->getType(), RegMIPS32::Reg_F0F1);
3221 _mov(Reg, Src0F);
3222 break;
3223 }
3212 case IceType_i1: 3224 case IceType_i1:
3213 case IceType_i8: 3225 case IceType_i8:
3214 case IceType_i16: 3226 case IceType_i16:
3215 case IceType_i32: { 3227 case IceType_i32: {
3216 // Reg = legalizeToReg(Src0, RegMIPS32::Reg_V0); 3228 Operand *Src0F = legalizeToReg(Src0);
3217 Operand *Src0F = legalize(Src0, Legal_Reg);
3218 Reg = makeReg(Src0F->getType(), RegMIPS32::Reg_V0); 3229 Reg = makeReg(Src0F->getType(), RegMIPS32::Reg_V0);
3219 _mov(Reg, Src0F); 3230 _mov(Reg, Src0F);
3220 break; 3231 break;
3221 } 3232 }
3222 case IceType_i64: { 3233 case IceType_i64: {
3223 Src0 = legalizeUndef(Src0); 3234 Src0 = legalizeUndef(Src0);
3224 Variable *R0 = legalizeToReg(loOperand(Src0), RegMIPS32::Reg_V0); 3235 Variable *R0 = legalizeToReg(loOperand(Src0), RegMIPS32::Reg_V0);
3225 Variable *R1 = legalizeToReg(hiOperand(Src0), RegMIPS32::Reg_V1); 3236 Variable *R1 = legalizeToReg(hiOperand(Src0), RegMIPS32::Reg_V1);
3226 Reg = R0; 3237 Reg = R0;
3227 Context.insert<InstFakeUse>(R1); 3238 Context.insert<InstFakeUse>(R1);
3228 break; 3239 break;
3229 } 3240 }
3230 default: 3241 default:
3231 UnimplementedLoweringError(this, Instr); 3242 UnimplementedLoweringError(this, Instr);
3232 } 3243 }
3233 } 3244 }
3234 _ret(getPhysicalRegister(RegMIPS32::Reg_RA), Reg); 3245 _ret(getPhysicalRegister(RegMIPS32::Reg_RA), Reg);
3235 } 3246 }
3236 3247
3237 void TargetMIPS32::lowerSelect(const InstSelect *Instr) { 3248 void TargetMIPS32::lowerSelect(const InstSelect *Instr) {
3238 UnimplementedLoweringError(this, Instr); 3249 Variable *Dest = Instr->getDest();
3250 const Type DestTy = Dest->getType();
3251
3252 if (DestTy == IceType_i64 || isVectorType(DestTy)) {
3253 UnimplementedLoweringError(this, Instr);
3254 return;
3255 }
3256
3257 Variable *DestR = legalizeToReg(Dest);
3258 Variable *SrcTR = legalizeToReg(Instr->getTrueOperand());
3259 Variable *SrcFR = legalizeToReg(Instr->getFalseOperand());
3260
3261 Variable *ConditionR = legalizeToReg(Instr->getCondition());
3262
3263 assert(Instr->getCondition()->getType() == IceType_i1);
3264
3265 switch (DestTy) {
3266 case IceType_i1:
3267 case IceType_i8:
3268 case IceType_i16:
3269 case IceType_i32:
3270 _movn(SrcFR, SrcTR, ConditionR);
3271 _mov(DestR, SrcFR);
3272 _mov(Dest, DestR);
3273 break;
3274 case IceType_f32:
3275 _movn_s(SrcFR, SrcTR, ConditionR);
3276 _mov(DestR, SrcFR);
3277 _mov(Dest, DestR);
3278 break;
3279 case IceType_f64:
3280 _movn_d(SrcFR, SrcTR, ConditionR);
3281 _mov(DestR, SrcFR);
3282 _mov(Dest, DestR);
3283 break;
3284 default:
3285 UnimplementedLoweringError(this, Instr);
3286 }
3239 } 3287 }
3240 3288
3241 void TargetMIPS32::lowerShuffleVector(const InstShuffleVector *Instr) { 3289 void TargetMIPS32::lowerShuffleVector(const InstShuffleVector *Instr) {
3242 UnimplementedLoweringError(this, Instr); 3290 UnimplementedLoweringError(this, Instr);
3243 } 3291 }
3244 3292
3245 void TargetMIPS32::lowerStore(const InstStore *Instr) { 3293 void TargetMIPS32::lowerStore(const InstStore *Instr) {
3246 Operand *Value = Instr->getData(); 3294 Operand *Value = Instr->getData();
3247 Operand *Addr = Instr->getAddr(); 3295 Operand *Addr = Instr->getAddr();
3248 OperandMIPS32Mem *NewAddr = formMemoryOperand(Addr, Value->getType()); 3296 OperandMIPS32Mem *NewAddr = formMemoryOperand(Addr, Value->getType());
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
3619 Str << "\t.set\t" 3667 Str << "\t.set\t"
3620 << "nomips16\n"; 3668 << "nomips16\n";
3621 } 3669 }
3622 3670
3623 SmallBitVector TargetMIPS32::TypeToRegisterSet[RCMIPS32_NUM]; 3671 SmallBitVector TargetMIPS32::TypeToRegisterSet[RCMIPS32_NUM];
3624 SmallBitVector TargetMIPS32::TypeToRegisterSetUnfiltered[RCMIPS32_NUM]; 3672 SmallBitVector TargetMIPS32::TypeToRegisterSetUnfiltered[RCMIPS32_NUM];
3625 SmallBitVector TargetMIPS32::RegisterAliases[RegMIPS32::Reg_NUM]; 3673 SmallBitVector TargetMIPS32::RegisterAliases[RegMIPS32::Reg_NUM];
3626 3674
3627 } // end of namespace MIPS32 3675 } // end of namespace MIPS32
3628 } // end of namespace Ice 3676 } // end of namespace Ice
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698