Hi All,

real_to_target seems to return the order of the elements in the array
differently depending on the endiannes. This undoes the endianness when
combining the values back to a HOST_WIDE_INT.

Regtested on aach64-none-linux-gnu and aarch64_be-none-linux-gnu and no issues.

Thanks,
Tamar


gcc/
2017-08-01  Tamar Christina  <tamar.christ...@arm.com>

        * config/aarch64/aarch64.c (aarch64_reinterpret_float_as_int):
        Correct endianness.

-- 
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 5a2ad7e9156a6f0389c09470cf1414bff45d8099..84e0c937665a02f06e15ddf334978fe2a0da565f 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -4733,9 +4733,14 @@ aarch64_reinterpret_float_as_int (rtx value, unsigned HOST_WIDE_INT *intval)
 		  CONST_DOUBLE_REAL_VALUE (value),
 		  REAL_MODE_FORMAT (mode));
 
-  ival = zext_hwi (res[0], 32);
-  if (GET_MODE_BITSIZE (mode) == GET_MODE_BITSIZE (DFmode))
-    ival |= (zext_hwi (res[1], 32) << 32);
+  if (mode == DFmode)
+    {
+      int order = BYTES_BIG_ENDIAN ? 1 : 0;
+      ival = zext_hwi (res[order], 32);
+      ival |= (zext_hwi (res[1-order], 32) << 32);
+    }
+  else
+      ival = zext_hwi (res[0], 32);
 
   *intval = ival;
   return true;

Reply via email to