[llvm-commits] [llvm] r42732 - in /llvm/trunk: include/llvm/ADT/APFloat.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/ExecutionEngine/ExecutionEngine.cpp lib/Support/APFloat.cpp lib/VMCore/ConstantFold.cpp
Neil Booth
neil at daikokuya.co.uk
Sun Oct 7 04:45:58 PDT 2007
Author: neil
Date: Sun Oct 7 06:45:55 2007
New Revision: 42732
URL: http://llvm.org/viewvc/llvm-project?rev=42732&view=rev
Log:
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.
Modified:
llvm/trunk/include/llvm/ADT/APFloat.h
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
llvm/trunk/lib/Support/APFloat.cpp
llvm/trunk/lib/VMCore/ConstantFold.cpp
Modified: llvm/trunk/include/llvm/ADT/APFloat.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APFloat.h?rev=42732&r1=42731&r2=42732&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/APFloat.h (original)
+++ llvm/trunk/include/llvm/ADT/APFloat.h Sun Oct 7 06:45:55 2007
@@ -194,8 +194,8 @@
opStatus convert(const fltSemantics &, roundingMode);
opStatus convertToInteger(integerPart *, unsigned int, bool,
roundingMode) const;
- opStatus convertFromInteger(const integerPart *, unsigned int, bool,
- roundingMode);
+ opStatus convertFromZeroExtendedInteger(const integerPart *, unsigned int,
+ bool, roundingMode);
opStatus convertFromString(const char *, roundingMode);
APInt convertToAPInt() const;
double convertToDouble() const;
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=42732&r1=42731&r2=42732&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Sun Oct 7 06:45:55 2007
@@ -3234,8 +3234,8 @@
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);
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=42732&r1=42731&r2=42732&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sun Oct 7 06:45:55 2007
@@ -1595,7 +1595,7 @@
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);
Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp?rev=42732&r1=42731&r2=42732&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Sun Oct 7 06:45:55 2007
@@ -396,7 +396,7 @@
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 @@
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();
Modified: llvm/trunk/lib/Support/APFloat.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APFloat.cpp?rev=42732&r1=42731&r2=42732&view=diff
==============================================================================
--- llvm/trunk/lib/Support/APFloat.cpp (original)
+++ llvm/trunk/lib/Support/APFloat.cpp Sun Oct 7 06:45:55 2007
@@ -1247,8 +1247,8 @@
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 @@
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;
Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantFold.cpp?rev=42732&r1=42731&r2=42732&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/ConstantFold.cpp (original)
+++ llvm/trunk/lib/VMCore/ConstantFold.cpp Sun Oct 7 06:45:55 2007
@@ -216,7 +216,7 @@
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);
More information about the llvm-commits
mailing list