[llvm-commits] [llvm-gcc-4.2] r40522 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Anton Korobeynikov asl at math.spbu.ru
Thu Jul 26 03:31:53 PDT 2007


Author: asl
Date: Thu Jul 26 05:31:52 2007
New Revision: 40522

URL: http://llvm.org/viewvc/llvm-project?rev=40522&view=rev
Log:
Fix float initializers emission (HOST_WORDS_BIG_ENDIAN is obsolete).
We still need to verify stuff on big-endian targets and cross-compilation
on targets with different endiannes.

Also, make use of FLOAT_WORDS_BIG_ENDIAN, which seems to be important
for ARM.

This change allows most of SingleSource/Benchmark and some of 
MultiSource/Applications to pass!

Modified:
    llvm-gcc-4.2/trunk/gcc/llvm-convert.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=40522&r1=40521&r2=40522&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Thu Jul 26 05:31:52 2007
@@ -5496,25 +5496,22 @@
   
   // Here's how this works:
   // REAL_VALUE_TO_TARGET_DOUBLE() will generate the floating point number
-  //  as an array of integers in the hosts's representation.  Each integer
+  // as an array of integers in the target's representation.  Each integer
   // in the array will hold 32 bits of the result REGARDLESS OF THE HOST'S
-  //  INTEGER SIZE.
+  // INTEGER SIZE.
   //
   // This, then, makes the conversion pretty simple.  The tricky part is
   // getting the byte ordering correct and make sure you don't print any
   // more than 32 bits per integer on platforms with ints > 32 bits.
-  //
-  bool HostBigEndian = false;
-#ifdef WORDS_BIG_ENDIAN
-  HostBigEndian = true;
-#endif
-  
+
   UArr[0] = RealArr[0];   // Long -> int convert
   UArr[1] = RealArr[1];
 
-  if (WORDS_BIG_ENDIAN != HostBigEndian)
+  // FIXME: verify on big-endian targets and cross from big- to little- endian
+  // targets
+  if (FLOAT_WORDS_BIG_ENDIAN)
     std::swap(UArr[0], UArr[1]);
-  
+
   return ConstantFP::get(Ty, V);
 }
 





More information about the llvm-commits mailing list