Yet more APInt-ification.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47867 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman 2008-03-03 22:37:52 +00:00
parent 6c6cd1ccb5
commit 3370dd70ae

View File

@ -1161,7 +1161,7 @@ TargetLowering::SimplifySetCC(MVT::ValueType VT, SDOperand N0, SDOperand N1,
if (Op0Ty == ExtSrcTy) { if (Op0Ty == ExtSrcTy) {
ZextOp = N0.getOperand(0); ZextOp = N0.getOperand(0);
} else { } else {
int64_t Imm = ~0ULL >> (64-ExtSrcTyBits); APInt Imm = APInt::getLowBitsSet(ExtDstTyBits, ExtSrcTyBits);
ZextOp = DAG.getNode(ISD::AND, Op0Ty, N0.getOperand(0), ZextOp = DAG.getNode(ISD::AND, Op0Ty, N0.getOperand(0),
DAG.getConstant(Imm, Op0Ty)); DAG.getConstant(Imm, Op0Ty));
} }
@ -1220,17 +1220,14 @@ TargetLowering::SimplifySetCC(MVT::ValueType VT, SDOperand N0, SDOperand N1,
} }
} }
uint64_t MinVal, MaxVal; APInt MinVal, MaxVal;
unsigned OperandBitSize = MVT::getSizeInBits(N1C->getValueType(0)); unsigned OperandBitSize = MVT::getSizeInBits(N1C->getValueType(0));
if (ISD::isSignedIntSetCC(Cond)) { if (ISD::isSignedIntSetCC(Cond)) {
MinVal = 1ULL << (OperandBitSize-1); MinVal = APInt::getSignedMinValue(OperandBitSize);
if (OperandBitSize != 1) // Avoid X >> 64, which is undefined. MaxVal = APInt::getSignedMaxValue(OperandBitSize);
MaxVal = ~0ULL >> (65-OperandBitSize);
else
MaxVal = 0;
} else { } else {
MinVal = 0; MinVal = APInt::getMinValue(OperandBitSize);
MaxVal = ~0ULL >> (64-OperandBitSize); MaxVal = APInt::getMaxValue(OperandBitSize);
} }
// Canonicalize GE/LE comparisons to use GT/LT comparisons. // Canonicalize GE/LE comparisons to use GT/LT comparisons.