From a16c8d8b61064dfd2281dd1749b65d633b256334 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Wed, 19 Apr 2017 08:05:36 +0000 Subject: [PATCH] predicates.md (input_operand): Add comment. * config/sparc/predicates.md (input_operand): Add comment. Return true for any memory operand when LRA is in progress. * config/sparc/sparc.c (sparc_expand_move): Minor formatting fix. Co-Authored-By: Jeff Law Co-Authored-By: Vladimir Makarov From-SVN: r246989 --- gcc/ChangeLog | 7 +++++++ gcc/config/sparc/predicates.md | 10 +++++++++- gcc/config/sparc/sparc.c | 5 ++--- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.c-torture/compile/20170419-1.c | 13 +++++++++++++ 5 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/compile/20170419-1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7aa8c03c45b..d52db8a3609 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2017-04-19 Eric Botcazou + Vladimir Makarov + + * config/sparc/predicates.md (input_operand): Add comment. Return + true for any memory operand when LRA is in progress. + * config/sparc/sparc.c (sparc_expand_move): Minor formatting fix. + 2017-04-18 Jeff Law PR target/74563 diff --git a/gcc/config/sparc/predicates.md b/gcc/config/sparc/predicates.md index 118ed916ad9..951933efb39 100644 --- a/gcc/config/sparc/predicates.md +++ b/gcc/config/sparc/predicates.md @@ -373,6 +373,7 @@ if (TARGET_ARCH32 && mode == DImode && GET_CODE (op) == CONST_INT) return true; + /* Allow FP constants to be built in integer registers. */ if (mclass == MODE_FLOAT && GET_CODE (op) == CONST_DOUBLE) return true; @@ -388,7 +389,14 @@ /* Check for valid MEM forms. */ if (GET_CODE (op) == MEM) - return memory_address_p (mode, XEXP (op, 0)); + { + /* Except when LRA is precisely working hard to make them valid + and relying entirely on the constraints. */ + if (lra_in_progress) + return true; + + return memory_address_p (mode, XEXP (op, 0)); + } return false; }) diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 16ca444518f..8277496964a 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -1911,9 +1911,8 @@ sparc_expand_move (machine_mode mode, rtx *operands) /* We are able to build any SF constant in integer registers with at most 2 instructions. */ && (mode == SFmode - /* And any DF constant in integer registers. */ - || (mode == DFmode - && ! can_create_pseudo_p ()))) + /* And any DF constant in integer registers if needed. */ + || (mode == DFmode && !can_create_pseudo_p ()))) return false; operands[1] = force_const_mem (mode, operands[1]); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 90fdddb5f91..8f2cfffd999 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-04-19 Eric Botcazou + Jeff Law + + * gcc.c-torture/compile/20170419-1.c: New test. + 2017-04-19 Tom de Vries PR testsuite/80221 diff --git a/gcc/testsuite/gcc.c-torture/compile/20170419-1.c b/gcc/testsuite/gcc.c-torture/compile/20170419-1.c new file mode 100644 index 00000000000..c16a5ea2af4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20170419-1.c @@ -0,0 +1,13 @@ +extern int __fpclassifyd (double x); + +double fdim (double x, double y) +{ + int c = __fpclassifyd (x); + if (c == 0) + return (x); + if (__fpclassifyd (y) == 0) + return (y); + if (c == 1) + return (__builtin_huge_val ()); + return x > y ? x - y : 0.0; +} -- 2.30.2