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

Unified Diff: src/IceTargetLoweringX8632.cpp

Issue 1022573004: Subzero: Add fabs intrinsic support. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review changes Created 5 years, 9 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') | src/assembler_ia32.h » ('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 42f513b2e6ece2964f267e214b422fcc2f9ce2dd..44bf7c955f0301e752e1dacc2474c0b164ce3490 100644
--- a/src/IceTargetLoweringX8632.cpp
+++ b/src/IceTargetLoweringX8632.cpp
@@ -3089,6 +3089,18 @@ void TargetX8632::lowerIntrinsicCall(const InstIntrinsicCall *Instr) {
SecondVal);
return;
}
+ case Intrinsics::Fabs: {
+ Operand *Src = legalize(Instr->getArg(0));
+ Type Ty = Src->getType();
+ Variable *Dest = Instr->getDest();
+ Variable *T = makeVectorOfFabsMask(Ty);
+ _pand(T, Src);
+ if (isVectorType(Ty))
+ _movp(Dest, T);
+ else
+ _mov(Dest, T);
+ return;
+ }
case Intrinsics::Longjmp: {
InstCall *Call = makeHelperCall(H_call_longjmp, nullptr, 2);
Call->addArg(Instr->getArg(0));
@@ -4362,6 +4374,18 @@ Variable *TargetX8632::makeVectorOfHighOrderBits(Type Ty, int32_t RegNum) {
}
}
+// Construct a mask in a register that can be and'ed with a
+// floating-point value to mask off its sign bit. The value will be
+// <4 x 0x7fffffff> for f32 and v4f32, and <2 x 0x7fffffffffffffff>
+// for f64. Construct it as vector of ones logically right shifted
+// one bit. TODO(stichnot): Fix the wala TODO above, to represent
+// vector constants in memory.
+Variable *TargetX8632::makeVectorOfFabsMask(Type Ty, int32_t RegNum) {
+ Variable *Reg = makeVectorOfMinusOnes(Ty, RegNum);
+ _psrl(Reg, Ctx->getConstantInt8(1));
+ return Reg;
+}
+
OperandX8632Mem *TargetX8632::getMemoryOperandForStackSlot(Type Ty,
Variable *Slot,
uint32_t Offset) {
« no previous file with comments | « src/IceTargetLoweringX8632.h ('k') | src/assembler_ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698