aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDominik Vogt <vogt@linux.vnet.ibm.com>2015-05-29 14:26:56 +0000
committerAndreas Krebbel <krebbel@gcc.gnu.org>2015-05-29 14:26:56 +0000
commit1f8d3e42524c94ca20e88864c12f789b0520c48c (patch)
treef81d3bad74a81a066164f6551e08803e5e73dbad /gcc
parent75eb64433edb2a48c471c50e729612a326d1b1e9 (diff)
downloadgcc-1f8d3e42524c94ca20e88864c12f789b0520c48c.zip
gcc-1f8d3e42524c94ca20e88864c12f789b0520c48c.tar.gz
gcc-1f8d3e42524c94ca20e88864c12f789b0520c48c.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/s390/s390.c28
-rw-r--r--gcc/testsuite/ChangeLog39
-rw-r--r--gcc/testsuite/gcc.target/s390/hotpatch-1.c2
-rw-r--r--gcc/testsuite/gcc.target/s390/hotpatch-10.c2
-rw-r--r--gcc/testsuite/gcc.target/s390/hotpatch-11.c2
-rw-r--r--gcc/testsuite/gcc.target/s390/hotpatch-12.c2
-rw-r--r--gcc/testsuite/gcc.target/s390/hotpatch-13.c3
-rw-r--r--gcc/testsuite/gcc.target/s390/hotpatch-14.c4
-rw-r--r--gcc/testsuite/gcc.target/s390/hotpatch-15.c4
-rw-r--r--gcc/testsuite/gcc.target/s390/hotpatch-16.c4
-rw-r--r--gcc/testsuite/gcc.target/s390/hotpatch-17.c2
-rw-r--r--gcc/testsuite/gcc.target/s390/hotpatch-18.c2
-rw-r--r--gcc/testsuite/gcc.target/s390/hotpatch-19.c4
-rw-r--r--gcc/testsuite/gcc.target/s390/hotpatch-2.c4
-rw-r--r--gcc/testsuite/gcc.target/s390/hotpatch-20.c2
-rw-r--r--gcc/testsuite/gcc.target/s390/hotpatch-21.c2
-rw-r--r--gcc/testsuite/gcc.target/s390/hotpatch-22.c2
-rw-r--r--gcc/testsuite/gcc.target/s390/hotpatch-23.c2
-rw-r--r--gcc/testsuite/gcc.target/s390/hotpatch-24.c2
-rw-r--r--gcc/testsuite/gcc.target/s390/hotpatch-25.c9
-rw-r--r--gcc/testsuite/gcc.target/s390/hotpatch-26.c17
-rw-r--r--gcc/testsuite/gcc.target/s390/hotpatch-27.c17
-rw-r--r--gcc/testsuite/gcc.target/s390/hotpatch-28.c18
-rw-r--r--gcc/testsuite/gcc.target/s390/hotpatch-3.c4
-rw-r--r--gcc/testsuite/gcc.target/s390/hotpatch-4.c4
-rw-r--r--gcc/testsuite/gcc.target/s390/hotpatch-5.c4
-rw-r--r--gcc/testsuite/gcc.target/s390/hotpatch-6.c4
-rw-r--r--gcc/testsuite/gcc.target/s390/hotpatch-7.c4
-rw-r--r--gcc/testsuite/gcc.target/s390/hotpatch-8.c4
-rw-r--r--gcc/testsuite/gcc.target/s390/hotpatch-9.c4
-rw-r--r--gcc/testsuite/gcc.target/s390/s390.exp13
32 files changed, 165 insertions, 55 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c8b1c44..1d59898 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2015-05-29 Dominik Vogt <vogt@linux.vnet.ibm.com>
+
+ PR target/66215
+ * config/s390/s390.c (s390_reorg): Fix placement of post-label NOPs
+ with -mhotpatch=.
+
2015-05-29 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/66142
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 6648597..90d43b1 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 b672447..2fe348a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,42 @@
+2015-05-29 Dominik Vogt <vogt@linux.vnet.ibm.com>
+
+ 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 <kyrylo.tkachov@arm.com>
* 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 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 2f24e3c..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