public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Szabolcs Nagy <szabolcs.nagy@arm.com>
To: <gcc-patches@gcc.gnu.org>
Subject: [PATCH v2 3/7] aarch64: Add eh_return compile tests
Date: Fri, 3 Nov 2023 15:36:20 +0000	[thread overview]
Message-ID: <60a89113beb96fc0183c8ebc2a0dc8d6feb91478.1699025214.git.szabolcs.nagy@arm.com> (raw)
In-Reply-To: <cover.1699025214.git.szabolcs.nagy@arm.com>

gcc/testsuite/ChangeLog:

	* gcc.target/aarch64/eh_return-2.c: New test.
	* gcc.target/aarch64/eh_return-3.c: New test.

---
v2: check-function-bodies in eh_return-3.c
(this is not very robust, but easier to read)
---
 .../gcc.target/aarch64/eh_return-2.c          |  9 ++++++
 .../gcc.target/aarch64/eh_return-3.c          | 30 +++++++++++++++++++
 2 files changed, 39 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/aarch64/eh_return-2.c
 create mode 100644 gcc/testsuite/gcc.target/aarch64/eh_return-3.c

diff --git a/gcc/testsuite/gcc.target/aarch64/eh_return-2.c b/gcc/testsuite/gcc.target/aarch64/eh_return-2.c
new file mode 100644
index 00000000000..4a9d124e891
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/eh_return-2.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-final { scan-assembler "add\tsp, sp, x5" } } */
+/* { dg-final { scan-assembler "br\tx6" } } */
+
+void
+foo (unsigned long off, void *handler)
+{
+  __builtin_eh_return (off, handler);
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/eh_return-3.c b/gcc/testsuite/gcc.target/aarch64/eh_return-3.c
new file mode 100644
index 00000000000..bfbe92af427
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/eh_return-3.c
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mbranch-protection=pac-ret+leaf" } */
+/* { dg-final { check-function-bodies "**" "" "" } } */
+
+/*
+**foo:
+**	hint	25 // paciasp
+**	stp	x0, x1, .*
+**	stp	x2, x3, .*
+**	cbz	w2, .*
+**	mov	x4, 0
+**	ldp	x2, x3, .*
+**	ldp	x0, x1, .*
+**	cbz	x4, .*
+**	add	sp, sp, x5
+**	br	x6
+**	hint	29 // autiasp
+**	ret
+**	mov	x5, x0
+**	mov	x6, x1
+**	mov	x4, 1
+**	b	.*
+*/
+void
+foo (unsigned long off, void *handler, int c)
+{
+  if (c)
+    return;
+  __builtin_eh_return (off, handler);
+}
-- 
2.25.1


  parent reply	other threads:[~2023-11-03 15:36 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-03 15:36 [PATCH v2 0/7] aarch64 GCS preliminary patches Szabolcs Nagy
2023-11-03 15:36 ` [PATCH v2 1/7] aarch64: Use br instead of ret for eh_return Szabolcs Nagy
2023-11-13  0:27   ` Hans-Peter Nilsson
2023-11-13 11:18     ` Szabolcs Nagy
2023-11-26 12:11   ` Richard Sandiford
2023-11-03 15:36 ` [PATCH v2 2/7] aarch64: Do not force a stack frame for EH returns Szabolcs Nagy
2023-11-26 12:12   ` Richard Sandiford
2023-11-03 15:36 ` Szabolcs Nagy [this message]
2023-11-26 14:37   ` [PATCH v2 3/7] aarch64: Add eh_return compile tests Richard Sandiford
2023-11-27 10:04     ` Szabolcs Nagy
2023-11-27 15:57     ` Szabolcs Nagy
2023-12-02 19:23   ` Andrew Pinski
2023-11-03 15:36 ` [PATCH v2 4/7] aarch64: Disable branch-protection for pcs tests Szabolcs Nagy
2023-11-03 15:36 ` [PATCH v2 5/7] aarch64,arm: Remove accepted_branch_protection_string Szabolcs Nagy
2023-11-26 14:50   ` Richard Sandiford
2023-11-03 15:36 ` [PATCH v2 6/7] aarch64,arm: Fix branch-protection= parsing Szabolcs Nagy
2023-12-07 13:02   ` Richard Earnshaw
2023-11-03 15:36 ` [PATCH v2 7/7] aarch64,arm: Move branch-protection data to targets Szabolcs Nagy
2023-12-07 13:13   ` Richard Earnshaw
2024-01-11 14:43     ` Szabolcs Nagy
2024-01-11 14:49       ` Richard Earnshaw (lists)

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=60a89113beb96fc0183c8ebc2a0dc8d6feb91478.1699025214.git.szabolcs.nagy@arm.com \
    --to=szabolcs.nagy@arm.com \
    --cc=gcc-patches@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: link
Be 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).