From 3f6eb7419de437436265831fce92f62498556e08 Mon Sep 17 00:00:00 2001 From: Dale Johannesen Date: Tue, 11 Sep 2007 18:32:33 +0000 Subject: Add APInt interfaces to APFloat (allows directly access to bits). Use them in place of float and double interfaces where appropriate. First bits of x86 long double constants handling (untested, probably does not work). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41858 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/CBackend/CBackend.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lib/Target/CBackend/CBackend.cpp') diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index 0221174..f25b113 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -1715,13 +1715,16 @@ void CWriter::printFloatingPointConstants(Function &F) { if (FPC->getType() == Type::DoubleTy) { double Val = FPC->getValueAPF().convertToDouble(); + uint64_t i = *FPC->getValueAPF().convertToAPInt().getRawData(); Out << "static const ConstantDoubleTy FPConstant" << FPCounter++ - << " = 0x" << std::hex << DoubleToBits(Val) << std::dec + << " = 0x" << std::hex << i << std::dec << "ULL; /* " << Val << " */\n"; } else if (FPC->getType() == Type::FloatTy) { float Val = FPC->getValueAPF().convertToFloat(); + uint32_t i = (uint32_t)*FPC->getValueAPF().convertToAPInt(). + getRawData(); Out << "static const ConstantFloatTy FPConstant" << FPCounter++ - << " = 0x" << std::hex << FloatToBits(Val) << std::dec + << " = 0x" << std::hex << i << std::dec << "U; /* " << Val << " */\n"; } else assert(0 && "Unknown float type!"); -- cgit v1.1