diff options
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index dd694281521..217c0e6ce48 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -33508,6 +33508,25 @@ bool X86TargetLowering::SimplifyDemandedBitsForTargetNode( } break; } + case X86ISD::PACKSS: + // PACKSS saturates to MIN/MAX integer values. So if we just want the + // sign bit then we can just ask for the source operands sign bit. + // TODO - add known bits handling. + if (OriginalDemandedBits.isSignMask()) { + APInt DemandedLHS, DemandedRHS; + getPackDemandedElts(VT, OriginalDemandedElts, DemandedLHS, DemandedRHS); + + KnownBits KnownLHS, KnownRHS; + APInt SignMask = APInt::getSignMask(BitWidth * 2); + if (SimplifyDemandedBits(Op.getOperand(0), SignMask, DemandedLHS, + KnownLHS, TLO, Depth + 1)) + return true; + if (SimplifyDemandedBits(Op.getOperand(1), SignMask, DemandedRHS, + KnownRHS, TLO, Depth + 1)) + return true; + } + // TODO - add general PACKSS/PACKUS SimplifyDemandedBits support. + break; case X86ISD::PCMPGT: // icmp sgt(0, R) == ashr(R, BitWidth-1). // iff we only need the sign bit then we can use R directly. |

