From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id CF46B3858D32 for ; Tue, 5 Sep 2023 14:43:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CF46B3858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9E52C11FB; Tue, 5 Sep 2023 07:43:45 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.110.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DE7B93F67D; Tue, 5 Sep 2023 07:43:06 -0700 (PDT) From: Richard Sandiford To: Szabolcs Nagy Mail-Followup-To: Szabolcs Nagy ,, , , richard.sandiford@arm.com Cc: , , Subject: Re: [PATCH 05/11] aarch64: Add eh_return compile tests References: Date: Tue, 05 Sep 2023 15:43:05 +0100 In-Reply-To: (Szabolcs Nagy's message of "Tue, 22 Aug 2023 11:38:42 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-25.2 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_NONE,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,KAM_SHORT,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Szabolcs Nagy writes: > gcc/testsuite/ChangeLog: > > * gcc.target/aarch64/eh_return-2.c: New test. > * gcc.target/aarch64/eh_return-3.c: New test. OK. I wonder if it's worth using check-function-bodies for -3.c though. It would then be easy to verify that the autiasp only occurs on the normal return path. Just a suggestion -- the current test is fine too. Thanks, Richard > --- > gcc/testsuite/gcc.target/aarch64/eh_return-2.c | 9 +++++++++ > gcc/testsuite/gcc.target/aarch64/eh_return-3.c | 14 ++++++++++++++ > 2 files changed, 23 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..35989eee806 > --- /dev/null > +++ b/gcc/testsuite/gcc.target/aarch64/eh_return-3.c > @@ -0,0 +1,14 @@ > +/* { dg-do compile } */ > +/* { dg-options "-O2 -mbranch-protection=pac-ret+leaf" } */ > +/* { dg-final { scan-assembler "add\tsp, sp, x5" } } */ > +/* { dg-final { scan-assembler "br\tx6" } } */ > +/* { dg-final { scan-assembler "hint\t25 // paciasp" } } */ > +/* { dg-final { scan-assembler "hint\t29 // autiasp" } } */ > + > +void > +foo (unsigned long off, void *handler, int c) > +{ > + if (c) > + return; > + __builtin_eh_return (off, handler); > +}