From: Andreas Krebbel Date: Wed, 24 May 2017 11:36:54 +0000 (+0000) Subject: S/390: Fix PR80725. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=00e0af8d15c7a2cdbb6ed8c171f4558a7aeb8599;p=gcc.git S/390: Fix PR80725. gcc/ChangeLog: 2017-05-24 Andreas Krebbel PR target/80725 * config/s390/s390.c (s390_check_qrst_address): Check incoming address against address_operand predicate. * config/s390/s390.md ("*indirect_jump"): Swap alternatives. gcc/testsuite/ChangeLog: 2017-05-24 Andreas Krebbel * gcc.target/s390/pr80725.c: New test. From-SVN: r248407 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1bbeb7b40b7..0d212ab9930 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2017-05-24 Andreas Krebbel + + PR target/80725 + * config/s390/s390.c (s390_check_qrst_address): Check incoming + address against address_operand predicate. + * config/s390/s390.md ("*indirect_jump"): Swap alternatives. + 2017-05-24 Eric Botcazou * var-tracking.c (track_expr_p): Do not return 0 for tracked record diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index c16391aa8d5..7be22d9c75c 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -3102,6 +3102,9 @@ s390_check_qrst_address (char c, rtx op, bool lit_pool_ok) struct s390_address addr; bool decomposed = false; + if (!address_operand (op, GET_MODE (op))) + return 0; + /* This check makes sure that no symbolic address (except literal pool references) are accepted by the R or T constraints. */ if (s390_loadrelative_operand_p (op, NULL, NULL)) diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md index c9fd19aeb33..cfae171c2a0 100644 --- a/gcc/config/s390/s390.md +++ b/gcc/config/s390/s390.md @@ -9660,14 +9660,16 @@ operands[0] = force_reg (Pmode, operands[0]); }) +; The first constraint must be an "extra address constraint" in order +; to trigger address reloading in LRA/reload (define_insn "*indirect_jump" [(set (pc) - (match_operand 0 "address_operand" "a,ZR"))] + (match_operand 0 "address_operand" "ZR,a"))] "" "@ - br\t%0 - b\t%a0" - [(set_attr "op_type" "RR,RX") + b\t%a0 + br\t%0" + [(set_attr "op_type" "RX,RR") (set_attr "type" "branch") (set_attr "atype" "agen") (set_attr "cpu_facility" "*")]) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d8d16eebb8b..78756318c34 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2017-05-24 Andreas Krebbel + + * gcc.target/s390/pr80725.c: New test. + 2017-05-23 Nathan Sidwell * g++.dg/lookup/extern-c-hidden.C: New. diff --git a/gcc/testsuite/gcc.target/s390/pr80725.c b/gcc/testsuite/gcc.target/s390/pr80725.c new file mode 100644 index 00000000000..4a402c41422 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/pr80725.c @@ -0,0 +1,26 @@ +/* Regression test for PR/80725. */ + +/* { dg-do compile } */ +/* { dg-options "-O2 -march=zEC12" } */ + +int a, e; +const char b; +char c; +const int d; +void bar (short); + +void +foo (int x, int y) +{ + long f = d; + short g = 0; + while (e) + while (a < x) + { + if (y) + goto *d; + g = b | b + g; + bar (g); + c = (char) (long) foo; + } +}