[llvm-commits] CVS: gcc-3.4/gcc/llvm-expand.c

John Criswell criswell at cs.uiuc.edu
Fri Jan 30 16:29:02 PST 2004


Changes in directory gcc-3.4/gcc:

llvm-expand.c updated: 1.3 -> 1.4

---
Log message:

Fix for PR164 for MacOS X/PPC.  Specifically, big endian 32 bit floating
point numbers should be generated correctly, assuming that the host
machine has 32 bit long's and is big endian.



---
Diffs of the changes:  (+31 -15)

Index: gcc-3.4/gcc/llvm-expand.c
diff -u gcc-3.4/gcc/llvm-expand.c:1.3 gcc-3.4/gcc/llvm-expand.c:1.4
--- gcc-3.4/gcc/llvm-expand.c:1.3	Sun Jan 11 23:04:26 2004
+++ gcc-3.4/gcc/llvm-expand.c	Fri Jan 30 16:28:42 2004
@@ -4701,23 +4701,39 @@
       }
       else
       {
-        /*
-         * Note that it apperas that GCC thinks that longs are 32 bit (and not
-         * 64 bit like LP/SparcV9 use).  So, grab half of the value from the
-         * first long and the second half from the second long.
-         */
-        Values = (char*)RealArr + 4;
-        Size = 4;
-        while (Size--) {
-          sprintf(BufPtr, "%02X", (unsigned char)*Values++);
-          BufPtr += 2;
+        if (BITS_PER_WORD == 32)
+        {
+          /*
+           * Handle a big endian 32 bit target.
+           */
+          Values = (char*)RealArr;
+          while (Size--) {
+            sprintf(BufPtr, "%02X", (unsigned char)*Values++);
+            BufPtr += 2;
+          }
         }
+        else
+        {
+          /*
+           * Handle a big endian 64 bit target.
+           *
+           * Note that it appears that GCC thinks that longs are 32 bit (and not
+           * 64 bit like LP/SparcV9 use).  So, grab half of the value from the
+           * first long and the second half from the second long.
+           */
+          Values = (char*)RealArr + 4;
+          Size = 4;
+          while (Size--) {
+            sprintf(BufPtr, "%02X", (unsigned char)*Values++);
+            BufPtr += 2;
+          }
 
-        Values = (char*)RealArr + 12;
-        Size = 4;
-        while (Size--) {
-          sprintf(BufPtr, "%02X", (unsigned char)*Values++);
-          BufPtr += 2;
+          Values = (char*)RealArr + 12;
+          Size = 4;
+          while (Size--) {
+            sprintf(BufPtr, "%02X", (unsigned char)*Values++);
+            BufPtr += 2;
+          }
         }
       }
     }





More information about the llvm-commits mailing list