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

Unified Diff: src/IceTargetLoweringARM32.cpp

Issue 1683153003: ARM32 vector ops - scalarize icmp, fcmp and cast. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Adding tests for vector icmp and fcmp Created 4 years, 10 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
Index: src/IceTargetLoweringARM32.cpp
diff --git a/src/IceTargetLoweringARM32.cpp b/src/IceTargetLoweringARM32.cpp
index 1dde797887ef1542709398e405fd13f38d868e2a..15e7ab61b0950fa06e42b865e7cef42c60f6937a 100644
--- a/src/IceTargetLoweringARM32.cpp
+++ b/src/IceTargetLoweringARM32.cpp
@@ -575,8 +575,20 @@ void TargetARM32::genTargetHelperCallFor(Inst *Instr) {
Variable *Dest = Instr->getDest();
Operand *Src0 = Instr->getSrc(0);
const Type DestTy = Dest->getType();
- const InstCast::OpKind CastKind =
- llvm::cast<InstCast>(Instr)->getCastKind();
+ auto *CastInstr = llvm::cast<InstCast>(Instr);
+ const InstCast::OpKind CastKind = CastInstr->getCastKind();
+
+ if (isVectorType(DestTy)) {
+ scalarizeUnaryInstruction(Dest, Src0,
+ [this, CastKind](Variable *Dest,
+ Variable *Src) {
+ return Context.insert<InstCast>(CastKind,
+ Dest, Src);
+ });
+ CastInstr->setDeleted();
+ return;
+ }
+
switch (CastKind) {
default:
return;
@@ -721,6 +733,38 @@ void TargetARM32::genTargetHelperCallFor(Inst *Instr) {
}
llvm::report_fatal_error("Control flow should never have reached here.");
}
+ case Inst::Icmp: {
+ Variable *Dest = Instr->getDest();
+ const Type DestTy = Dest->getType();
+ if (isVectorType(DestTy)) {
+ auto *CmpInstr = llvm::cast<InstIcmp>(Instr);
+ const auto Condition = CmpInstr->getCondition();
+ scalarizeInstruction(Dest, CmpInstr->getSrc(0), CmpInstr->getSrc(1),
+ [this, Condition](Variable *Dest, Variable *Src0,
+ Variable *Src1) {
+ return Context.insert<InstIcmp>(Condition, Dest,
+ Src0, Src1);
+ });
+ CmpInstr->setDeleted();
+ }
+ return;
+ }
+ case Inst::Fcmp: {
+ Variable *Dest = Instr->getDest();
+ const Type DestTy = Dest->getType();
+ if (isVectorType(DestTy)) {
+ auto *CmpInstr = llvm::cast<InstFcmp>(Instr);
+ const auto Condition = CmpInstr->getCondition();
+ scalarizeInstruction(Dest, CmpInstr->getSrc(0), CmpInstr->getSrc(1),
+ [this, Condition](Variable *Dest, Variable *Src0,
+ Variable *Src1) {
+ return Context.insert<InstFcmp>(Condition, Dest,
+ Src0, Src1);
+ });
+ CmpInstr->setDeleted();
+ }
+ return;
+ }
}
}
@@ -4196,9 +4240,6 @@ TargetARM32::lowerInt8AndInt16IcmpCond(InstIcmp::ICond Condition, Operand *Src0,
}
TargetARM32::CondWhenTrue TargetARM32::lowerIcmpCond(const InstIcmp *Instr) {
- assert(Instr->getSrc(0)->getType() != IceType_i1);
- assert(Instr->getSrc(1)->getType() != IceType_i1);
-
Operand *Src0 = legalizeUndef(Instr->getSrc(0));
Operand *Src1 = legalizeUndef(Instr->getSrc(1));
@@ -4235,6 +4276,7 @@ TargetARM32::CondWhenTrue TargetARM32::lowerIcmpCond(const InstIcmp *Instr) {
switch (Src0->getType()) {
default:
llvm::report_fatal_error("Unhandled type in lowerIcmpCond");
+ case IceType_i1:
case IceType_i8:
case IceType_i16:
return lowerInt8AndInt16IcmpCond(Condition, Src0, Src1);

Powered by Google App Engine
This is Rietveld 408576698