summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorJay Foad <jay.foad@gmail.com>2010-11-28 21:04:48 +0000
committerJay Foad <jay.foad@gmail.com>2010-11-28 21:04:48 +0000
commit3447fb01c0bdb1dce159681cc81c1f8a891cb0a2 (patch)
tree3dbfec25d76aefef156227f5c7b4a448f58c8b33 /llvm/lib
parent7e8a99b1c3ed6dfb607400348bf9d5d70fba8f27 (diff)
downloadbcm5719-llvm-3447fb01c0bdb1dce159681cc81c1f8a891cb0a2.tar.gz
bcm5719-llvm-3447fb01c0bdb1dce159681cc81c1f8a891cb0a2.zip
PR5207: change APInt::doubleToBits() and APInt::floatToBits() to be
static methods that return a new APInt. llvm-svn: 120261
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/ExecutionEngine/ExecutionEngine.cpp4
-rw-r--r--llvm/lib/ExecutionEngine/Interpreter/Execution.cpp6
-rw-r--r--llvm/lib/Support/APFloat.cpp6
3 files changed, 6 insertions, 10 deletions
diff --git a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
index 91d68fb1e25..1f5711c4e4e 100644
--- a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
+++ b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
@@ -637,11 +637,11 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) {
break;
case Type::FloatTyID:
assert(DestTy->isIntegerTy(32) && "Invalid bitcast");
- GV.IntVal.floatToBits(GV.FloatVal);
+ GV.IntVal = APInt::floatToBits(GV.FloatVal);
break;
case Type::DoubleTyID:
assert(DestTy->isIntegerTy(64) && "Invalid bitcast");
- GV.IntVal.doubleToBits(GV.DoubleVal);
+ GV.IntVal = APInt::doubleToBits(GV.DoubleVal);
break;
case Type::PointerTyID:
assert(DestTy->isPointerTy() && "Invalid bitcast");
diff --git a/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp b/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
index 59ebe6e2a88..498063bf655 100644
--- a/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
+++ b/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
@@ -1060,11 +1060,9 @@ GenericValue Interpreter::executeBitCastInst(Value *SrcVal, const Type *DstTy,
Dest.PointerVal = Src.PointerVal;
} else if (DstTy->isIntegerTy()) {
if (SrcTy->isFloatTy()) {
- Dest.IntVal.zext(sizeof(Src.FloatVal) * CHAR_BIT);
- Dest.IntVal.floatToBits(Src.FloatVal);
+ Dest.IntVal = APInt::floatToBits(Src.FloatVal);
} else if (SrcTy->isDoubleTy()) {
- Dest.IntVal.zext(sizeof(Src.DoubleVal) * CHAR_BIT);
- Dest.IntVal.doubleToBits(Src.DoubleVal);
+ Dest.IntVal = APInt::doubleToBits(Src.DoubleVal);
} else if (SrcTy->isIntegerTy()) {
Dest.IntVal = Src.IntVal;
} else
diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp
index b87ddf9c95b..c0151e26fb1 100644
--- a/llvm/lib/Support/APFloat.cpp
+++ b/llvm/lib/Support/APFloat.cpp
@@ -3258,14 +3258,12 @@ APFloat::APFloat(const APInt& api, bool isIEEE)
APFloat::APFloat(float f)
{
- APInt api = APInt(32, 0);
- initFromAPInt(api.floatToBits(f));
+ initFromAPInt(APInt::floatToBits(f));
}
APFloat::APFloat(double d)
{
- APInt api = APInt(64, 0);
- initFromAPInt(api.doubleToBits(d));
+ initFromAPInt(APInt::doubleToBits(d));
}
namespace {
OpenPOWER on IntegriCloud