diff options
author | Andreas Krebbel <krebbel@linux.vnet.ibm.com> | 2017-07-27 10:39:49 +0000 |
---|---|---|
committer | Andreas Krebbel <krebbel@gcc.gnu.org> | 2017-07-27 10:39:49 +0000 |
commit | 58814c7630eccb63cd24d198cfda2e8a268faa7e (patch) | |
tree | 25587c3387f02df01178775dce8b6c0e0db97355 | |
parent | 02d3ba0e000ad83dcb76ccccd1ea9882672d71b1 (diff) | |
download | gcc-58814c7630eccb63cd24d198cfda2e8a268faa7e.zip gcc-58814c7630eccb63cd24d198cfda2e8a268faa7e.tar.gz gcc-58814c7630eccb63cd24d198cfda2e8a268faa7e.tar.bz2 |
S/390: Fix PR81534
The HI/QI atomic_fetch_<atomic><mode>" expander accepted symbolic
references and emitted CAS patterns whose insn predicates rejected them.
Fixed by allowing symbolic references there as well. Reload will get
rid of them due to the constraint letter.
Regression tested on s390x.
gcc/ChangeLog:
2017-07-27 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
PR target/81534
* config/s390/s390.md ("*atomic_compare_and_swap<mode>_1")
("*atomic_compare_and_swapdi_2", "*atomic_compare_and_swapsi_3"):
Change s_operand to memory_operand.
gcc/testsuite/ChangeLog:
2017-07-27 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
PR target/81534
* gcc.target/s390/pr81534.c: New test.
From-SVN: r250617
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/config/s390/s390.md | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/s390/pr81534.c | 17 |
4 files changed, 32 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7444943..ae549e7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2017-07-27 Andreas Krebbel <krebbel@linux.vnet.ibm.com> + + PR target/81534 + * config/s390/s390.md ("*atomic_compare_and_swap<mode>_1") + ("*atomic_compare_and_swapdi_2", "*atomic_compare_and_swapsi_3"): + Change s_operand to memory_operand. + 2017-07-27 Richard Sandiford <richard.sandiford@linaro.org> * config/rs6000/rs6000-protos.h (rs6000_emit_le_vsx_permute): Declare. diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md index 0eef9b1..d1ac0b8 100644 --- a/gcc/config/s390/s390.md +++ b/gcc/config/s390/s390.md @@ -10266,7 +10266,7 @@ ; cdsg, csg (define_insn "*atomic_compare_and_swap<mode>_1" [(set (match_operand:TDI 0 "register_operand" "=r") - (match_operand:TDI 1 "s_operand" "+S")) + (match_operand:TDI 1 "memory_operand" "+S")) (set (match_dup 1) (unspec_volatile:TDI [(match_dup 1) @@ -10284,7 +10284,7 @@ ; cds, cdsy (define_insn "*atomic_compare_and_swapdi_2" [(set (match_operand:DI 0 "register_operand" "=r,r") - (match_operand:DI 1 "s_operand" "+Q,S")) + (match_operand:DI 1 "memory_operand" "+Q,S")) (set (match_dup 1) (unspec_volatile:DI [(match_dup 1) @@ -10305,7 +10305,7 @@ ; cs, csy (define_insn "*atomic_compare_and_swapsi_3" [(set (match_operand:SI 0 "register_operand" "=r,r") - (match_operand:SI 1 "s_operand" "+Q,S")) + (match_operand:SI 1 "memory_operand" "+Q,S")) (set (match_dup 1) (unspec_volatile:SI [(match_dup 1) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fd606e0..cc300dc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-07-27 Andreas Krebbel <krebbel@linux.vnet.ibm.com> + + PR target/81534 + * gcc.target/s390/pr81534.c: New test. + 2017-07-27 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/81555 diff --git a/gcc/testsuite/gcc.target/s390/pr81534.c b/gcc/testsuite/gcc.target/s390/pr81534.c new file mode 100644 index 0000000..0e1bd99 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/pr81534.c @@ -0,0 +1,17 @@ +/* PR81534 This testcase used to fail because the HI/QI + "atomic_fetch_<atomic><mode>" expander accepted symbolic references + and emitted CAS patterns whose insn definition rejected them. */ + +/* { dg-do compile } */ +/* { dg-options "-O2 -march=zEC12" } */ + +struct { + short b; + long c; +} a = {}; + +void +d () +{ + __atomic_fetch_add(&a.b, 0, 5); +} |