diff options
author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2019-09-01 12:57:56 +0000 |
---|---|---|
committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2019-09-01 12:57:56 +0000 |
commit | 35d794ced62574fc122cccf38a08afd2efeb6bc6 (patch) | |
tree | 8043252e0a2df5876de2b1b9be7beb2d19ee6003 | |
parent | d754e9c8bb31dbbf8d331fe58e852be3d90a66f9 (diff) |
PR target/91472
* config/sparc/sparc.c (sparc_cannot_force_const_mem): Return true
during LRA/reload in PIC mode if the PIC register hasn't been used yet.
(sparc_pic_register_p): Test reload_in_progress for consistency's sake.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-9-branch@275272 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/config/sparc/sparc.c | 9 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/20190901-1.c | 36 |
4 files changed, 55 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3ae23dbc01b..195aa66e6e0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-09-01 Eric Botcazou <ebotcazou@adacore.com> + + PR target/91472 + * config/sparc/sparc.c (sparc_cannot_force_const_mem): Return true + during LRA/reload in PIC mode if the PIC register hasn't been used yet. + (sparc_pic_register_p): Test reload_in_progress for consistency's sake. + 2019-08-31 Iain Sandoe <iain@sandoe.co.uk> Backport from mainline diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 93479ab6bdc..14a4a760499 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -4208,6 +4208,13 @@ eligible_for_sibcall_delay (rtx_insn *trial) static bool sparc_cannot_force_const_mem (machine_mode mode, rtx x) { + /* After IRA has run in PIC mode, it is too late to put anything into the + constant pool if the PIC register hasn't already been initialized. */ + if ((lra_in_progress || reload_in_progress) + && flag_pic + && !crtl->uses_pic_offset_table) + return true; + switch (GET_CODE (x)) { case CONST_INT: @@ -4457,7 +4464,7 @@ sparc_pic_register_p (rtx x) return true; if (!HARD_REGISTER_P (pic_offset_table_rtx) - && (HARD_REGISTER_P (x) || lra_in_progress) + && (HARD_REGISTER_P (x) || lra_in_progress || reload_in_progress) && ORIGINAL_REGNO (x) == REGNO (pic_offset_table_rtx)) return true; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e0a24b33db4..0826d7820e2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2019-09-01 Eric Botcazou <ebotcazou@adacore.com> + + * gcc.c-torture/execute/20190901-1.c: New test. + 2019-08-30 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/91587 diff --git a/gcc/testsuite/gcc.c-torture/execute/20190901-1.c b/gcc/testsuite/gcc.c-torture/execute/20190901-1.c new file mode 100644 index 00000000000..c78715ef2c1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20190901-1.c @@ -0,0 +1,36 @@ +/* PR target/91472 */ +/* Reported by John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> */ + +typedef unsigned int gmp_uint_least32_t; + +union ieee_double_extract +{ + struct + { + gmp_uint_least32_t sig:1; + gmp_uint_least32_t exp:11; + gmp_uint_least32_t manh:20; + gmp_uint_least32_t manl:32; + } s; + double d; +}; + +double __attribute__((noipa)) +tests_infinity_d (void) +{ + union ieee_double_extract x; + x.s.exp = 2047; + x.s.manl = 0; + x.s.manh = 0; + x.s.sig = 0; + return x.d; +} + +int +main (void) +{ + double x = tests_infinity_d (); + if (x == 0.0) + __builtin_abort (); + return 0; +} |