summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorNeil Booth <neil@daikokuya.co.uk>2007-10-07 11:45:55 +0000
committerNeil Booth <neil@daikokuya.co.uk>2007-10-07 11:45:55 +0000
commit5f00973393f24c093c5631b3a662cca54f777e49 (patch)
tree23358596dcd3b0a1dff45ad642f1dc9a43de2616 /llvm/lib
parentc330d008f48a3a7a396743f4cf4bdebbdafa8ba7 (diff)
downloadbcm5719-llvm-5f00973393f24c093c5631b3a662cca54f777e49.tar.gz
bcm5719-llvm-5f00973393f24c093c5631b3a662cca54f777e49.zip
convertFromInteger, as originally written, expected sign-extended
input. APInt unfortunately zero-extends signed integers, so Dale modified the function to expect zero-extended input. Make this assumption explicit in the function name. llvm-svn: 42732
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp4
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp2
-rw-r--r--llvm/lib/ExecutionEngine/ExecutionEngine.cpp4
-rw-r--r--llvm/lib/Support/APFloat.cpp10
-rw-r--r--llvm/lib/VMCore/ConstantFold.cpp2
5 files changed, 12 insertions, 10 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index a928968ef90..09f45d2ce7e 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -3234,8 +3234,8 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
const uint64_t zero[] = {0, 0};
APFloat apf = APFloat(APInt(MVT::getSizeInBits(VT), 2, zero));
uint64_t x = 1ULL << ShiftAmt;
- (void)apf.convertFromInteger(&x, MVT::getSizeInBits(NVT), false,
- APFloat::rmNearestTiesToEven);
+ (void)apf.convertFromZeroExtendedInteger
+ (&x, MVT::getSizeInBits(NVT), false, APFloat::rmNearestTiesToEven);
Tmp2 = DAG.getConstantFP(apf, VT);
Tmp3 = DAG.getSetCC(TLI.getSetCCResultTy(),
Node->getOperand(0), Tmp2, ISD::SETLT);
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 1e76435b07b..6a9b14907a0 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -1595,7 +1595,7 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT,
case ISD::SINT_TO_FP: {
const uint64_t zero[] = {0, 0};
APFloat apf = APFloat(APInt(MVT::getSizeInBits(VT), 2, zero));
- (void)apf.convertFromInteger(&Val,
+ (void)apf.convertFromZeroExtendedInteger(&Val,
MVT::getSizeInBits(Operand.getValueType()),
Opcode==ISD::SINT_TO_FP,
APFloat::rmNearestTiesToEven);
diff --git a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
index 61be35097b9..96604f10bcc 100644
--- a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
+++ b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
@@ -396,7 +396,7 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) {
else if (CE->getType() == Type::X86_FP80Ty) {
const uint64_t zero[] = {0, 0};
APFloat apf = APFloat(APInt(80, 2, zero));
- (void)apf.convertFromInteger(GV.IntVal.getRawData(),
+ (void)apf.convertFromZeroExtendedInteger(GV.IntVal.getRawData(),
GV.IntVal.getBitWidth(), false,
APFloat::rmNearestTiesToEven);
GV.IntVal = apf.convertToAPInt();
@@ -412,7 +412,7 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) {
else if (CE->getType() == Type::X86_FP80Ty) {
const uint64_t zero[] = { 0, 0};
APFloat apf = APFloat(APInt(80, 2, zero));
- (void)apf.convertFromInteger(GV.IntVal.getRawData(),
+ (void)apf.convertFromZeroExtendedInteger(GV.IntVal.getRawData(),
GV.IntVal.getBitWidth(), true,
APFloat::rmNearestTiesToEven);
GV.IntVal = apf.convertToAPInt();
diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp
index 2037210e05b..5e3504b19a5 100644
--- a/llvm/lib/Support/APFloat.cpp
+++ b/llvm/lib/Support/APFloat.cpp
@@ -1247,8 +1247,8 @@ APFloat::mod(const APFloat &rhs, roundingMode rounding_mode)
if (fs==opInvalidOp)
return fs;
- fs = V.convertFromInteger(x, parts * integerPartWidth, true,
- rmNearestTiesToEven);
+ fs = V.convertFromZeroExtendedInteger(x, parts * integerPartWidth, true,
+ rmNearestTiesToEven);
assert(fs==opOK); // should always work
fs = V.multiply(rhs, rounding_mode);
@@ -1576,9 +1576,11 @@ APFloat::convertFromUnsignedInteger(integerPart *parts,
return normalize(rounding_mode, lost_fraction);
}
+/* FIXME: should this just take a const APInt reference? */
APFloat::opStatus
-APFloat::convertFromInteger(const integerPart *parts, unsigned int width,
- bool isSigned, roundingMode rounding_mode)
+APFloat::convertFromZeroExtendedInteger(const integerPart *parts,
+ unsigned int width, bool isSigned,
+ roundingMode rounding_mode)
{
unsigned int partCount = partCountForBits(width);
opStatus status;
diff --git a/llvm/lib/VMCore/ConstantFold.cpp b/llvm/lib/VMCore/ConstantFold.cpp
index 72077db3780..8234900032c 100644
--- a/llvm/lib/VMCore/ConstantFold.cpp
+++ b/llvm/lib/VMCore/ConstantFold.cpp
@@ -216,7 +216,7 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, const Constant *V,
uint32_t BitWidth = cast<IntegerType>(SrcTy)->getBitWidth();
APFloat apf = APFloat(APInt(DestTy->getPrimitiveSizeInBits(),
2, zero));
- (void)apf.convertFromInteger(api.getRawData(), BitWidth,
+ (void)apf.convertFromZeroExtendedInteger(api.getRawData(), BitWidth,
opc==Instruction::SIToFP,
APFloat::rmNearestTiesToEven);
return ConstantFP::get(DestTy, apf);
OpenPOWER on IntegriCloud