From 6e644736030f09fc9d613f1a6a9b4bd3a6947381 Mon Sep 17 00:00:00 2001 From: Dale Johannesen Date: Mon, 15 Oct 2007 01:05:37 +0000 Subject: [PATCH] Handle PPC long double in CBackend. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42972 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/CBackend/CBackend.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index 343d6d7a5fa..35205c6edb3 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -1505,6 +1505,7 @@ bool CWriter::doInitialization(Module &M) { << "typedef unsigned int ConstantFloatTy;\n" << "typedef struct { unsigned long long f1; unsigned short f2; " "unsigned short pad[3]; } ConstantFP80Ty;\n" + // This is used for both kinds of 128-bit long double; meaning differs. << "typedef struct { unsigned long long f1; unsigned long long f2; }" " ConstantFP128Ty;\n" << "\n\n/* Global Declarations */\n"; @@ -1737,6 +1738,14 @@ void CWriter::printFloatingPointConstants(Function &F) { << ((uint16_t)p[1] | (p[0] & 0xffffffffffffLL)<<16) << ", 0x" << (uint16_t)(p[0] >> 48) << ",0,0,0" << "}; /* Long double constant */\n" << std::dec; + } else if (FPC->getType() == Type::PPC_FP128Ty) { + APInt api = FPC->getValueAPF().convertToAPInt(); + const uint64_t *p = api.getRawData(); + Out << "static const ConstantFP128Ty FPConstant" << FPCounter++ + << " = { 0x" << std::hex + << p[0] << ", 0x" << p[1] + << "}; /* Long double constant */\n" << std::dec; + } else assert(0 && "Unknown float type!"); }