diff options
author | Dale Johannesen <dalej@apple.com> | 2007-09-21 22:09:37 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@apple.com> | 2007-09-21 22:09:37 +0000 |
commit | a6f7974e97825e9575b5c5cf9f6665aef86cbe03 (patch) | |
tree | 3dbc8815c0b1b48e3bdaf73a2b46004c3827bbcf /lib/ExecutionEngine | |
parent | 058c67a070dea39e3c0282664f0e82b1346ae845 (diff) | |
download | external_llvm-a6f7974e97825e9575b5c5cf9f6665aef86cbe03.zip external_llvm-a6f7974e97825e9575b5c5cf9f6665aef86cbe03.tar.gz external_llvm-a6f7974e97825e9575b5c5cf9f6665aef86cbe03.tar.bz2 |
Change APFloat::convertFromInteger to take the incoming
bit width instead of number of words allocated, which
makes it actually work for int->APF conversions.
Adjust callers. Add const to one of the APInt constructors
to prevent surprising match when called with const
argument.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42210 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine')
-rw-r--r-- | lib/ExecutionEngine/ExecutionEngine.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/ExecutionEngine/ExecutionEngine.cpp b/lib/ExecutionEngine/ExecutionEngine.cpp index afff142..c72663e 100644 --- a/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/lib/ExecutionEngine/ExecutionEngine.cpp @@ -393,10 +393,11 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) { GV.FloatVal = float(GV.IntVal.roundToDouble()); else if (CE->getType() == Type::DoubleTy) GV.DoubleVal = GV.IntVal.roundToDouble(); - else if (CE->getType() == Type::X86_FP80Ty) { + 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(), 2, false, + (void)apf.convertFromInteger(GV.IntVal.getRawData(), + GV.IntVal.getBitWidth(), false, APFloat::rmTowardZero); GV.IntVal = apf.convertToAPInt(); } @@ -411,7 +412,8 @@ 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(), 2, true, + (void)apf.convertFromInteger(GV.IntVal.getRawData(), + GV.IntVal.getBitWidth(), true, APFloat::rmTowardZero); GV.IntVal = apf.convertToAPInt(); } |