This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
The attached patch fixes the problem reported in PR 66215. Patches for gcc-4.8, 4.9 and 5.1 will follow. Ciao Dominik ^_^ ^_^ -- Dominik Vogt IBM Germany
Attachment:
ChangeLog
Description: Text document
>From c4fc2eb77035ff4f8cd78f48fa8f7b2731c19ade Mon Sep 17 00:00:00 2001 From: Dominik Vogt <vogt@linux.vnet.ibm.com> Date: Fri, 22 May 2015 09:03:26 +0100 Subject: [PATCH] PR 66215: S390: Fix placement of post-label NOPs with -mhotpatch=. --- gcc/config/s390/s390.c | 27 ++++++++++++++++----------- 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 +++++++++++-- 30 files changed, 119 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/config/s390/s390.c b/gcc/config/s390/s390.c index 6648597..bab9460 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -12843,31 +12843,36 @@ 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 + * (gcc_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/gcc.target/s390/hotpatch-1.c b/gcc/testsuite/gcc.target/s390/hotpatch-1.c index b14fa90..55088b8 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 <stdio.h> diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-10.c b/gcc/testsuite/gcc.target/s390/hotpatch-10.c index a990c4c..d2cb9a2 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 <stdio.h> diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-11.c b/gcc/testsuite/gcc.target/s390/hotpatch-11.c index 6f8a52b..cabb9d26 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 <stdio.h> diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-12.c b/gcc/testsuite/gcc.target/s390/hotpatch-12.c index b73ca90..fc9adc3 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 <stdio.h> diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-13.c b/gcc/testsuite/gcc.target/s390/hotpatch-13.c index 150667a..b25fbd3 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 <stdio.h> @@ -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 c5f118c..c387d6b 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 <stdio.h> @@ -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 ef0fb74..410106b 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 <stdio.h> @@ -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 a34bf95..fa06fff 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 <stdio.h> @@ -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 66ac725..3ef7d69 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 <stdio.h> diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-18.c b/gcc/testsuite/gcc.target/s390/hotpatch-18.c index 8b076a4..c93af7f 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 <stdio.h> diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-19.c b/gcc/testsuite/gcc.target/s390/hotpatch-19.c index 6993c7e..c69b35e 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 <stdio.h> @@ -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 67189f8..2a2665e 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 <stdio.h> @@ -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 09ef5ca..0a32a68 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 <stdio.h> diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-21.c b/gcc/testsuite/gcc.target/s390/hotpatch-21.c index e909990..f6e9099 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 <stdio.h> diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-22.c b/gcc/testsuite/gcc.target/s390/hotpatch-22.c index d89d779..21f7d7e 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 <stdio.h> diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-23.c b/gcc/testsuite/gcc.target/s390/hotpatch-23.c index 1e05d12..6e149cc 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 <stdio.h> diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-24.c b/gcc/testsuite/gcc.target/s390/hotpatch-24.c index fc64274..1e47591 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 <stdio.h> diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-25.c b/gcc/testsuite/gcc.target/s390/hotpatch-25.c index e9257e3..e6cdbb6 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 0000000..eb95c26 --- /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 0000000..cdbd4ca --- /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 0000000..9922daa --- /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 ec4a978..6718591 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 <stdio.h> @@ -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 d55e71d..b770d4b 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 <stdio.h> @@ -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 f77d83a..f1dcd89 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 <stdio.h> @@ -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 330cf5d..6203a72b 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 <stdio.h> @@ -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 2f24e3cc..e201ae9 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 <stdio.h> @@ -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 7b266bd..1ea3160 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 <stdio.h> @@ -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 c0ad319..e30f276 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 <stdio.h> @@ -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 eb1d73b..0b8f80ed 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.3.0
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |