From 1f8d3e42524c94ca20e88864c12f789b0520c48c Mon Sep 17 00:00:00 2001 From: Dominik Vogt Date: Fri, 29 May 2015 14:26:56 +0000 Subject: [PATCH] PR 66215: S390: Fix placement of post-label NOPs with -mhotpatch gcc/ChangeLog: PR target/66215 * config/s390/s390.c (s390_reorg): Fix placement of post-label NOPs with -mhotpatch=. gcc/testsuite/ChangeLog: PR target/66215 * gcc.target/s390/hotpatch-1.c: Remove optimization options from dg-options. * gcc.target/s390/hotpatch-10.c: Likewise. * gcc.target/s390/hotpatch-11.c: Likewise. * gcc.target/s390/hotpatch-12.c: Likewise. * gcc.target/s390/hotpatch-17.c: Likewise. * gcc.target/s390/hotpatch-18.c: Likewise. * gcc.target/s390/hotpatch-20.c: Likewise. * gcc.target/s390/hotpatch-21.c: Likewise. * gcc.target/s390/hotpatch-22.c: Likewise. * gcc.target/s390/hotpatch-23.c: Likewise. * gcc.target/s390/hotpatch-24.c: Likewise. * gcc.target/s390/hotpatch-2.c: Likewise. Adjust scan-assembler to check for the exact nops too. * gcc.target/s390/hotpatch-3.c: Likewise. * gcc.target/s390/hotpatch-4.c: Likewise. * gcc.target/s390/hotpatch-5.c: Likewise. * gcc.target/s390/hotpatch-6.c: Likewise. * gcc.target/s390/hotpatch-7.c: Likewise. * gcc.target/s390/hotpatch-8.c: Likewise. * gcc.target/s390/hotpatch-9.c: Likewise. * gcc.target/s390/hotpatch-14.c: Likewise. * gcc.target/s390/hotpatch-15.c: Likewise. * gcc.target/s390/hotpatch-16.c: Likewise. * gcc.target/s390/hotpatch-19.c: Likewise. * gcc.target/s390/hotpatch-25.c: Likewise. Remove scan-assembler-times counting number of .align directives. * gcc.target/s390/hotpatch-13.c: Remove optimization options from dg-options. Remove scan-assembler-times counting number of .align directives. * gcc.target/s390/hotpatch-26.c: New file. * gcc.target/s390/hotpatch-27.c: New file. * gcc.target/s390/hotpatch-28.c: New file. * gcc.target/s390/s390.exp: Run hotpatch-*.c tests as torture tests using -Os -O0 -O1 -O2 -O3 options. From-SVN: r223867 --- gcc/ChangeLog | 6 ++++ gcc/config/s390/s390.c | 28 +++++++++------ gcc/testsuite/ChangeLog | 39 +++++++++++++++++++++ gcc/testsuite/gcc.target/s390/hotpatch-1.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-10.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-11.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-12.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-13.c | 3 +- gcc/testsuite/gcc.target/s390/hotpatch-14.c | 4 +-- gcc/testsuite/gcc.target/s390/hotpatch-15.c | 4 +-- gcc/testsuite/gcc.target/s390/hotpatch-16.c | 4 +-- gcc/testsuite/gcc.target/s390/hotpatch-17.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-18.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-19.c | 4 +-- gcc/testsuite/gcc.target/s390/hotpatch-2.c | 4 +-- gcc/testsuite/gcc.target/s390/hotpatch-20.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-21.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-22.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-23.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-24.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-25.c | 9 +++-- gcc/testsuite/gcc.target/s390/hotpatch-26.c | 17 +++++++++ gcc/testsuite/gcc.target/s390/hotpatch-27.c | 17 +++++++++ gcc/testsuite/gcc.target/s390/hotpatch-28.c | 18 ++++++++++ gcc/testsuite/gcc.target/s390/hotpatch-3.c | 4 +-- gcc/testsuite/gcc.target/s390/hotpatch-4.c | 4 +-- gcc/testsuite/gcc.target/s390/hotpatch-5.c | 4 +-- gcc/testsuite/gcc.target/s390/hotpatch-6.c | 4 +-- gcc/testsuite/gcc.target/s390/hotpatch-7.c | 4 +-- gcc/testsuite/gcc.target/s390/hotpatch-8.c | 4 +-- gcc/testsuite/gcc.target/s390/hotpatch-9.c | 4 +-- gcc/testsuite/gcc.target/s390/s390.exp | 13 +++++-- 32 files changed, 165 insertions(+), 55 deletions(-) create mode 100644 gcc/testsuite/gcc.target/s390/hotpatch-26.c create mode 100644 gcc/testsuite/gcc.target/s390/hotpatch-27.c create mode 100644 gcc/testsuite/gcc.target/s390/hotpatch-28.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c8b1c44f071..1d5989831a3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-05-29 Dominik Vogt + + PR target/66215 + * config/s390/s390.c (s390_reorg): Fix placement of post-label NOPs + with -mhotpatch=. + 2015-05-29 Jakub Jelinek PR tree-optimization/66142 diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 6648597fe44..90d43b1498c 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -12843,31 +12843,37 @@ s390_reorg (void) /* Insert NOPs for hotpatching. */ for (insn = get_insns (); insn; insn = NEXT_INSN (insn)) - { - if (NOTE_P (insn) && NOTE_KIND (insn) == NOTE_INSN_FUNCTION_BEG) - break; - } - gcc_assert (insn); - /* Output a series of NOPs after the NOTE_INSN_FUNCTION_BEG. */ - while (hw_after > 0) + /* Emit NOPs + 1. inside the area covered by debug information to allow setting + breakpoints at the NOPs, + 2. before any insn which results in an asm instruction, + 3. before in-function labels to avoid jumping to the NOPs, for + example as part of a loop, + 4. before any barrier in case the function is completely empty + (__builtin_unreachable ()) and has neither internal labels nor + active insns. + */ + if (active_insn_p (insn) || BARRIER_P (insn) || LABEL_P (insn)) + break; + /* Output a series of NOPs before the first active insn. */ + while (insn && hw_after > 0) { if (hw_after >= 3 && TARGET_CPU_ZARCH) { - insn = emit_insn_after (gen_nop_6_byte (), insn); + emit_insn_before (gen_nop_6_byte (), insn); hw_after -= 3; } else if (hw_after >= 2) { - insn = emit_insn_after (gen_nop_4_byte (), insn); + emit_insn_before (gen_nop_4_byte (), insn); hw_after -= 2; } else { - insn = emit_insn_after (gen_nop_2_byte (), insn); + emit_insn_before (gen_nop_2_byte (), insn); hw_after -= 1; } } - gcc_assert (hw_after == 0); } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b6724472de9..2fe348afd83 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,42 @@ +2015-05-29 Dominik Vogt + + PR target/66215 + * gcc.target/s390/hotpatch-1.c: Remove optimization options from + dg-options. + * gcc.target/s390/hotpatch-10.c: Likewise. + * gcc.target/s390/hotpatch-11.c: Likewise. + * gcc.target/s390/hotpatch-12.c: Likewise. + * gcc.target/s390/hotpatch-17.c: Likewise. + * gcc.target/s390/hotpatch-18.c: Likewise. + * gcc.target/s390/hotpatch-20.c: Likewise. + * gcc.target/s390/hotpatch-21.c: Likewise. + * gcc.target/s390/hotpatch-22.c: Likewise. + * gcc.target/s390/hotpatch-23.c: Likewise. + * gcc.target/s390/hotpatch-24.c: Likewise. + * gcc.target/s390/hotpatch-2.c: Likewise. Adjust scan-assembler + to check for the exact nops too. + * gcc.target/s390/hotpatch-3.c: Likewise. + * gcc.target/s390/hotpatch-4.c: Likewise. + * gcc.target/s390/hotpatch-5.c: Likewise. + * gcc.target/s390/hotpatch-6.c: Likewise. + * gcc.target/s390/hotpatch-7.c: Likewise. + * gcc.target/s390/hotpatch-8.c: Likewise. + * gcc.target/s390/hotpatch-9.c: Likewise. + * gcc.target/s390/hotpatch-14.c: Likewise. + * gcc.target/s390/hotpatch-15.c: Likewise. + * gcc.target/s390/hotpatch-16.c: Likewise. + * gcc.target/s390/hotpatch-19.c: Likewise. + * gcc.target/s390/hotpatch-25.c: Likewise. Remove + scan-assembler-times counting number of .align directives. + * gcc.target/s390/hotpatch-13.c: Remove optimization options from + dg-options. Remove scan-assembler-times counting number of .align + directives. + * gcc.target/s390/hotpatch-26.c: New file. + * gcc.target/s390/hotpatch-27.c: New file. + * gcc.target/s390/hotpatch-28.c: New file. + * gcc.target/s390/s390.exp: Run hotpatch-*.c tests as torture tests + using -Os -O0 -O1 -O2 -O3 options. + 2015-05-29 Kyrylo Tkachov * gcc.target/aarch64/vdup_lane_2.c: Close comment on final line. diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-1.c b/gcc/testsuite/gcc.target/s390/hotpatch-1.c index b14fa9010a8..55088b8b655 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-1.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-1.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch" } */ +/* { dg-options "-mzarch" } */ #include diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-10.c b/gcc/testsuite/gcc.target/s390/hotpatch-10.c index a990c4cad6e..d2cb9a2ee86 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-10.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-10.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch -mhotpatch=0,0" } */ +/* { dg-options "-mzarch -mhotpatch=0,0" } */ #include diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-11.c b/gcc/testsuite/gcc.target/s390/hotpatch-11.c index 6f8a52b26d3..cabb9d263ab 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-11.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-11.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch -mhotpatch=1,0" } */ +/* { dg-options "-mzarch -mhotpatch=1,0" } */ #include diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-12.c b/gcc/testsuite/gcc.target/s390/hotpatch-12.c index b73ca90fd3d..fc9adc33369 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-12.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-12.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch -mhotpatch=999,0" } */ +/* { dg-options "-mzarch -mhotpatch=999,0" } */ #include diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-13.c b/gcc/testsuite/gcc.target/s390/hotpatch-13.c index 150667a1c66..b25fbd3f2ae 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-13.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-13.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch" } */ +/* { dg-options "-mzarch" } */ #include @@ -18,4 +18,3 @@ void hp1(void) /* { dg-final { scan-assembler-not "nop\t0" } } */ /* { dg-final { scan-assembler-not "brcl\t0, 0" } } */ /* { dg-final { scan-assembler "alignment for hotpatch" } } */ -/* { dg-final { scan-assembler-times "\.align\t8" 2 } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-14.c b/gcc/testsuite/gcc.target/s390/hotpatch-14.c index c5f118c1cc6..c387d6bf063 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-14.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-14.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch" } */ +/* { dg-options "-mzarch" } */ #include @@ -13,7 +13,7 @@ void hp1(void) /* Check number of occurences of certain instructions. */ /* { dg-final { scan-assembler-not "pre-label NOPs" } } */ -/* { dg-final { scan-assembler "post-label.*(2 halfwords)" } } */ +/* { dg-final { scan-assembler "^\[^.\].*:\n.*post-label.*(2 halfwords).*\n\(\(.L.*:\n\)\|\(\[\[:space:\]\]*.cfi_.*\n\)\)*\[\[:space:\]\]*nop\t0" } } */ /* { dg-final { scan-assembler-not "nopr\t%r7" } } */ /* { dg-final { scan-assembler-times "nop\t0" 1 } } */ /* { dg-final { scan-assembler-not "brcl\t0, 0" } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-15.c b/gcc/testsuite/gcc.target/s390/hotpatch-15.c index ef0fb746227..410106bb7ca 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-15.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-15.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch" } */ +/* { dg-options "-mzarch" } */ #include @@ -13,7 +13,7 @@ void hp1(void) /* Check number of occurences of certain instructions. */ /* { dg-final { scan-assembler "pre-label.*(1 halfwords)" } } */ -/* { dg-final { scan-assembler "post-label.*(2 halfwords)" } } */ +/* { dg-final { scan-assembler "^\[^.\].*:\n.*post-label.*(2 halfwords).*\n\(\(.L.*:\n\)\|\(\[\[:space:\]\]*.cfi_.*\n\)\)*\[\[:space:\]\]*nop\t0" } } */ /* { dg-final { scan-assembler-times "nopr\t%r7" 1 } } */ /* { dg-final { scan-assembler-times "nop\t0" 1 } } */ /* { dg-final { scan-assembler-not "brcl\t0, 0" } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-16.c b/gcc/testsuite/gcc.target/s390/hotpatch-16.c index a34bf95c3cb..fa06fff491f 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-16.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-16.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch -mhotpatch=0,0" } */ +/* { dg-options "-mzarch -mhotpatch=0,0" } */ #include @@ -13,7 +13,7 @@ void hp1(void) /* Check number of occurences of certain instructions. */ /* { dg-final { scan-assembler "pre-label.*(1 halfwords)" } } */ -/* { dg-final { scan-assembler "post-label.*(2 halfwords)" } } */ +/* { dg-final { scan-assembler "^\[^.\].*:\n.*post-label.*(2 halfwords).*\n\(\(.L.*:\n\)\|\(\[\[:space:\]\]*.cfi_.*\n\)\)*\[\[:space:\]\]*nop\t0" } } */ /* { dg-final { scan-assembler-times "nopr\t%r7" 1 } } */ /* { dg-final { scan-assembler-times "nop\t0" 1 } } */ /* { dg-final { scan-assembler-not "brcl\t0, 0" } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-17.c b/gcc/testsuite/gcc.target/s390/hotpatch-17.c index 66ac725d16a..3ef7d69b572 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-17.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-17.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch -mhotpatch=1,2" } */ +/* { dg-options "-mzarch -mhotpatch=1,2" } */ #include diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-18.c b/gcc/testsuite/gcc.target/s390/hotpatch-18.c index 8b076a4e175..c93af7fa99b 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-18.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-18.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch -mhotpatch=1,2 -mhotpatch=0,0" } */ +/* { dg-options "-mzarch -mhotpatch=1,2 -mhotpatch=0,0" } */ #include diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-19.c b/gcc/testsuite/gcc.target/s390/hotpatch-19.c index 6993c7e855c..c69b35e562a 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-19.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-19.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch -mhotpatch=1,2" } */ +/* { dg-options "-mzarch -mhotpatch=1,2" } */ #include @@ -19,7 +19,7 @@ void hp1(void) /* Check number of occurences of certain instructions. */ /* { dg-final { scan-assembler "pre-label.*(1 halfwords)" } } */ -/* { dg-final { scan-assembler "post-label.*(2 halfwords)" } } */ +/* { dg-final { scan-assembler "^\[^.\].*:\n.*post-label.*(2 halfwords).*\n\(\(.L.*:\n\)\|\(\[\[:space:\]\]*.cfi_.*\n\)\)*\[\[:space:\]\]*nop\t0" } } */ /* { dg-final { scan-assembler-times "nopr\t%r7" 1 } } */ /* { dg-final { scan-assembler-times "nop\t0" 1 } } */ /* { dg-final { scan-assembler-not "brcl\t0, 0" } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-2.c b/gcc/testsuite/gcc.target/s390/hotpatch-2.c index 67189f8a28b..2a2665e2585 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-2.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-2.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch -mhotpatch=0,1" } */ +/* { dg-options "-mzarch -mhotpatch=0,1" } */ #include @@ -12,7 +12,7 @@ void hp1(void) /* Check number of occurences of certain instructions. */ /* { dg-final { scan-assembler-not "pre-label NOPs" } } */ -/* { dg-final { scan-assembler "post-label.*(1 halfwords)" } } */ +/* { dg-final { scan-assembler "^\[^.\].*:\n.*post-label.*(1 halfwords).*\n\(\(.L.*:\n\)\|\(\[\[:space:\]\]*.cfi_.*\n\)\)*\[\[:space:\]\]*nopr\t" } } */ /* { dg-final { scan-assembler-times "nopr\t%r7" 1 } } */ /* { dg-final { scan-assembler-not "nop\t0" } } */ /* { dg-final { scan-assembler-not "brcl\t0, 0" } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-20.c b/gcc/testsuite/gcc.target/s390/hotpatch-20.c index 09ef5caaea3..0a32a68993f 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-20.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-20.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch" } */ +/* { dg-options "-mzarch" } */ #include diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-21.c b/gcc/testsuite/gcc.target/s390/hotpatch-21.c index e9099900855..f6e90996ba9 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-21.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-21.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch -mhotpatch=0,1" } */ +/* { dg-options "-mzarch -mhotpatch=0,1" } */ #include diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-22.c b/gcc/testsuite/gcc.target/s390/hotpatch-22.c index d89d7790426..21f7d7e957a 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-22.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-22.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch -mhotpatch=0,1 -falign-functions=1024" } */ +/* { dg-options "-mzarch -mhotpatch=0,1 -falign-functions=1024" } */ #include diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-23.c b/gcc/testsuite/gcc.target/s390/hotpatch-23.c index 1e05d123c22..6e149cc0b5a 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-23.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-23.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch -mhotpatch=0,1 -falign-functions=4096" } */ +/* { dg-options "-mzarch -mhotpatch=0,1 -falign-functions=4096" } */ #include diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-24.c b/gcc/testsuite/gcc.target/s390/hotpatch-24.c index fc6427479d8..1e475917100 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-24.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-24.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch -mhotpatch=0,1 -falign-functions=2048" } */ +/* { dg-options "-mzarch -mhotpatch=0,1 -falign-functions=2048" } */ #include diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-25.c b/gcc/testsuite/gcc.target/s390/hotpatch-25.c index e9257e3744e..e6cdbb6cb15 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-25.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-25.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch" } */ +/* { dg-options "-mzarch" } */ typedef long (*fn_t)(void); @@ -25,9 +25,8 @@ fn_t outer(void) /* { dg-final { scan-assembler "pre-label.*(1 halfwords)" } } */ /* { dg-final { scan-assembler "pre-label.*(4 halfwords)" } } */ /* { dg-final { scan-assembler "pre-label.*(16 halfwords)" } } */ -/* { dg-final { scan-assembler "post-label.*(2 halfwords)" } } */ -/* { dg-final { scan-assembler "post-label.*(8 halfwords)" } } */ -/* { dg-final { scan-assembler "post-label.*(32 halfwords)" } } */ +/* { dg-final { scan-assembler "^\[^.\].*:\n.*post-label.*(2 halfwords).*\n\(\(.L.*:\n\)\|\(\[\[:space:\]\]*.cfi_.*\n\)\)*\[\[:space:\]\]*nopr\t" } } */ +/* { dg-final { scan-assembler "^\[^.\].*:\n.*post-label.*(8 halfwords).*\n\(\(.L.*:\n\)\|\(\[\[:space:\]\]*.cfi_.*\n\)\)*\[\[:space:\]\]*brcl\t0, 0" } } */ +/* { dg-final { scan-assembler "^\[^.\].*:\n.*post-label.*(32 halfwords).*\n\(\(.L.*:\n\)\|\(\[\[:space:\]\]*.cfi_.*\n\)\)*\[\[:space:\]\]*brcl\t0, 0" } } */ /* { dg-final { scan-assembler-times "alignment for hotpatch" 3 } } */ -/* { dg-final { scan-assembler-times "\.align\t8" 6 } } */ /* { dg-final { scan-assembler "nopr.*\n.*nopr.*\n.*nopr.*\n.*nopr.*\n.*nopr.*\n.*nopr.*\n.*nopr.*\n.*nopr.*\n.*nopr.*\n.*nopr.*\n.*nopr.*\n.*nopr.*\n.*nopr.*\n.*nopr.*\n.*nopr.*\n.*nopr" } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-26.c b/gcc/testsuite/gcc.target/s390/hotpatch-26.c new file mode 100644 index 00000000000..eb95c26e257 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/hotpatch-26.c @@ -0,0 +1,17 @@ +/* Functional tests for the function hotpatching feature. */ + +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch -mhotpatch=1,2" } */ + +__attribute__ ((noreturn)) void hp1(void) +{ + __builtin_unreachable (); +} + +/* Check number of occurences of certain instructions. */ +/* { dg-final { scan-assembler "pre-label NOPs" } } */ +/* { dg-final { scan-assembler "^\[^.\].*:\n.*post-label.*(2 halfwords).*\n\(\(.L.*:\n\)\|\(\[\[:space:\]\]*.cfi_.*\n\)\)*\[\[:space:\]\]*nop\t0" } } */ +/* { dg-final { scan-assembler-times "nopr\t%r7" 1 } } */ +/* { dg-final { scan-assembler-times "nop\t0" 1 } } */ +/* { dg-final { scan-assembler-not "brcl\t0, 0" } } */ +/* { dg-final { scan-assembler "alignment for hotpatch" } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-27.c b/gcc/testsuite/gcc.target/s390/hotpatch-27.c new file mode 100644 index 00000000000..cdbd4caf90e --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/hotpatch-27.c @@ -0,0 +1,17 @@ +/* Functional tests for the function hotpatching feature. */ + +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch -mhotpatch=1,2" } */ + +__attribute__ ((noreturn)) void hp3(void) +{ + __builtin_unreachable (); +} + +/* Check number of occurences of certain instructions. */ +/* { dg-final { scan-assembler "pre-label NOPs" } } */ +/* { dg-final { scan-assembler "^\[^.\].*:\n.*post-label.*(2 halfwords).*\n\(\(.L.*:\n\)\|\(\[\[:space:\]\]*.cfi_.*\n\)\)*\[\[:space:\]\]*nop\t0" } } */ +/* { dg-final { scan-assembler-times "nopr\t%r7" 1 } } */ +/* { dg-final { scan-assembler-times "nop\t0" 1 } } */ +/* { dg-final { scan-assembler-not "brcl\t0, 0" } } */ +/* { dg-final { scan-assembler "alignment for hotpatch" } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-28.c b/gcc/testsuite/gcc.target/s390/hotpatch-28.c new file mode 100644 index 00000000000..9922daa8ac4 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/hotpatch-28.c @@ -0,0 +1,18 @@ +/* Functional tests for the function hotpatching feature. */ + +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch -mhotpatch=1,2" } */ + +void hp1 (volatile unsigned int *i) +{ + for (;;) + (*i)++; +} + +/* Check number of occurences of certain instructions. */ +/* { dg-final { scan-assembler "pre-label NOPs" } } */ +/* { dg-final { scan-assembler "^\[^.\].*:\n.*post-label.*(2 halfwords).*\n\(\(.L.*:\n\)\|\(\[\[:space:\]\]*.cfi_.*\n\)\)*\[\[:space:\]\]*nop\t0" } } */ +/* { dg-final { scan-assembler-times "nopr\t%r7" 1 } } */ +/* { dg-final { scan-assembler-times "nop\t0" 1 } } */ +/* { dg-final { scan-assembler-not "brcl\t0, 0" } } */ +/* { dg-final { scan-assembler "alignment for hotpatch" } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-3.c b/gcc/testsuite/gcc.target/s390/hotpatch-3.c index ec4a978f72e..671859116d4 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-3.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-3.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch -mhotpatch=0,2" } */ +/* { dg-options "-mzarch -mhotpatch=0,2" } */ #include @@ -12,7 +12,7 @@ void hp1(void) /* Check number of occurences of certain instructions. */ /* { dg-final { scan-assembler-not "pre-label NOPs" } } */ -/* { dg-final { scan-assembler "post-label.*(2 halfwords)" } } */ +/* { dg-final { scan-assembler "^\[^.\].*:\n.*post-label.*(2 halfwords).*\n\(\(.L.*:\n\)\|\(\[\[:space:\]\]*.cfi_.*\n\)\)*\[\[:space:\]\]*nop\t0" } } */ /* { dg-final { scan-assembler-not "nopr\t%r7" } } */ /* { dg-final { scan-assembler-times "nop\t0" 1 } } */ /* { dg-final { scan-assembler-not "brcl\t0, 0" } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-4.c b/gcc/testsuite/gcc.target/s390/hotpatch-4.c index d55e71d3d69..b770d4bd671 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-4.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-4.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch -mhotpatch=0,3" } */ +/* { dg-options "-mzarch -mhotpatch=0,3" } */ #include @@ -12,7 +12,7 @@ void hp1(void) /* Check number of occurences of certain instructions. */ /* { dg-final { scan-assembler-not "pre-label NOPs" } } */ -/* { dg-final { scan-assembler "post-label.*(3 halfwords)" } } */ +/* { dg-final { scan-assembler "^\[^.\].*:\n.*post-label.*(3 halfwords).*\n\(\(.L.*:\n\)\|\(\[\[:space:\]\]*.cfi_.*\n\)\)*\[\[:space:\]\]*brcl\t0, 0" } } */ /* { dg-final { scan-assembler-not "nopr\t%r7" } } */ /* { dg-final { scan-assembler-not "nop\t0" } } */ /* { dg-final { scan-assembler-times "brcl\t0, 0" 1 } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-5.c b/gcc/testsuite/gcc.target/s390/hotpatch-5.c index f77d83aea07..f1dcd89def6 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-5.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-5.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch -mhotpatch=0,4" } */ +/* { dg-options "-mzarch -mhotpatch=0,4" } */ #include @@ -12,7 +12,7 @@ void hp1(void) /* Check number of occurences of certain instructions. */ /* { dg-final { scan-assembler-not "pre-label NOPs" } } */ -/* { dg-final { scan-assembler "post-label.*(4 halfwords)" } } */ +/* { dg-final { scan-assembler "^\[^.\].*:\n.*post-label.*(4 halfwords).*\n\(\(.L.*:\n\)\|\(\[\[:space:\]\]*.cfi_.*\n\)\)*\[\[:space:\]\]*brcl\t0, 0" } } */ /* { dg-final { scan-assembler-times "nopr\t%r7" 1 } } */ /* { dg-final { scan-assembler-not "nop\t0" } } */ /* { dg-final { scan-assembler-times "brcl\t0, 0" 1 } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-6.c b/gcc/testsuite/gcc.target/s390/hotpatch-6.c index 330cf5d011f..6203a72ba2e 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-6.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-6.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch -mhotpatch=0,5" } */ +/* { dg-options "-mzarch -mhotpatch=0,5" } */ #include @@ -12,7 +12,7 @@ void hp1(void) /* Check number of occurences of certain instructions. */ /* { dg-final { scan-assembler-not "pre-label NOPs" } } */ -/* { dg-final { scan-assembler "post-label.*(5 halfwords)" } } */ +/* { dg-final { scan-assembler "^\[^.\].*:\n.*post-label.*(5 halfwords).*\n\(\(.L.*:\n\)\|\(\[\[:space:\]\]*.cfi_.*\n\)\)*\[\[:space:\]\]*brcl\t0, 0" } } */ /* { dg-final { scan-assembler-not "nopr\t%r7" } } */ /* { dg-final { scan-assembler-times "nop\t0" 1 } } */ /* { dg-final { scan-assembler-times "brcl\t0, 0" 1 } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-7.c b/gcc/testsuite/gcc.target/s390/hotpatch-7.c index 2f24e3cc152..e201ae940e6 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-7.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-7.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch -mhotpatch=0,6" } */ +/* { dg-options "-mzarch -mhotpatch=0,6" } */ #include @@ -12,7 +12,7 @@ void hp1(void) /* Check number of occurences of certain instructions. */ /* { dg-final { scan-assembler-not "pre-label NOPs" } } */ -/* { dg-final { scan-assembler "post-label.*(6 halfwords)" } } */ +/* { dg-final { scan-assembler "^\[^.\].*:\n.*post-label.*(6 halfwords).*\n\(\(.L.*:\n\)\|\(\[\[:space:\]\]*.cfi_.*\n\)\)*\[\[:space:\]\]*brcl\t0, 0" } } */ /* { dg-final { scan-assembler-not "nopr\t%r7" } } */ /* { dg-final { scan-assembler-not "nop\t0" } } */ /* { dg-final { scan-assembler-times "brcl\t0, 0" 2 } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-8.c b/gcc/testsuite/gcc.target/s390/hotpatch-8.c index 7b266bd463e..1ea3160c0f2 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-8.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-8.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile { target { ! lp64 } } } */ -/* { dg-options "-O3 -mesa -march=g5 -mhotpatch=0,3" } */ +/* { dg-options "-mesa -march=g5 -mhotpatch=0,3" } */ #include @@ -12,7 +12,7 @@ void hp1(void) /* Check number of occurences of certain instructions. */ /* { dg-final { scan-assembler-not "pre-label NOPs" } } */ -/* { dg-final { scan-assembler "post-label.*(3 halfwords)" } } */ +/* { dg-final { scan-assembler "^\[^.\].*:\n.*post-label.*(3 halfwords).*\n\(\(.L.*:\n\)\|\(\[\[:space:\]\]*.cfi_.*\n\)\)*\[\[:space:\]\]*nop\t0" } } */ /* { dg-final { scan-assembler-times "nopr\t%r7" 1 } } */ /* { dg-final { scan-assembler-times "nop\t0" 1 } } */ /* { dg-final { scan-assembler-not "brcl\t0, 0" } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-9.c b/gcc/testsuite/gcc.target/s390/hotpatch-9.c index c0ad319c0bb..e30f2762d33 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-9.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-9.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile { target { ! lp64 } } } */ -/* { dg-options "-O3 -mesa -march=g5 -mhotpatch=0,4" } */ +/* { dg-options "-mesa -march=g5 -mhotpatch=0,4" } */ #include @@ -12,7 +12,7 @@ void hp1(void) /* Check number of occurences of certain instructions. */ /* { dg-final { scan-assembler-not "pre-label NOPs" } } */ -/* { dg-final { scan-assembler "post-label.*(4 halfwords)" } } */ +/* { dg-final { scan-assembler "^\[^.\].*:\n.*post-label.*(4 halfwords).*\n\(\(.L.*:\n\)\|\(\[\[:space:\]\]*.cfi_.*\n\)\)*\[\[:space:\]\]*nop\t0" } } */ /* { dg-final { scan-assembler-not "nopr\t%r7" } } */ /* { dg-final { scan-assembler-times "nop\t0" 2 } } */ /* { dg-final { scan-assembler-not "brcl\t0, 0" } } */ diff --git a/gcc/testsuite/gcc.target/s390/s390.exp b/gcc/testsuite/gcc.target/s390/s390.exp index eb1d73b5fbf..0b8f80ed669 100644 --- a/gcc/testsuite/gcc.target/s390/s390.exp +++ b/gcc/testsuite/gcc.target/s390/s390.exp @@ -61,12 +61,21 @@ if ![info exists DEFAULT_CFLAGS] then { # Initialize `dg'. dg-init +set hotpatch_tests $srcdir/$subdir/hotpatch-\[0-9\]*.c + # Main loop. -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \ - "" $DEFAULT_CFLAGS +dg-runtest [lsort [prune [glob -nocomplain $srcdir/$subdir/*.\[cS\]] \ + $hotpatch_tests]] "" $DEFAULT_CFLAGS dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*vector*/*.\[cS\]]] \ "" $DEFAULT_CFLAGS +# Additional hotpatch torture tests. +torture-init +set HOTPATCH_TEST_OPTS [list -Os -O0 -O1 -O2 -O3] +set-torture-options $HOTPATCH_TEST_OPTS +gcc-dg-runtest [lsort [glob -nocomplain $hotpatch_tests]] "" $DEFAULT_CFLAGS +torture-finish + # All done. dg-finish -- 2.30.2