From 5c22bb4836c535c027a94e22dbfa33d406ae7c89 Mon Sep 17 00:00:00 2001 From: Tamar Christina Date: Wed, 2 Aug 2017 08:55:59 +0000 Subject: [PATCH] aarch64.c (aarch64_reinterpret_float_as_int): Correct endianness. 2017-08-02 Tamar Christina * config/aarch64/aarch64.c (aarch64_reinterpret_float_as_int): Correct endianness. From-SVN: r250818 --- gcc/ChangeLog | 5 +++++ gcc/config/aarch64/aarch64.c | 11 ++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d9f8e3e7e8c..6cd5ca7001b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-08-02 Tamar Christina + + * config/aarch64/aarch64.c (aarch64_reinterpret_float_as_int): + Correct endianness. + 2017-08-02 Jakub Jelinek PR middle-end/79499 diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 5a2ad7e9156..fac5063686f 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; -- 2.30.2