From patchwork Thu May 11 11:37:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 1779976 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=XPePAxBB; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QH8z30nnyz214S for ; Thu, 11 May 2023 21:38:07 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 204383856967 for ; Thu, 11 May 2023 11:38:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 204383856967 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1683805083; bh=XfRjhzKBnZDX0sKryxePcph/zAc/jie1b4SXQsNB9zA=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=XPePAxBBu/Pm5rytUN+gOeYBz1+On+jNbZQ9EdOxi6pm6o0XOMB/1umHkvheKmiD1 O826p1BhQVqpT4XOi7II5cpzaJ0cX2fV5IHXLzIVC01TJCxCejy7gYTzDOpbiMbm/z ltqyZ3zxw/ol7NN25UitgP6rReU7QysH6EyJ6/Og= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id BAFD43858C5F for ; Thu, 11 May 2023 11:37:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BAFD43858C5F 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 F37A71063 for ; Thu, 11 May 2023 04:38:25 -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 F314A3F5A1 for ; Thu, 11 May 2023 04:37:40 -0700 (PDT) To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [PATCH] aarch64: Remove alignment assertions [PR109661] Date: Thu, 11 May 2023 12:37:39 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 X-Spam-Status: No, score=-29.6 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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Richard Sandiford via Gcc-patches From: Richard Sandiford Reply-To: Richard Sandiford Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" The trunk patch for this PR corrected the ABI for enums that have a defined underlying type. We shouldn't change the ABI on the branches though, so this patch just removes the assertions that highlighed the problem. I think the same approach makes sense longer-term: keep the assertions at maximum strength in trunk, and in any new branches that get cut. Then, if the assertions trip an ABI problem, fix the problem in trunk and remove the assertions from active branches. The tests are the same as for the trunk version, but with all Wpsabi message and expected output checks removed. Tested on aarch64-linux-gnu & pushed to GCC 13. I'll do a similar patch for GCC 12. Richard gcc/ PR target/109661 * config/aarch64/aarch64.cc (aarch64_function_arg_alignment): Remove assertion. (aarch64_layout_arg): Likewise. gcc/testsuite/ PR target/109661 * g++.target/aarch64/pr109661-1.C: New test. * g++.target/aarch64/pr109661-2.C: Likewise. * g++.target/aarch64/pr109661-3.C: Likewise. * g++.target/aarch64/pr109661-4.C: Likewise. * gcc.target/aarch64/pr109661-1.c: Likewise. --- gcc/config/aarch64/aarch64.cc | 5 - gcc/testsuite/g++.target/aarch64/pr109661-1.C | 122 +++++++++++++++++ gcc/testsuite/g++.target/aarch64/pr109661-2.C | 123 ++++++++++++++++++ gcc/testsuite/g++.target/aarch64/pr109661-3.C | 123 ++++++++++++++++++ gcc/testsuite/g++.target/aarch64/pr109661-4.C | 123 ++++++++++++++++++ gcc/testsuite/gcc.target/aarch64/pr109661-1.c | 5 + 6 files changed, 496 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/g++.target/aarch64/pr109661-1.C create mode 100644 gcc/testsuite/g++.target/aarch64/pr109661-2.C create mode 100644 gcc/testsuite/g++.target/aarch64/pr109661-3.C create mode 100644 gcc/testsuite/g++.target/aarch64/pr109661-4.C create mode 100644 gcc/testsuite/gcc.target/aarch64/pr109661-1.c diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index 0f04ab9fba0..f5db5379543 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -7495,7 +7495,6 @@ aarch64_function_arg_alignment (machine_mode mode, const_tree type, gcc_assert (known_eq (POINTER_SIZE, GET_MODE_BITSIZE (mode))); return POINTER_SIZE; } - gcc_assert (!TYPE_USER_ALIGN (type)); return TYPE_ALIGN (type); } @@ -7714,10 +7713,6 @@ aarch64_layout_arg (cumulative_args_t pcum_v, const function_arg_info &arg) = aarch64_function_arg_alignment (mode, type, &abi_break, &abi_break_packed); - gcc_assert ((allocate_nvrn || alignment <= 16 * BITS_PER_UNIT) - && (!alignment || abi_break < alignment) - && (!abi_break_packed || alignment < abi_break_packed)); - /* allocate_ncrn may be false-positive, but allocate_nvrn is quite reliable. The following code thus handles passing by SIMD/FP registers first. */ diff --git a/gcc/testsuite/g++.target/aarch64/pr109661-1.C b/gcc/testsuite/g++.target/aarch64/pr109661-1.C new file mode 100644 index 00000000000..c579834358b --- /dev/null +++ b/gcc/testsuite/g++.target/aarch64/pr109661-1.C @@ -0,0 +1,122 @@ +/* { dg-options "-O2 -Wpsabi" } */ + +#include + +#define ALIGN + +typedef __uint128_t u128_4 __attribute__((aligned(4))); +typedef __uint128_t u128_8 __attribute__((aligned(8))); +typedef __uint128_t u128_16 __attribute__((aligned(16))); +typedef __uint128_t u128_32 __attribute__((aligned(32))); +typedef __uint128_t u128; + +typedef __UINT64_TYPE__ u64_4 __attribute__((aligned(4))); +typedef __UINT64_TYPE__ u64_8 __attribute__((aligned(8))); +typedef __UINT64_TYPE__ u64_16 __attribute__((aligned(16))); +typedef __UINT64_TYPE__ u64_32 __attribute__((aligned(32))); +typedef __UINT64_TYPE__ u64; + +enum class ALIGN e128_4 : u128_4 { A }; +enum class ALIGN e128_8 : u128_8 { A }; +enum class ALIGN e128_16 : u128_16 { A }; +enum class ALIGN e128_32 : u128_32 { A }; +enum class ALIGN e128 : u128 { A }; + +enum class ALIGN e64_4 : u64_4 { A }; +enum class ALIGN e64_8 : u64_8 { A }; +enum class ALIGN e64_16 : u64_16 { A }; +enum class ALIGN e64_32 : u64_32 { A }; +enum class ALIGN e64 : u64 { A }; + +extern "C" { + +e128_4 reg_e128_4 (int x, e128_4 y) { return y; } + +e128_8 reg_e128_8 (int x, e128_8 y) { return y; } + +e128_16 reg_e128_16 (int x, e128_16 y) { return y; } + +e128_32 reg_e128_32 (int x, e128_32 y) { return y; } + +e128 reg_e128 (int x, e128 y) { return y; } + +e64_4 reg_e64_4 (int x, e64_4 y) { return y; } + +e64_8 reg_e64_8 (int x, e64_8 y) { return y; } + +e64_16 reg_e64_16 (int x, e64_16 y) { return y; } + +e64_32 reg_e64_32 (int x, e64_32 y) { return y; } + +e64 reg_e64 (int x, e64 y) { return y; } + +e128_4 stack_e128_4 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e128_4 y) { return y; } + +e128_8 stack_e128_8 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e128_8 y) { return y; } + +e128_16 stack_e128_16 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e128_16 y) { return y; } + +e128_32 stack_e128_32 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e128_32 y) { return y; } + +e128 stack_e128 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e128 y) { return y; } + +e64_4 stack_e64_4 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e64_4 y) { return y; } + +e64_8 stack_e64_8 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e64_8 y) { return y; } + +e64_16 stack_e64_16 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e64_16 y) { return y; } + +e64_32 stack_e64_32 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e64_32 y) { return y; } + +e64 stack_e64 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e64 y) { return y; } + +void callee (int n, ...); + +void +caller () +{ + callee (1, e128_4::A); + callee (1, e128_8::A); + callee (1, e128_16::A); + callee (1, e128_32::A); + callee (1, e128::A); + + callee (1, e64_4::A); + callee (1, e64_8::A); + callee (1, e64_16::A); + callee (1, e64_32::A); + callee (1, e64::A); + +#define LOTS 1, 2, 3, 4, 5, 6, 7, 8, 9 + + callee (LOTS, e128_4::A); + callee (LOTS, e128_8::A); + callee (LOTS, e128_16::A); + callee (LOTS, e128_32::A); + callee (LOTS, e128::A); + + callee (LOTS, e64_4::A); + callee (LOTS, e64_8::A); + callee (LOTS, e64_16::A); + callee (LOTS, e64_32::A); + callee (LOTS, e64::A); +} + +void +va (volatile void *ptr, ...) +{ + va_list ap; + va_start (ap, ptr); + *(volatile e128_4 *) ptr = va_arg (ap, e128_4); + *(volatile e128_8 *) ptr = va_arg (ap, e128_8); + *(volatile e128_16 *) ptr = va_arg (ap, e128_16); + *(volatile e128_32 *) ptr = va_arg (ap, e128_32); + *(volatile e128 *) ptr = va_arg (ap, e128); + *(volatile e64_4 *) ptr = va_arg (ap, e64_4); + *(volatile e64_8 *) ptr = va_arg (ap, e64_8); + *(volatile e64_16 *) ptr = va_arg (ap, e64_16); + *(volatile e64_32 *) ptr = va_arg (ap, e64_32); + *(volatile e64 *) ptr = va_arg (ap, e64); +} + +} diff --git a/gcc/testsuite/g++.target/aarch64/pr109661-2.C b/gcc/testsuite/g++.target/aarch64/pr109661-2.C new file mode 100644 index 00000000000..570335a0667 --- /dev/null +++ b/gcc/testsuite/g++.target/aarch64/pr109661-2.C @@ -0,0 +1,123 @@ +/* { dg-options "-O2 -Wpsabi" } */ + + +#include + +#define ALIGN __attribute__((aligned(8))) + +typedef __uint128_t u128_4 __attribute__((aligned(4))); +typedef __uint128_t u128_8 __attribute__((aligned(8))); +typedef __uint128_t u128_16 __attribute__((aligned(16))); +typedef __uint128_t u128_32 __attribute__((aligned(32))); +typedef __uint128_t u128; + +typedef __UINT64_TYPE__ u64_4 __attribute__((aligned(4))); +typedef __UINT64_TYPE__ u64_8 __attribute__((aligned(8))); +typedef __UINT64_TYPE__ u64_16 __attribute__((aligned(16))); +typedef __UINT64_TYPE__ u64_32 __attribute__((aligned(32))); +typedef __UINT64_TYPE__ u64; + +enum class ALIGN e128_4 : u128_4 { A }; +enum class ALIGN e128_8 : u128_8 { A }; +enum class ALIGN e128_16 : u128_16 { A }; +enum class ALIGN e128_32 : u128_32 { A }; +enum class ALIGN e128 : u128 { A }; + +enum class ALIGN e64_4 : u64_4 { A }; +enum class ALIGN e64_8 : u64_8 { A }; +enum class ALIGN e64_16 : u64_16 { A }; +enum class ALIGN e64_32 : u64_32 { A }; +enum class ALIGN e64 : u64 { A }; + +extern "C" { + +e128_4 reg_e128_4 (int x, e128_4 y) { return y; } + +e128_8 reg_e128_8 (int x, e128_8 y) { return y; } + +e128_16 reg_e128_16 (int x, e128_16 y) { return y; } + +e128_32 reg_e128_32 (int x, e128_32 y) { return y; } + +e128 reg_e128 (int x, e128 y) { return y; } + +e64_4 reg_e64_4 (int x, e64_4 y) { return y; } + +e64_8 reg_e64_8 (int x, e64_8 y) { return y; } + +e64_16 reg_e64_16 (int x, e64_16 y) { return y; } + +e64_32 reg_e64_32 (int x, e64_32 y) { return y; } + +e64 reg_e64 (int x, e64 y) { return y; } + +e128_4 stack_e128_4 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e128_4 y) { return y; } + +e128_8 stack_e128_8 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e128_8 y) { return y; } + +e128_16 stack_e128_16 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e128_16 y) { return y; } + +e128_32 stack_e128_32 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e128_32 y) { return y; } + +e128 stack_e128 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e128 y) { return y; } + +e64_4 stack_e64_4 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e64_4 y) { return y; } + +e64_8 stack_e64_8 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e64_8 y) { return y; } + +e64_16 stack_e64_16 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e64_16 y) { return y; } + +e64_32 stack_e64_32 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e64_32 y) { return y; } + +e64 stack_e64 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e64 y) { return y; } + +void callee (int n, ...); + +void +caller () +{ + callee (1, e128_4::A); + callee (1, e128_8::A); + callee (1, e128_16::A); + callee (1, e128_32::A); + callee (1, e128::A); + + callee (1, e64_4::A); + callee (1, e64_8::A); + callee (1, e64_16::A); + callee (1, e64_32::A); + callee (1, e64::A); + +#define LOTS 1, 2, 3, 4, 5, 6, 7, 8, 9 + + callee (LOTS, e128_4::A); + callee (LOTS, e128_8::A); + callee (LOTS, e128_16::A); + callee (LOTS, e128_32::A); + callee (LOTS, e128::A); + + callee (LOTS, e64_4::A); + callee (LOTS, e64_8::A); + callee (LOTS, e64_16::A); + callee (LOTS, e64_32::A); + callee (LOTS, e64::A); +} + +void +va (volatile void *ptr, ...) +{ + va_list ap; + va_start (ap, ptr); + *(volatile e128_4 *) ptr = va_arg (ap, e128_4); + *(volatile e128_8 *) ptr = va_arg (ap, e128_8); + *(volatile e128_16 *) ptr = va_arg (ap, e128_16); + *(volatile e128_32 *) ptr = va_arg (ap, e128_32); + *(volatile e128 *) ptr = va_arg (ap, e128); + *(volatile e64_4 *) ptr = va_arg (ap, e64_4); + *(volatile e64_8 *) ptr = va_arg (ap, e64_8); + *(volatile e64_16 *) ptr = va_arg (ap, e64_16); + *(volatile e64_32 *) ptr = va_arg (ap, e64_32); + *(volatile e64 *) ptr = va_arg (ap, e64); +} + +} diff --git a/gcc/testsuite/g++.target/aarch64/pr109661-3.C b/gcc/testsuite/g++.target/aarch64/pr109661-3.C new file mode 100644 index 00000000000..fe06868e55a --- /dev/null +++ b/gcc/testsuite/g++.target/aarch64/pr109661-3.C @@ -0,0 +1,123 @@ +/* { dg-options "-O2 -Wpsabi" } */ + + +#include + +#define ALIGN __attribute__((aligned(16))) + +typedef __uint128_t u128_4 __attribute__((aligned(4))); +typedef __uint128_t u128_8 __attribute__((aligned(8))); +typedef __uint128_t u128_16 __attribute__((aligned(16))); +typedef __uint128_t u128_32 __attribute__((aligned(32))); +typedef __uint128_t u128; + +typedef __UINT64_TYPE__ u64_4 __attribute__((aligned(4))); +typedef __UINT64_TYPE__ u64_8 __attribute__((aligned(8))); +typedef __UINT64_TYPE__ u64_16 __attribute__((aligned(16))); +typedef __UINT64_TYPE__ u64_32 __attribute__((aligned(32))); +typedef __UINT64_TYPE__ u64; + +enum class ALIGN e128_4 : u128_4 { A }; +enum class ALIGN e128_8 : u128_8 { A }; +enum class ALIGN e128_16 : u128_16 { A }; +enum class ALIGN e128_32 : u128_32 { A }; +enum class ALIGN e128 : u128 { A }; + +enum class ALIGN e64_4 : u64_4 { A }; +enum class ALIGN e64_8 : u64_8 { A }; +enum class ALIGN e64_16 : u64_16 { A }; +enum class ALIGN e64_32 : u64_32 { A }; +enum class ALIGN e64 : u64 { A }; + +extern "C" { + +e128_4 reg_e128_4 (int x, e128_4 y) { return y; } + +e128_8 reg_e128_8 (int x, e128_8 y) { return y; } + +e128_16 reg_e128_16 (int x, e128_16 y) { return y; } + +e128_32 reg_e128_32 (int x, e128_32 y) { return y; } + +e128 reg_e128 (int x, e128 y) { return y; } + +e64_4 reg_e64_4 (int x, e64_4 y) { return y; } + +e64_8 reg_e64_8 (int x, e64_8 y) { return y; } + +e64_16 reg_e64_16 (int x, e64_16 y) { return y; } + +e64_32 reg_e64_32 (int x, e64_32 y) { return y; } + +e64 reg_e64 (int x, e64 y) { return y; } + +e128_4 stack_e128_4 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e128_4 y) { return y; } + +e128_8 stack_e128_8 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e128_8 y) { return y; } + +e128_16 stack_e128_16 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e128_16 y) { return y; } + +e128_32 stack_e128_32 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e128_32 y) { return y; } + +e128 stack_e128 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e128 y) { return y; } + +e64_4 stack_e64_4 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e64_4 y) { return y; } + +e64_8 stack_e64_8 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e64_8 y) { return y; } + +e64_16 stack_e64_16 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e64_16 y) { return y; } + +e64_32 stack_e64_32 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e64_32 y) { return y; } + +e64 stack_e64 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e64 y) { return y; } + +void callee (int n, ...); + +void +caller () +{ + callee (1, e128_4::A); + callee (1, e128_8::A); + callee (1, e128_16::A); + callee (1, e128_32::A); + callee (1, e128::A); + + callee (1, e64_4::A); + callee (1, e64_8::A); + callee (1, e64_16::A); + callee (1, e64_32::A); + callee (1, e64::A); + +#define LOTS 1, 2, 3, 4, 5, 6, 7, 8, 9 + + callee (LOTS, e128_4::A); + callee (LOTS, e128_8::A); + callee (LOTS, e128_16::A); + callee (LOTS, e128_32::A); + callee (LOTS, e128::A); + + callee (LOTS, e64_4::A); + callee (LOTS, e64_8::A); + callee (LOTS, e64_16::A); + callee (LOTS, e64_32::A); + callee (LOTS, e64::A); +} + +void +va (volatile void *ptr, ...) +{ + va_list ap; + va_start (ap, ptr); + *(volatile e128_4 *) ptr = va_arg (ap, e128_4); + *(volatile e128_8 *) ptr = va_arg (ap, e128_8); + *(volatile e128_16 *) ptr = va_arg (ap, e128_16); + *(volatile e128_32 *) ptr = va_arg (ap, e128_32); + *(volatile e128 *) ptr = va_arg (ap, e128); + *(volatile e64_4 *) ptr = va_arg (ap, e64_4); + *(volatile e64_8 *) ptr = va_arg (ap, e64_8); + *(volatile e64_16 *) ptr = va_arg (ap, e64_16); + *(volatile e64_32 *) ptr = va_arg (ap, e64_32); + *(volatile e64 *) ptr = va_arg (ap, e64); +} + +} diff --git a/gcc/testsuite/g++.target/aarch64/pr109661-4.C b/gcc/testsuite/g++.target/aarch64/pr109661-4.C new file mode 100644 index 00000000000..6f451ec1028 --- /dev/null +++ b/gcc/testsuite/g++.target/aarch64/pr109661-4.C @@ -0,0 +1,123 @@ +/* { dg-options "-O2 -Wpsabi" } */ + + +#include + +#define ALIGN __attribute__((aligned(32))) + +typedef __uint128_t u128_4 __attribute__((aligned(4))); +typedef __uint128_t u128_8 __attribute__((aligned(8))); +typedef __uint128_t u128_16 __attribute__((aligned(16))); +typedef __uint128_t u128_32 __attribute__((aligned(32))); +typedef __uint128_t u128; + +typedef __UINT64_TYPE__ u64_4 __attribute__((aligned(4))); +typedef __UINT64_TYPE__ u64_8 __attribute__((aligned(8))); +typedef __UINT64_TYPE__ u64_16 __attribute__((aligned(16))); +typedef __UINT64_TYPE__ u64_32 __attribute__((aligned(32))); +typedef __UINT64_TYPE__ u64; + +enum class ALIGN e128_4 : u128_4 { A }; +enum class ALIGN e128_8 : u128_8 { A }; +enum class ALIGN e128_16 : u128_16 { A }; +enum class ALIGN e128_32 : u128_32 { A }; +enum class ALIGN e128 : u128 { A }; + +enum class ALIGN e64_4 : u64_4 { A }; +enum class ALIGN e64_8 : u64_8 { A }; +enum class ALIGN e64_16 : u64_16 { A }; +enum class ALIGN e64_32 : u64_32 { A }; +enum class ALIGN e64 : u64 { A }; + +extern "C" { + +e128_4 reg_e128_4 (int x, e128_4 y) { return y; } + +e128_8 reg_e128_8 (int x, e128_8 y) { return y; } + +e128_16 reg_e128_16 (int x, e128_16 y) { return y; } + +e128_32 reg_e128_32 (int x, e128_32 y) { return y; } + +e128 reg_e128 (int x, e128 y) { return y; } + +e64_4 reg_e64_4 (int x, e64_4 y) { return y; } + +e64_8 reg_e64_8 (int x, e64_8 y) { return y; } + +e64_16 reg_e64_16 (int x, e64_16 y) { return y; } + +e64_32 reg_e64_32 (int x, e64_32 y) { return y; } + +e64 reg_e64 (int x, e64 y) { return y; } + +e128_4 stack_e128_4 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e128_4 y) { return y; } + +e128_8 stack_e128_8 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e128_8 y) { return y; } + +e128_16 stack_e128_16 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e128_16 y) { return y; } + +e128_32 stack_e128_32 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e128_32 y) { return y; } + +e128 stack_e128 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e128 y) { return y; } + +e64_4 stack_e64_4 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e64_4 y) { return y; } + +e64_8 stack_e64_8 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e64_8 y) { return y; } + +e64_16 stack_e64_16 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e64_16 y) { return y; } + +e64_32 stack_e64_32 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e64_32 y) { return y; } + +e64 stack_e64 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e64 y) { return y; } + +void callee (int n, ...); + +void +caller () +{ + callee (1, e128_4::A); + callee (1, e128_8::A); + callee (1, e128_16::A); + callee (1, e128_32::A); + callee (1, e128::A); + + callee (1, e64_4::A); + callee (1, e64_8::A); + callee (1, e64_16::A); + callee (1, e64_32::A); + callee (1, e64::A); + +#define LOTS 1, 2, 3, 4, 5, 6, 7, 8, 9 + + callee (LOTS, e128_4::A); + callee (LOTS, e128_8::A); + callee (LOTS, e128_16::A); + callee (LOTS, e128_32::A); + callee (LOTS, e128::A); + + callee (LOTS, e64_4::A); + callee (LOTS, e64_8::A); + callee (LOTS, e64_16::A); + callee (LOTS, e64_32::A); + callee (LOTS, e64::A); +} + +void +va (volatile void *ptr, ...) +{ + va_list ap; + va_start (ap, ptr); + *(volatile e128_4 *) ptr = va_arg (ap, e128_4); + *(volatile e128_8 *) ptr = va_arg (ap, e128_8); + *(volatile e128_16 *) ptr = va_arg (ap, e128_16); + *(volatile e128_32 *) ptr = va_arg (ap, e128_32); + *(volatile e128 *) ptr = va_arg (ap, e128); + *(volatile e64_4 *) ptr = va_arg (ap, e64_4); + *(volatile e64_8 *) ptr = va_arg (ap, e64_8); + *(volatile e64_16 *) ptr = va_arg (ap, e64_16); + *(volatile e64_32 *) ptr = va_arg (ap, e64_32); + *(volatile e64 *) ptr = va_arg (ap, e64); +} + +} diff --git a/gcc/testsuite/gcc.target/aarch64/pr109661-1.c b/gcc/testsuite/gcc.target/aarch64/pr109661-1.c new file mode 100644 index 00000000000..04109170b37 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr109661-1.c @@ -0,0 +1,5 @@ +/* { dg-options "-O2 -Wpsabi" } */ + +enum __attribute__((aligned(16))) e { E }; + +enum e test (int x, enum e y) { return y; }