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

Unified Diff: src/IceTargetLoweringARM32.cpp

Issue 1211243005: ARM: lowerSelect for integers. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceTargetLowering.cpp ('k') | tests_lit/llvm2ice_tests/64bit.pnacl.ll » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceTargetLoweringARM32.cpp
diff --git a/src/IceTargetLoweringARM32.cpp b/src/IceTargetLoweringARM32.cpp
index b1081b3f1ef80e1f278788880ba81e7743f5d1e7..fad9bcf3ad4c18a873239124e53eb2a357d344cc 100644
--- a/src/IceTargetLoweringARM32.cpp
+++ b/src/IceTargetLoweringARM32.cpp
@@ -2009,8 +2009,51 @@ void TargetARM32::lowerRet(const InstRet *Inst) {
}
void TargetARM32::lowerSelect(const InstSelect *Inst) {
- (void)Inst;
- UnimplementedError(Func->getContext()->getFlags());
+ Variable *Dest = Inst->getDest();
+ Type DestTy = Dest->getType();
+ Operand *SrcT = Inst->getTrueOperand();
+ Operand *SrcF = Inst->getFalseOperand();
+ Operand *Condition = Inst->getCondition();
+
+ if (isVectorType(DestTy)) {
+ UnimplementedError(Func->getContext()->getFlags());
+ return;
+ }
+ if (isFloatingType(DestTy)) {
+ UnimplementedError(Func->getContext()->getFlags());
+ return;
+ }
+ // TODO(jvoung): handle folding opportunities.
+ // cmp cond, #0; mov t, SrcF; mov_cond t, SrcT; mov dest, t
+ Variable *CmpOpnd0 = legalizeToVar(Condition);
+ Operand *CmpOpnd1 = Ctx->getConstantZero(IceType_i32);
+ _cmp(CmpOpnd0, CmpOpnd1);
+ CondARM32::Cond Cond = CondARM32::NE;
+ if (DestTy == IceType_i64) {
+ // Set the low portion.
+ Variable *DestLo = llvm::cast<Variable>(loOperand(Dest));
+ Variable *TLo = nullptr;
+ Operand *SrcFLo = legalize(loOperand(SrcF), Legal_Reg | Legal_Flex);
+ _mov(TLo, SrcFLo);
+ Operand *SrcTLo = legalize(loOperand(SrcT), Legal_Reg | Legal_Flex);
+ _mov_nonkillable(TLo, SrcTLo, Cond);
+ _mov(DestLo, TLo);
+ // Set the high portion.
+ Variable *DestHi = llvm::cast<Variable>(hiOperand(Dest));
+ Variable *THi = nullptr;
+ Operand *SrcFHi = legalize(hiOperand(SrcF), Legal_Reg | Legal_Flex);
+ _mov(THi, SrcFHi);
+ Operand *SrcTHi = legalize(hiOperand(SrcT), Legal_Reg | Legal_Flex);
+ _mov_nonkillable(THi, SrcTHi, Cond);
+ _mov(DestHi, THi);
+ return;
+ }
+ Variable *T = nullptr;
+ SrcF = legalize(SrcF, Legal_Reg | Legal_Flex);
+ _mov(T, SrcF);
+ SrcT = legalize(SrcT, Legal_Reg | Legal_Flex);
+ _mov_nonkillable(T, SrcT, Cond);
+ _mov(Dest, T);
}
void TargetARM32::lowerStore(const InstStore *Inst) {
@@ -2057,7 +2100,7 @@ void TargetARM32::lowerSwitch(const InstSwitch *Inst) {
_br(Inst->getLabelDefault());
return;
}
-
+
// 32 bit integer
Variable *Src0Var = legalizeToVar(Src0);
for (SizeT I = 0; I < NumCases; ++I) {
« no previous file with comments | « src/IceTargetLowering.cpp ('k') | tests_lit/llvm2ice_tests/64bit.pnacl.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698