Subzero: Fix lowering of the fabs() intrinsic.
The pand instruction for masking off the sign bit can operate on a register or an m128 memory location, but not a 32-bit or 64-bit memory location. This means we need to make sure f32 and f64 operands are first loaded into a register.
BUG= none
R=jvoung@chromium.org
Review URL: https://codereview.chromium.org/1022123004
diff --git a/src/IceTargetLoweringX8632.cpp b/src/IceTargetLoweringX8632.cpp
index 1cb079e..0a41cc8 100644
--- a/src/IceTargetLoweringX8632.cpp
+++ b/src/IceTargetLoweringX8632.cpp
@@ -3094,6 +3094,10 @@
Type Ty = Src->getType();
Variable *Dest = Instr->getDest();
Variable *T = makeVectorOfFabsMask(Ty);
+ // The pand instruction operates on an m128 memory operand, so if
+ // Src is an f32 or f64, we need to make sure it's in a register.
+ if (!isVectorType(Ty))
+ Src = legalizeToVar(Src);
_pand(T, Src);
if (isVectorType(Ty))
_movp(Dest, T);