diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2008-11-30 04:59:26 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2008-11-30 04:59:26 +0000 |
commit | 86f874d9bb3722e81381e832eb4c867f562e308c (patch) | |
tree | 5a4390cee5831cdcbe3d01e1c413b10734d1749a /lib/CodeGen/SelectionDAG/TargetLowering.cpp | |
parent | 13441c57ec1b7b6422b659ffadcf8ef82b69b4bd (diff) |
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
Diffstat (limited to 'lib/CodeGen/SelectionDAG/TargetLowering.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/TargetLowering.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
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) && |