Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP1:GA
cross-sparc64-gcc7
gcc7-pfe-0006-Backport-IBM-Z-Use-the-dedicated-...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File gcc7-pfe-0006-Backport-IBM-Z-Use-the-dedicated-NOP-instructions-fo.patch of Package cross-sparc64-gcc7
From 93132e0ab8aacedc740513c8e3d4ffd3bb0b8db7 Mon Sep 17 00:00:00 2001 From: Andreas Krebbel <krebbel@linux.vnet.ibm.com> Date: Fri, 6 Apr 2018 07:45:42 +0000 Subject: [PATCH 06/22] Backport IBM Z: Use the dedicated NOP instructions for "nop" We still use lr r0,r0 as a NOP instruction although we have some kind of dedicated NOP instruction (nopr) which maps to a "branch never". As a side-effect this fixes testcases scanning for NOPs e.g. patchable_function_entry-*. As another side-effect this makes it difficult to distingiush NOPs generated for hotpatching from NOPs added when using -O0 to attach location information to it. Hence I had to make sure that the hotpatch testcases get skipped when compiling without optimization. 2021-10-07 Giuliano Belinassi <gbelinassi@suse.de> Backport from mainline gcc/ChangeLog: 2018-04-06 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * config/s390/s390.c (s390_z10_optimize_cmp): Expand dedicated NOP instructions. * config/s390/s390.md (UNSPECV_NOP_LR_0, UNSPECV_NOP_LR_1): New constant definitions. ("nop"): lr 0,0 -> nopr r0 ("nop_lr0", "nop_lr1"): New insn definitions. gcc/testsuite/ChangeLog: 2018-04-06 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * gcc.target/s390/s390.exp: Remove -O0 from list of torture options. * gcc.target/s390/hotpatch-1.c: Skip when building without optimization. * 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-13.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-17.c: Likewise. * gcc.target/s390/hotpatch-18.c: Likewise. * gcc.target/s390/hotpatch-19.c: Likewise. * gcc.target/s390/hotpatch-2.c: Likewise. * 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/config/s390/s390.c | 4 ++-- gcc/config/s390/s390.md | 17 +++++++++++++++-- gcc/testsuite/gcc.target/s390/hotpatch-1.c | 7 +++++++ gcc/testsuite/gcc.target/s390/hotpatch-10.c | 1 + gcc/testsuite/gcc.target/s390/hotpatch-11.c | 1 + gcc/testsuite/gcc.target/s390/hotpatch-12.c | 1 + gcc/testsuite/gcc.target/s390/hotpatch-13.c | 1 + gcc/testsuite/gcc.target/s390/hotpatch-14.c | 1 + gcc/testsuite/gcc.target/s390/hotpatch-15.c | 1 + gcc/testsuite/gcc.target/s390/hotpatch-16.c | 1 + gcc/testsuite/gcc.target/s390/hotpatch-17.c | 1 + gcc/testsuite/gcc.target/s390/hotpatch-18.c | 1 + gcc/testsuite/gcc.target/s390/hotpatch-19.c | 1 + gcc/testsuite/gcc.target/s390/hotpatch-2.c | 1 + gcc/testsuite/gcc.target/s390/hotpatch-3.c | 1 + gcc/testsuite/gcc.target/s390/hotpatch-4.c | 1 + gcc/testsuite/gcc.target/s390/hotpatch-5.c | 1 + gcc/testsuite/gcc.target/s390/hotpatch-6.c | 1 + gcc/testsuite/gcc.target/s390/hotpatch-7.c | 1 + gcc/testsuite/gcc.target/s390/hotpatch-8.c | 1 + gcc/testsuite/gcc.target/s390/hotpatch-9.c | 1 + gcc/testsuite/gcc.target/s390/s390.exp | 2 +- 22 files changed, 43 insertions(+), 5 deletions(-) diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 0161ba03ff3..b1db263d37c 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -13966,9 +13966,9 @@ s390_z10_optimize_cmp (rtx_insn *insn) && s390_non_addr_reg_read_p (*op0, prev_insn)) { if (REGNO (*op1) == 0) - emit_insn_after (gen_nop1 (), insn); + emit_insn_after (gen_nop_lr1 (), insn); else - emit_insn_after (gen_nop (), insn); + emit_insn_after (gen_nop_lr0 (), insn); insn_added_p = true; } else diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md index bb399354855..e134d7f2972 100644 --- a/gcc/config/s390/s390.md +++ b/gcc/config/s390/s390.md @@ -267,6 +267,10 @@ UNSPECV_CAS UNSPECV_ATOMIC_OP + ; Non-branch nops used for compare-and-branch adjustments on z10 + UNSPECV_NOP_LR_0 + UNSPECV_NOP_LR_1 + ; Hotpatching (unremovable NOPs) UNSPECV_NOP_2_BYTE UNSPECV_NOP_4_BYTE @@ -11006,12 +11010,21 @@ (define_insn "nop" [(const_int 0)] "" + "nopr\t%%r0" + [(set_attr "op_type" "RR")]) + +; non-branch NOPs required for optimizing compare-and-branch patterns +; on z10 + +(define_insn "nop_lr0" + [(unspec_volatile [(const_int 0)] UNSPECV_NOP_LR_0)] + "" "lr\t0,0" [(set_attr "op_type" "RR") (set_attr "z10prop" "z10_fr_E1")]) -(define_insn "nop1" - [(const_int 1)] +(define_insn "nop_lr1" + [(unspec_volatile [(const_int 0)] UNSPECV_NOP_LR_1)] "" "lr\t1,1" [(set_attr "op_type" "RR")]) diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-1.c b/gcc/testsuite/gcc.target/s390/hotpatch-1.c index 5f0f2e19349..67e101ee318 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-1.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-1.c @@ -3,6 +3,13 @@ /* { dg-do compile } */ /* { dg-options "-mzarch" } */ +/* Without optimization extra NOPs will be added just to attach + location info to it. Don't run the test in that case. The torture + framework always appears to run the testcase without -O option + first. */ + +/* { dg-skip-if "" { *-*-* } { "*" } { "-O*" } } */ + #include <stdio.h> void hp1(void) diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-10.c b/gcc/testsuite/gcc.target/s390/hotpatch-10.c index 2308d3331a0..21d499e6204 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-10.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-10.c @@ -2,6 +2,7 @@ /* { dg-do compile } */ /* { dg-options "-mzarch -mhotpatch=0,0" } */ +/* { dg-skip-if "" { *-*-* } { "*" } { "-O*" } } */ #include <stdio.h> diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-11.c b/gcc/testsuite/gcc.target/s390/hotpatch-11.c index 56b3596d497..a37f3117c64 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-11.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-11.c @@ -2,6 +2,7 @@ /* { dg-do compile } */ /* { dg-options "-mzarch -mhotpatch=1,0" } */ +/* { dg-skip-if "" { *-*-* } { "*" } { "-O*" } } */ #include <stdio.h> diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-12.c b/gcc/testsuite/gcc.target/s390/hotpatch-12.c index 8a91c1b8b06..cb8d1521bfa 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-12.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-12.c @@ -2,6 +2,7 @@ /* { dg-do compile } */ /* { dg-options "-mzarch -mhotpatch=999,0" } */ +/* { dg-skip-if "" { *-*-* } { "*" } { "-O*" } } */ #include <stdio.h> diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-13.c b/gcc/testsuite/gcc.target/s390/hotpatch-13.c index 70fab74d18d..fb037c2040f 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-13.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-13.c @@ -2,6 +2,7 @@ /* { dg-do compile } */ /* { dg-options "-mzarch" } */ +/* { dg-skip-if "" { *-*-* } { "*" } { "-O*" } } */ #include <stdio.h> diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-14.c b/gcc/testsuite/gcc.target/s390/hotpatch-14.c index 389bf42aee8..fd0368a55ae 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-14.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-14.c @@ -2,6 +2,7 @@ /* { dg-do compile } */ /* { dg-options "-mzarch" } */ +/* { dg-skip-if "" { *-*-* } { "*" } { "-O*" } } */ #include <stdio.h> diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-15.c b/gcc/testsuite/gcc.target/s390/hotpatch-15.c index 0b10fb18b41..a1c3e7c694b 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-15.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-15.c @@ -2,6 +2,7 @@ /* { dg-do compile } */ /* { dg-options "-mzarch" } */ +/* { dg-skip-if "" { *-*-* } { "*" } { "-O*" } } */ #include <stdio.h> diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-16.c b/gcc/testsuite/gcc.target/s390/hotpatch-16.c index 2fcdf1ce765..737c3a1c071 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-16.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-16.c @@ -2,6 +2,7 @@ /* { dg-do compile } */ /* { dg-options "-mzarch -mhotpatch=0,0" } */ +/* { dg-skip-if "" { *-*-* } { "*" } { "-O*" } } */ #include <stdio.h> diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-17.c b/gcc/testsuite/gcc.target/s390/hotpatch-17.c index 299f82505ee..6d8c40c65c0 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-17.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-17.c @@ -2,6 +2,7 @@ /* { dg-do compile } */ /* { dg-options "-mzarch -mhotpatch=1,2" } */ +/* { dg-skip-if "" { *-*-* } { "*" } { "-O*" } } */ #include <stdio.h> diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-18.c b/gcc/testsuite/gcc.target/s390/hotpatch-18.c index fd44d118323..02807ff7b6e 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-18.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-18.c @@ -2,6 +2,7 @@ /* { dg-do compile } */ /* { dg-options "-mzarch -mhotpatch=1,2 -mhotpatch=0,0" } */ +/* { dg-skip-if "" { *-*-* } { "*" } { "-O*" } } */ #include <stdio.h> diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-19.c b/gcc/testsuite/gcc.target/s390/hotpatch-19.c index 899e000a71f..71c2ed13d18 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-19.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-19.c @@ -2,6 +2,7 @@ /* { dg-do compile } */ /* { dg-options "-mzarch -mhotpatch=1,2" } */ +/* { dg-skip-if "" { *-*-* } { "*" } { "-O*" } } */ #include <stdio.h> diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-2.c b/gcc/testsuite/gcc.target/s390/hotpatch-2.c index 99fe9114f24..ece6cb37e57 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-2.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-2.c @@ -2,6 +2,7 @@ /* { dg-do compile } */ /* { dg-options "-mzarch -mhotpatch=0,1" } */ +/* { dg-skip-if "" { *-*-* } { "*" } { "-O*" } } */ #include <stdio.h> diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-3.c b/gcc/testsuite/gcc.target/s390/hotpatch-3.c index 20f43c6b458..65ebe353688 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-3.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-3.c @@ -2,6 +2,7 @@ /* { dg-do compile } */ /* { dg-options "-mzarch -mhotpatch=0,2" } */ +/* { dg-skip-if "" { *-*-* } { "*" } { "-O*" } } */ #include <stdio.h> diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-4.c b/gcc/testsuite/gcc.target/s390/hotpatch-4.c index 32a3c032d65..d0956f14240 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-4.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-4.c @@ -2,6 +2,7 @@ /* { dg-do compile } */ /* { dg-options "-mzarch -mhotpatch=0,3" } */ +/* { dg-skip-if "" { *-*-* } { "*" } { "-O*" } } */ #include <stdio.h> diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-5.c b/gcc/testsuite/gcc.target/s390/hotpatch-5.c index 72ee5a30056..64d49eecb13 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-5.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-5.c @@ -2,6 +2,7 @@ /* { dg-do compile } */ /* { dg-options "-mzarch -mhotpatch=0,4" } */ +/* { dg-skip-if "" { *-*-* } { "*" } { "-O*" } } */ #include <stdio.h> diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-6.c b/gcc/testsuite/gcc.target/s390/hotpatch-6.c index 1e1d0e6973a..e6753c8385d 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-6.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-6.c @@ -2,6 +2,7 @@ /* { dg-do compile } */ /* { dg-options "-mzarch -mhotpatch=0,5" } */ +/* { dg-skip-if "" { *-*-* } { "*" } { "-O*" } } */ #include <stdio.h> diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-7.c b/gcc/testsuite/gcc.target/s390/hotpatch-7.c index 3f60e61e7e2..3f1c9f0e294 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-7.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-7.c @@ -2,6 +2,7 @@ /* { dg-do compile } */ /* { dg-options "-mzarch -mhotpatch=0,6" } */ +/* { dg-skip-if "" { *-*-* } { "*" } { "-O*" } } */ #include <stdio.h> diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-8.c b/gcc/testsuite/gcc.target/s390/hotpatch-8.c index 012a4ebd44d..a2fb83f2977 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-8.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-8.c @@ -2,6 +2,7 @@ /* { dg-do compile { target { ! lp64 } } } */ /* { dg-options "-mesa -march=g5 -Wno-deprecated -mhotpatch=0,3" } */ +/* { dg-skip-if "" { *-*-* } { "*" } { "-O*" } } */ #include <stdio.h> diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-9.c b/gcc/testsuite/gcc.target/s390/hotpatch-9.c index b7d557e43a2..34fae55d3ad 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-9.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-9.c @@ -2,6 +2,7 @@ /* { dg-do compile { target { ! lp64 } } } */ /* { dg-options "-mesa -march=g5 -Wno-deprecated -mhotpatch=0,4" } */ +/* { dg-skip-if "" { *-*-* } { "*" } { "-O*" } } */ #include <stdio.h> diff --git a/gcc/testsuite/gcc.target/s390/s390.exp b/gcc/testsuite/gcc.target/s390/s390.exp index 420aff19a3f..8489a51693b 100644 --- a/gcc/testsuite/gcc.target/s390/s390.exp +++ b/gcc/testsuite/gcc.target/s390/s390.exp @@ -220,7 +220,7 @@ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/md/*.{c,S,C}]] \ # Additional hotpatch torture tests. torture-init -set-torture-options [list -Os -O0 -O1 -O2 -O3] +set-torture-options [list -Os -O1 -O2 -O3] gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/hotpatch-\[0-9\]*.c]] \ "" $DEFAULT_CFLAGS torture-finish -- 2.33.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor