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

Unified Diff: src/IceTargetLoweringARM32.cpp

Issue 1886263004: Subzero. ARM32. Implements vector select. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Addresses comments. Created 4 years, 8 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/IceTargetLoweringARM32.h ('k') | tests_lit/assembler/arm32/select-vec.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 b8fa3b684715cff7f043c50973ab870d982c7d75..3de321e23ea0cf4800d4f418d5b5b4df01ea45e8 100644
--- a/src/IceTargetLoweringARM32.cpp
+++ b/src/IceTargetLoweringARM32.cpp
@@ -861,24 +861,6 @@ void TargetARM32::genTargetHelperCallFor(Inst *Instr) {
}
return;
}
- case Inst::Select: {
- Variable *Dest = Instr->getDest();
- const auto DestTy = Dest->getType();
- if (isVectorType(DestTy)) {
- auto *SelectInstr = llvm::cast<InstSelect>(Instr);
- scalarizeInstruction(Dest,
- [this](Variable *Dest, Variable *Src0,
- Variable *Src1, Variable *Src2) {
- return Context.insert<InstSelect>(Dest, Src0, Src1,
- Src2);
- },
- llvm::cast<Variable>(SelectInstr->getSrc(0)),
- llvm::cast<Variable>(SelectInstr->getSrc(1)),
- llvm::cast<Variable>(SelectInstr->getSrc(2)));
- SelectInstr->setDeleted();
- }
- return;
- }
}
}
@@ -5727,12 +5709,39 @@ void TargetARM32::lowerSelect(const InstSelect *Instr) {
Operand *SrcF = Instr->getFalseOperand();
Operand *Condition = Instr->getCondition();
- if (isVectorType(DestTy)) {
- UnimplementedLoweringError(this, Instr);
+ if (!isVectorType(DestTy)) {
+ lowerInt1ForSelect(Dest, Condition, legalizeUndef(SrcT),
+ legalizeUndef(SrcF));
return;
}
- lowerInt1ForSelect(Dest, Condition, legalizeUndef(SrcT), legalizeUndef(SrcF));
+ Type TType = DestTy;
+ switch (DestTy) {
+ default:
+ llvm::report_fatal_error("Unexpected type for vector select.");
+ case IceType_v4i1:
+ TType = IceType_v4i32;
+ break;
+ case IceType_v8i1:
+ TType = IceType_v8i16;
+ break;
+ case IceType_v16i1:
+ TType = IceType_v16i8;
+ break;
+ case IceType_v4f32:
+ TType = IceType_v4i32;
+ break;
+ case IceType_v4i32:
+ case IceType_v8i16:
+ case IceType_v16i8:
+ break;
+ }
+ auto *T = makeReg(TType);
+ lowerCast(InstCast::create(Func, InstCast::Sext, T, Condition));
+ auto *SrcTR = legalizeToReg(SrcT);
+ auto *SrcFR = legalizeToReg(SrcF);
+ _vbsl(T, SrcTR, SrcFR)->setDestRedefined();
+ _mov(Dest, T);
}
void TargetARM32::lowerStore(const InstStore *Instr) {
« no previous file with comments | « src/IceTargetLoweringARM32.h ('k') | tests_lit/assembler/arm32/select-vec.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698