[llvm-commits] [llvm-gcc-4.2] r42873 - in /llvm-gcc-4.2/trunk/gcc: llvm-convert.cpp llvm-types.cpp

Dale Johannesen dalej at apple.com
Thu Oct 11 12:47:52 PDT 2007


Author: johannes
Date: Thu Oct 11 14:47:49 2007
New Revision: 42873

URL: http://llvm.org/viewvc/llvm-project?rev=42873&view=rev
Log:
Emit PPC long double correctly (it's not actually
generated yet)


Modified:
    llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
    llvm-gcc-4.2/trunk/gcc/llvm-types.cpp

Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=42873&r1=42872&r2=42873&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Thu Oct 11 14:47:49 2007
@@ -5253,6 +5253,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.2/trunk/gcc/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=42873&r1=42872&r2=42873&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Thu Oct 11 14:47:49 2007
@@ -722,10 +722,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