[llvm-commits] [llvm-gcc-4.0] r42872 - in /llvm-gcc-4.0/trunk/gcc: llvm-convert.cpp llvm-types.cpp
Dale Johannesen
dalej at apple.com
Thu Oct 11 12:41:40 PDT 2007
Author: johannes
Date: Thu Oct 11 14:41:40 2007
New Revision: 42872
URL: http://llvm.org/viewvc/llvm-project?rev=42872&view=rev
Log:
Emit PPC long doubles correctly (they aren't
actually generated yet).
Modified:
llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp
llvm-gcc-4.0/trunk/gcc/llvm-types.cpp
Modified: llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp?rev=42872&r1=42871&r2=42872&view=diff
==============================================================================
--- llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Thu Oct 11 14:41:40 2007
@@ -5690,6 +5690,16 @@
UArr[1] = (uint16_t)RealArr[0];
return ConstantFP::get(Ty, APFloat(APInt(80, 2, UArr)));
+ } else if (Ty==Type::PPC_FP128Ty) {
+ long RealArr[4];
+ uint64_t UArr[2];
+ REAL_VALUE_TO_TARGET_LONG_DOUBLE(TREE_REAL_CST(exp), RealArr);
+
+ UArr[0] = ((uint64_t)((uint32_t)RealArr[0]) << 32) |
+ ((uint64_t)((uint32_t)RealArr[1]));
+ UArr[1] = ((uint64_t)((uint32_t)RealArr[2]) << 32) |
+ ((uint64_t)((uint32_t)RealArr[3]));
+ return ConstantFP::get(Ty, APFloat(APInt(128, 2, UArr)));
}
assert(0 && "Floating point type not handled yet");
return 0; // outwit compiler warning
Modified: llvm-gcc-4.0/trunk/gcc/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-types.cpp?rev=42872&r1=42871&r2=42872&view=diff
==============================================================================
--- llvm-gcc-4.0/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.0/trunk/gcc/llvm-types.cpp Thu Oct 11 14:41:40 2007
@@ -705,10 +705,17 @@
case 64: return SET_TYPE_LLVM(type, Type::DoubleTy);
case 80: return SET_TYPE_LLVM(type, Type::X86_FP80Ty);
case 128:
+#ifdef TARGET_POWERPC
+ return SET_TYPE_LLVM(type, Type::PPC_FP128Ty);
+#elif 0
+ // This is for IEEE double extended, e.g. Sparc
+ return SET_TYPE_LLVM(type, Type::FP128Ty);
+#else
// 128-bit long doubles map onto { double, double }.
const Type *Ty = Type::DoubleTy;
Ty = StructType::get(std::vector<const Type*>(2, Ty), false);
return SET_TYPE_LLVM(type, Ty);
+#endif
}
case COMPLEX_TYPE: {
More information about the llvm-commits
mailing list