diff options
author | Craig Topper <craig.topper@intel.com> | 2018-11-19 07:22:26 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@intel.com> | 2018-11-19 07:22:26 +0000 |
commit | 8b22bcd39fc6db57d87202f4cc80ab9ecb9e1088 (patch) | |
tree | 81c5b2e40ab57a16f6119180c121bdf4a4a7c3f7 /llvm/lib | |
parent | 209cfbe60eb7cb4b21ef0b039df4662aec1bd76d (diff) | |
download | bcm5719-llvm-8b22bcd39fc6db57d87202f4cc80ab9ecb9e1088.tar.gz bcm5719-llvm-8b22bcd39fc6db57d87202f4cc80ab9ecb9e1088.zip |
[X86] Use a pcmpgt with 0 instead of psrad 31, to fill elements with the sign bit in v4i32 MULH lowering.
The shift requires a copy to avoid clobbering a register. Comparing with 0 uses an xor to produce 0 that will be overwritten with the compare results. So still requires 2 instructions, but should be one byte shorter since it doesn't need to encode an immediate.
llvm-svn: 347185
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index cf7d7a9b0d1..05b565304ae 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -23591,11 +23591,11 @@ static SDValue LowerMULH(SDValue Op, const X86Subtarget &Subtarget, // If we have a signed multiply but no PMULDQ fix up the result of an // unsigned multiply. if (IsSigned && !Subtarget.hasSSE41()) { - SDValue ShAmt = DAG.getConstant(31, dl, VT); + SDValue Zero = DAG.getConstant(0, dl, VT); SDValue T1 = DAG.getNode(ISD::AND, dl, VT, - DAG.getNode(ISD::SRA, dl, VT, A, ShAmt), B); + DAG.getSetCC(dl, VT, Zero, A, ISD::SETGT), B); SDValue T2 = DAG.getNode(ISD::AND, dl, VT, - DAG.getNode(ISD::SRA, dl, VT, B, ShAmt), A); + DAG.getSetCC(dl, VT, Zero, B, ISD::SETGT), A); SDValue Fixup = DAG.getNode(ISD::ADD, dl, VT, T1, T2); Res = DAG.getNode(ISD::SUB, dl, VT, Res, Fixup); |