This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH 03/15] rs6000: Tidy num_insns_constant vs CONST_DOUBLE
- From: Richard Henderson <rth at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: David Edelsohn <dje dot gcc at gmail dot com>
- Date: Tue, 11 Aug 2015 18:11:32 -0700
- Subject: [PATCH 03/15] rs6000: Tidy num_insns_constant vs CONST_DOUBLE
- Authentication-results: sourceware.org; auth=none
- References: <1439341904-9345-1-git-send-email-rth at redhat dot com>
After the fact I noticed this does temporarily remove the
rs6000_is_valid_and_mask test from the DFmode path, but that
will be fixed shortly. And it was missing from the SFmode
path the whole time.
Cc: David Edelsohn <dje.gcc@gmail.com>
---
* config/rs6000/rs6000.c (num_insns_constant): Share code between
single-precision and double-precision paths. Form 64-bit constant
for 64-bit guest.
---
gcc/config/rs6000/rs6000.c | 54 ++++++++++++++++++----------------------------
1 file changed, 21 insertions(+), 33 deletions(-)
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index abaf7eb..c25aa60 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -5299,50 +5299,38 @@ num_insns_constant (rtx op, machine_mode mode)
return ins;
}
- case CONST_DOUBLE:
+ case CONST_DOUBLE:
+ {
+ REAL_VALUE_TYPE rv;
+ long l[2];
+
if (mode == SFmode || mode == SDmode)
{
- long l;
- REAL_VALUE_TYPE rv;
-
REAL_VALUE_FROM_CONST_DOUBLE (rv, op);
if (DECIMAL_FLOAT_MODE_P (mode))
- REAL_VALUE_TO_TARGET_DECIMAL32 (rv, l);
+ REAL_VALUE_TO_TARGET_DECIMAL32 (rv, l[0]);
else
- REAL_VALUE_TO_TARGET_SINGLE (rv, l);
- return num_insns_constant_wide ((HOST_WIDE_INT) l);
+ REAL_VALUE_TO_TARGET_SINGLE (rv, l[0]);
+ low = l[0];
}
-
- long l[2];
- REAL_VALUE_TYPE rv;
-
- REAL_VALUE_FROM_CONST_DOUBLE (rv, op);
- if (DECIMAL_FLOAT_MODE_P (mode))
- REAL_VALUE_TO_TARGET_DECIMAL64 (rv, l);
- else
- REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
- high = l[WORDS_BIG_ENDIAN == 0];
- low = l[WORDS_BIG_ENDIAN != 0];
-
- if (TARGET_32BIT)
- return (num_insns_constant_wide (low)
- + num_insns_constant_wide (high));
else
{
- if ((high == 0 && low >= 0)
- || (high == -1 && low < 0))
- return num_insns_constant_wide (low);
-
- else if (rs6000_is_valid_and_mask (op, mode))
- return 2;
+ REAL_VALUE_FROM_CONST_DOUBLE (rv, op);
+ if (DECIMAL_FLOAT_MODE_P (mode))
+ REAL_VALUE_TO_TARGET_DECIMAL64 (rv, l);
+ else
+ REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
+ high = l[WORDS_BIG_ENDIAN == 0];
+ low = l[WORDS_BIG_ENDIAN != 0];
- else if (low == 0)
- return num_insns_constant_wide (high) + 1;
+ if (TARGET_32BIT)
+ return (num_insns_constant_wide (low)
+ + num_insns_constant_wide (high));
- else
- return (num_insns_constant_wide (high)
- + num_insns_constant_wide (low) + 1);
+ low = (low & 0xfffffffful) | (high << 32);
}
+ return num_insns_constant_wide (low);
+ }
default:
gcc_unreachable ();
--
2.4.3