* cgen-ops.h (SUBWORDXFSI): Fix word ordering.
authorDoug Evans <dje@google.com>
Fri, 22 Jan 2010 08:23:26 +0000 (08:23 +0000)
committerDoug Evans <dje@google.com>
Fri, 22 Jan 2010 08:23:26 +0000 (08:23 +0000)
(SUBWORDTFSI, JOINSIDI): Ditto.

sim/common/ChangeLog
sim/common/cgen-ops.h

index 7bf54347c4569683efa2ef601c953d18f784c9de..dfe328c7dbaf1da364b5cfbac36fd7941f2f4616 100644 (file)
@@ -1,3 +1,8 @@
+2010-01-22  Doug Evans  <dje@sebabeach.org>
+
+       * cgen-ops.h (SUBWORDXFSI): Fix word ordering.
+       (SUBWORDTFSI, JOINSIDI): Ditto.
+
 2010-01-05  Doug Evans  <dje@sebabeach.org>
 
        * cgen-types.h (SETDI): Delete, unused.
index 64ed7379e287c64407371d72646eb6d83d22aa7a..b6f38cfd33dac3d59d8a1c1427d4dc4a2d0b0a5b 100644 (file)
@@ -404,7 +404,10 @@ SUBWORDXFSI (XF in, int word)
   /* Note: typedef struct { SI parts[3]; } XF; */
   union { XF in; SI out[3]; } x;
   x.in = in;
-  return x.out[word];
+  if (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN)
+    return x.out[word];
+  else
+    return x.out[2 - word];
 }
 
 SEMOPS_INLINE SI
@@ -413,16 +416,16 @@ SUBWORDTFSI (TF in, int word)
   /* Note: typedef struct { SI parts[4]; } TF; */
   union { TF in; SI out[4]; } x;
   x.in = in;
-  return x.out[word];
+  if (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN)
+    return x.out[word];
+  else
+    return x.out[3 - word];
 }
 
 SEMOPS_INLINE DI
 JOINSIDI (SI x0, SI x1)
 {
-  if (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN)
-    return MAKEDI (x0, x1);
-  else
-    return MAKEDI (x1, x0);
+  return MAKEDI (x0, x1);
 }
 
 SEMOPS_INLINE DF