[llvm-commits] [llvm] r47867 - /llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
Dan Gohman
gohman at apple.com
Mon Mar 3 14:37:52 PST 2008
Author: djg
Date: Mon Mar 3 16:37:52 2008
New Revision: 47867
URL: http://llvm.org/viewvc/llvm-project?rev=47867&view=rev
Log:
Yet more APInt-ification.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp?rev=47867&r1=47866&r2=47867&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp Mon Mar 3 16:37:52 2008
@@ -1161,7 +1161,7 @@
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 @@
}
}
- 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.
More information about the llvm-commits
mailing list