From 86f874d9bb3722e81381e832eb4c867f562e308c Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Sun, 30 Nov 2008 04:59:26 +0000 Subject: APIntify a test which is potentially unsafe otherwise, and fix the nearby FIXME. I'm not sure what the right way to fix the Cell test was; if the approach I used isn't okay, please let me know. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60277 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/SelectionDAG/TargetLowering.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'lib/CodeGen/SelectionDAG/TargetLowering.cpp') diff --git a/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/lib/CodeGen/SelectionDAG/TargetLowering.cpp index 01977908be..4d8b9be44f 100644 --- a/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -1583,12 +1583,19 @@ TargetLowering::SimplifySetCC(MVT VT, SDValue N0, SDValue N1, // by changing cc. // SETUGT X, SINTMAX -> SETLT X, 0 - if (Cond == ISD::SETUGT && OperandBitSize != 1 && - C1 == (~0ULL >> (65-OperandBitSize))) + if (Cond == ISD::SETUGT && + C1 == APInt::getSignedMaxValue(OperandBitSize)) return DAG.getSetCC(VT, N0, DAG.getConstant(0, N1.getValueType()), ISD::SETLT); - // FIXME: Implement the rest of these. + // SETULT X, SINTMIN -> SETGT X, -1 + if (Cond == ISD::SETULT && + C1 == APInt::getSignedMinValue(OperandBitSize)) { + SDValue ConstMinusOne = + DAG.getConstant(APInt::getAllOnesValue(OperandBitSize), + N1.getValueType()); + return DAG.getSetCC(VT, N0, ConstMinusOne, ISD::SETGT); + } // Fold bit comparisons when we can. if ((Cond == ISD::SETEQ || Cond == ISD::SETNE) && -- cgit v1.2.3-18-g5258