public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Andreas Krebbel <krebbel@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-5813] IBM Z: Change Pmode to word_mode for stack probes Date: Mon, 7 Dec 2020 08:48:46 +0000 (GMT) [thread overview] Message-ID: <20201207084846.56458385EC54@sourceware.org> (raw) https://gcc.gnu.org/g:bf615bf65a0035cac3d4ac229e6413aad3b1d44a commit r11-5813-gbf615bf65a0035cac3d4ac229e6413aad3b1d44a Author: Andreas Krebbel <krebbel@linux.ibm.com> Date: Mon Dec 7 09:42:39 2020 +0100 IBM Z: Change Pmode to word_mode for stack probes In s390.c we are still using Pmode for the stack probes. This breaks with -m31 -mzarch where Pmode != word_mode. The patch also adds a new target check to s390.exp which allows us to implement zarch specific checks in the testcases. gcc/ChangeLog: * config/s390/s390.c (s390_emit_stack_probe): Change Pmode to word_mode. gcc/testsuite/ChangeLog: * gcc.target/s390/s390.exp: New target check s390_zarch. * gcc.target/s390/stack-clash-1.c: Use s390_zarch instead of lp64. * gcc.target/s390/stack-clash-2.c: Likewise. * gcc.target/s390/stack-clash-3.c: Likewise. * gcc.target/s390/stack-clash-5.c: New test. Diff: --- gcc/config/s390/s390.c | 2 +- gcc/testsuite/gcc.target/s390/s390.exp | 7 +++++++ gcc/testsuite/gcc.target/s390/stack-clash-1.c | 4 ++-- gcc/testsuite/gcc.target/s390/stack-clash-2.c | 4 ++-- gcc/testsuite/gcc.target/s390/stack-clash-3.c | 4 ++-- gcc/testsuite/gcc.target/s390/stack-clash-5.c | 10 ++++++++++ 6 files changed, 24 insertions(+), 7 deletions(-) diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index fb48102559d..2f839882d96 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -11082,7 +11082,7 @@ s390_prologue_plus_offset (rtx target, rtx reg, rtx offset, bool frame_related_p static void s390_emit_stack_probe (rtx addr) { - rtx mem = gen_rtx_MEM (Pmode, addr); + rtx mem = gen_rtx_MEM (word_mode, addr); MEM_VOLATILE_P (mem) = 1; emit_insn (gen_probe_stack (mem)); } diff --git a/gcc/testsuite/gcc.target/s390/s390.exp b/gcc/testsuite/gcc.target/s390/s390.exp index 00e0555d55c..d76d80dd0f3 100644 --- a/gcc/testsuite/gcc.target/s390/s390.exp +++ b/gcc/testsuite/gcc.target/s390/s390.exp @@ -202,6 +202,13 @@ proc check_effective_target_s390_z14_hw { } { } }] "-march=z14 -m64 -mzarch" ] } { return 0 } else { return 1 } } +# Return 1 if the default compiler options enable z/Architecture mode +proc check_effective_target_s390_zarch { } { + return [check_no_compiler_messages s390_zarch object { + int dummy[sizeof (int __attribute__((__mode__(__word__)))) == 8 + ? 1 : -1]; + }] +} # If a testcase doesn't have special options, use these. global DEFAULT_CFLAGS diff --git a/gcc/testsuite/gcc.target/s390/stack-clash-1.c b/gcc/testsuite/gcc.target/s390/stack-clash-1.c index 3d29cab9446..45221c4ef82 100644 --- a/gcc/testsuite/gcc.target/s390/stack-clash-1.c +++ b/gcc/testsuite/gcc.target/s390/stack-clash-1.c @@ -13,5 +13,5 @@ void large_stack() { /* We use a compare for the stack probe. There needs to be one inside a loop and another for the remaining bytes. */ -/* { dg-final { scan-assembler-times "cg\t" 2 { target lp64 } } } */ -/* { dg-final { scan-assembler-times "c\t" 2 { target { ! lp64 } } } } */ +/* { dg-final { scan-assembler-times "cg\t" 2 { target s390_zarch } } } */ +/* { dg-final { scan-assembler-times "c\t" 2 { target { ! s390_zarch } } } } */ diff --git a/gcc/testsuite/gcc.target/s390/stack-clash-2.c b/gcc/testsuite/gcc.target/s390/stack-clash-2.c index e554ad5ed0d..20f645de347 100644 --- a/gcc/testsuite/gcc.target/s390/stack-clash-2.c +++ b/gcc/testsuite/gcc.target/s390/stack-clash-2.c @@ -13,5 +13,5 @@ foo () /* For alloca a common code routine emits the probes. Make sure the "probe_stack" expander is used in that case. We want to use mem compares instead of stores. */ -/* { dg-final { scan-assembler-times "cg\t" 5 { target lp64 } } } */ -/* { dg-final { scan-assembler-times "c\t" 5 { target { ! lp64 } } } } */ +/* { dg-final { scan-assembler-times "cg\t" 5 { target s390_zarch } } } */ +/* { dg-final { scan-assembler-times "c\t" 5 { target { ! s390_zarch } } } } */ diff --git a/gcc/testsuite/gcc.target/s390/stack-clash-3.c b/gcc/testsuite/gcc.target/s390/stack-clash-3.c index 929d3fbb365..12a2d34cacf 100644 --- a/gcc/testsuite/gcc.target/s390/stack-clash-3.c +++ b/gcc/testsuite/gcc.target/s390/stack-clash-3.c @@ -13,5 +13,5 @@ foo () /* For alloca a common code routine emits the probes. Make sure the "probe_stack" expander is used in that case. We want to use mem compares instead of stores. */ -/* { dg-final { scan-assembler-times "cg\t" 5 { target lp64 } } } */ -/* { dg-final { scan-assembler-times "c\t" 5 { target { ! lp64 } } } } */ +/* { dg-final { scan-assembler-times "cg\t" 5 { target s390_zarch } } } */ +/* { dg-final { scan-assembler-times "c\t" 5 { target { ! s390_zarch } } } } */ diff --git a/gcc/testsuite/gcc.target/s390/stack-clash-5.c b/gcc/testsuite/gcc.target/s390/stack-clash-5.c new file mode 100644 index 00000000000..81e202e2aab --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/stack-clash-5.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -m31 -mzarch -fstack-clash-protection" } */ + +extern void bar (char*); + +void +foo() { + char a[4000]; + bar (a) ; +}
reply other threads:[~2020-12-07 8:48 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20201207084846.56458385EC54@sourceware.org \ --to=krebbel@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).