summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-03-03 22:37:52 +0000
committerDan Gohman <gohman@apple.com>2008-03-03 22:37:52 +0000
commit0e238dc8132ff7ccd69c15d976908acbcd7f569e (patch)
tree61232f2016cba5217165798e787a8c233e7e3dd8 /llvm/lib/CodeGen
parent2fa65b7997830240ac41c1dd1ca258e1582db827 (diff)
downloadbcm5719-llvm-0e238dc8132ff7ccd69c15d976908acbcd7f569e.tar.gz
bcm5719-llvm-0e238dc8132ff7ccd69c15d976908acbcd7f569e.zip
Yet more APInt-ification.
llvm-svn: 47867
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index 26a34c0e563..02e3ed1cf8b 100644
--- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -1161,7 +1161,7 @@ TargetLowering::SimplifySetCC(MVT::ValueType VT, SDOperand N0, SDOperand N1,
if (Op0Ty == ExtSrcTy) {
ZextOp = N0.getOperand(0);
} else {
- int64_t Imm = ~0ULL >> (64-ExtSrcTyBits);
+ APInt Imm = APInt::getLowBitsSet(ExtDstTyBits, ExtSrcTyBits);
ZextOp = DAG.getNode(ISD::AND, Op0Ty, N0.getOperand(0),
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));
if (ISD::isSignedIntSetCC(Cond)) {
- MinVal = 1ULL << (OperandBitSize-1);
- if (OperandBitSize != 1) // Avoid X >> 64, which is undefined.
- MaxVal = ~0ULL >> (65-OperandBitSize);
- else
- MaxVal = 0;
+ MinVal = APInt::getSignedMinValue(OperandBitSize);
+ MaxVal = APInt::getSignedMaxValue(OperandBitSize);
} else {
- MinVal = 0;
- MaxVal = ~0ULL >> (64-OperandBitSize);
+ MinVal = APInt::getMinValue(OperandBitSize);
+ MaxVal = APInt::getMaxValue(OperandBitSize);
}
// Canonicalize GE/LE comparisons to use GT/LT comparisons.
OpenPOWER on IntegriCloud