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

Unified Diff: src/IceTargetLoweringX8632.cpp

Issue 389653002: Lower vector floating point arithmetic operations. (Closed) Base URL: https://gerrit.chromium.org/gerrit/p/native_client/pnacl-subzero.git@master
Patch Set: Avoid _movp() trickery Created 6 years, 5 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/IceTargetLoweringX8632.h ('k') | tests_lit/llvm2ice_tests/vector-arith.ll » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceTargetLoweringX8632.cpp
diff --git a/src/IceTargetLoweringX8632.cpp b/src/IceTargetLoweringX8632.cpp
index 2652e8bfd0e761666e9872378ce626ea72874cfb..f1b8c25097a151564c54f72d6190b7846d311cde 100644
--- a/src/IceTargetLoweringX8632.cpp
+++ b/src/IceTargetLoweringX8632.cpp
@@ -1136,7 +1136,59 @@ void TargetX8632::lowerArithmetic(const InstArithmetic *Inst) {
llvm_unreachable("FP instruction with i64 type");
break;
}
- } else { // Dest->getType() != IceType_i64
+ } else if (isVectorType(Dest->getType())) {
+ switch (Inst->getOp()) {
+ case InstArithmetic::_num:
+ llvm_unreachable("Unknown arithmetic operator");
+ break;
+ case InstArithmetic::Add:
+ case InstArithmetic::And:
+ case InstArithmetic::Or:
+ case InstArithmetic::Xor:
+ case InstArithmetic::Sub:
+ case InstArithmetic::Mul:
+ case InstArithmetic::Shl:
+ case InstArithmetic::Lshr:
+ case InstArithmetic::Ashr:
+ case InstArithmetic::Udiv:
+ case InstArithmetic::Sdiv:
+ case InstArithmetic::Urem:
+ case InstArithmetic::Srem:
+ // TODO(wala): Handle these.
+ Func->setError("Unhandled instruction");
+ break;
+ case InstArithmetic::Fadd: {
+ Variable *T = makeReg(Dest->getType());
Jim Stichnoth 2014/07/11 19:56:16 Since you're adding 4 new instances of this patter
+ _movp(T, Src0);
+ _addps(T, Src1);
+ _movp(Dest, T);
+ } break;
+ case InstArithmetic::Fsub: {
+ Variable *T = makeReg(Dest->getType());
+ _movp(T, Src0);
+ _subps(T, Src1);
+ _movp(Dest, T);
+ } break;
+ case InstArithmetic::Fmul: {
+ Variable *T = makeReg(Dest->getType());
+ _movp(T, Src0);
+ _mulps(T, Src1);
+ _movp(Dest, T);
+ } break;
+ case InstArithmetic::Fdiv: {
+ Variable *T = makeReg(Dest->getType());
+ _movp(T, Src0);
+ _divps(T, Src1);
+ _movp(Dest, T);
+ } break;
+ case InstArithmetic::Frem: {
+ const SizeT MaxSrcs = 1;
+ InstCall *Call = makeHelperCall("__frem_v4f32", Dest, MaxSrcs);
+ Call->addArg(Src0);
+ lowerCall(Call);
+ } break;
+ }
+ } else { // Dest->getType() is non-i64 scalar
Variable *T_edx = NULL;
Variable *T = NULL;
switch (Inst->getOp()) {
@@ -1454,7 +1506,7 @@ void TargetX8632::lowerCall(const InstCall *Instr) {
Inst *FakeUse = InstFakeUse::create(Func, ReturnReg);
Context.insert(FakeUse);
}
-
+
if (!Dest)
return;
« no previous file with comments | « src/IceTargetLoweringX8632.h ('k') | tests_lit/llvm2ice_tests/vector-arith.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698