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

Unified Diff: src/IceTargetLowering.cpp

Issue 1681003002: ARM32 vector division lowering. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: 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
« no previous file with comments | « src/IceTargetLowering.h ('k') | src/IceTargetLoweringARM32.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceTargetLowering.cpp
diff --git a/src/IceTargetLowering.cpp b/src/IceTargetLowering.cpp
index d53fbab4e12a01d8179d97bbc3cce298e7ac7fc8..75886d6dd8997693d240c6e878ec52f416402358 100644
--- a/src/IceTargetLowering.cpp
+++ b/src/IceTargetLowering.cpp
@@ -700,6 +700,39 @@ bool TargetLowering::shouldOptimizeMemIntrins() {
Ctx->getFlags().getForceMemIntrinOpt();
}
+void TargetLowering::scalarizeArithmetic(InstArithmetic::OpKind Kind,
+ Variable *Dest, Operand *Src0,
+ Operand *Src1) {
+ assert(isVectorType(Dest->getType()));
+ Type Ty = Dest->getType();
+ Type ElementTy = typeElementType(Ty);
+ SizeT NumElements = typeNumElements(Ty);
+
+ Operand *T = Ctx->getConstantUndef(Ty);
+ for (SizeT I = 0; I < NumElements; ++I) {
+ Constant *Index = Ctx->getConstantInt32(I);
+
+ // Extract the next two inputs.
+ Variable *Op0 = Func->makeVariable(ElementTy);
+ Context.insert<InstExtractElement>(Op0, Src0, Index);
+ Variable *Op1 = Func->makeVariable(ElementTy);
+ Context.insert<InstExtractElement>(Op1, Src1, Index);
+
+ // Perform the arithmetic as a scalar operation.
+ Variable *Res = Func->makeVariable(ElementTy);
+ auto *Arith = Context.insert<InstArithmetic>(Kind, Res, Op0, Op1);
+ // We might have created an operation that needed a helper call.
+ genTargetHelperCallFor(Arith);
+
+ // Insert the result into position.
+ Variable *DestT = Func->makeVariable(Ty);
+ Context.insert<InstInsertElement>(DestT, T, Res, Index);
+ T = DestT;
+ }
+
+ Context.insert<InstAssign>(Dest, T);
+}
+
void TargetLowering::emitWithoutPrefix(const ConstantRelocatable *C,
const char *Suffix) const {
if (!BuildDefs::dump())
« no previous file with comments | « src/IceTargetLowering.h ('k') | src/IceTargetLoweringARM32.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698