From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by sourceware.org (Postfix) with ESMTPS id B2A903858C41 for ; Fri, 15 Mar 2024 15:41:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B2A903858C41 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B2A903858C41 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::533 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710517296; cv=none; b=QLAllSa3Nuih1fy2WS6AqL08xB0TuFsPGCeXQVNL0DJwhZJZZhrdWXmu2xhak/8GV6Lh1eKnsR2l3uNTH20wkuBBttQBQJS/PIZh426NC4KDHNVSIVoMzuYfiR77UDyGxLFmO7SU+h9GHqLP70sqQQC5DMEdAqGLtPxp3ZRGbYQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710517296; c=relaxed/simple; bh=KtgBG+vV51j4BOzQjNlzijdJ4Fs2KSR0Q5owS7aHeeA=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=kzSy9OXlNsEY/mxxd9GP+zQb+dO9z4joPLAsBdbfaX2fzEuJvJlg8DUtY3nGL7OmMWA27FqyVdAGy/Tf8DGMQ6IpL1ZrP+iXacF29PUXLfx+blMr6EnoAnEAAlnv1qJdQ//I9cpUpeCHrgB4JpE9/cbKF8vFbdecqcWGc3CGJAQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-56899d9bf52so3072463a12.2 for ; Fri, 15 Mar 2024 08:41:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710517293; x=1711122093; darn=gcc.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=rNkQ/0oVtmaeZyrVSh4Ohp3Qb20iub7fXGugJFGu7qk=; b=eMNPSP9fsFIYOEE3lCKZSTb9BXGWk/us/aozVbNRI1hR7MHLBzZc/OgnZu//FNTpqX 2GCvv8pmOAvDfZuZ3b1hUGHGfDq9p4FCERXlg9tvruYe1BzB/x1EVm5iRAkU2J+kTbl4 d7rNF90Kdxpzw6epLzIadlU0C+Lz27QbHDPKP4op5x3x8Wx+nXL4xIaqwq9FWy7MBHqs lH+49uIDV129smYZ7nFetMb3Mygv7LZo9vS9L1ZK4MRhEsDgdXxDcBv/RfYkxEag5zO+ ++KXzHB8w4GI6YFlr3YNrNeEVaN7+8Kt5oz355kaYCqpEe2jVXlueDol3gkXgCM7O6Kf pUdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710517293; x=1711122093; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=rNkQ/0oVtmaeZyrVSh4Ohp3Qb20iub7fXGugJFGu7qk=; b=TX7Bb4gnfmiTYdgrotfcFwQf41jWH59hul22MtZgUnKhK5NZyVf/8sVpXSSTuDzbSE KR3dPIKfaJ8QAZ9ayn1MY64eYy5z9sg00vGLFh4tQraNOzHzPSjgiWnaIdfsBkPfTs9C XQp5DPTDMcyfyx8L+6DqpC48iXZgGi1C5dFiFtMl+7xP9Oef7yxSTcURv8CjBm34PiIz FABPRD60SbtcEaWTuoPTIx6p0Jg0Q1wJq8ANS3yOuVziVRryRR8h0bdXYnchec9LjvGM LKifkNQ07jnpX61FYs5SNAEF2LbnM8XhMUavlHAwW3CzyVs+YnSdFFP5KRzZ2IKMxkUD 2wKw== X-Gm-Message-State: AOJu0YxnLeZv8zTnZRnwyvtLlsOfVQ2495Lj5FuWfshz4YazBeyntXpO 6lOzHTFpG+XWn6FDlmVEYj28KLq/soc8YJTB9DPDlbnywapIWuY1MqdnaR8Ifa66Iq5+PKYhcu6 KbeiEmBuEDCmp8FjLIBZOU2JN3R1QEh/b23zuFA== X-Google-Smtp-Source: AGHT+IHgcs3EyqvOPKRstqKSflFx7gndFgB8a5jTiwCvi7ah95CJ6eSRtMQ0BhUOmFbT7oMROOfKQQFwLDpsgT8RKN4= X-Received: by 2002:a05:6402:e0a:b0:565:6c72:40a9 with SMTP id h10-20020a0564020e0a00b005656c7240a9mr4373984edh.28.1710517293373; Fri, 15 Mar 2024 08:41:33 -0700 (PDT) MIME-Version: 1.0 References: <20240315111452.1741691-1-victor.donascimento@arm.com> In-Reply-To: <20240315111452.1741691-1-victor.donascimento@arm.com> From: Christophe Lyon Date: Fri, 15 Mar 2024 16:41:22 +0100 Message-ID: Subject: Re: [PATCH] aarch64: Add +lse128 architectural extension command-line flag To: Victor Do Nascimento Cc: gcc-patches@gcc.gnu.org, kyrylo.tkachov@arm.com, richard.sandiford@arm.com, Richard.Earnshaw@arm.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-10.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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 List-Id: On Fri, 15 Mar 2024 at 12:15, Victor Do Nascimento wrote: > > Given how, at present, the choice of using LSE128 atomic instructions > by the toolchain is delegated to run-time selection in the form of > Libatomic ifuncs, responsible for querying target support, the > `+lse128' target architecture compile-time flag is absent from GCC. > > This, however, contrasts with the Binutils implementation, which gates > LSE128 instructions behind the `+lse128' flag. This can lead to > problems in GCC for certain use-cases. One such example is in the use > of inline assembly, whereby the inability of enabling the feature in > the command-line prevents the compiler from automatically issuing the > necessary LSE128 `.arch' directive. > > This patch therefore brings GCC into alignment with LLVM and Binutils > in adding support for the `+lse128' architectural extension flag. > > gcc/ChangeLog: > > * config/aarch64/aarch64-option-extensions.def: Add LSE128 > AARCH64_OPT_EXTENSION, adding it as a dependency for the D128 > feature. > > gcc/testsuite/ChangeLog: > > * gcc.target/aarch64/lse128-flag.c: New. > * gcc.target/aarch64/cpunative/info_23: Likewise. > * gcc.target/aarch64/cpunative/native_cpu_23.c: Likewise. > --- > gcc/config/aarch64/aarch64-option-extensions.def | 4 +++- > gcc/testsuite/gcc.target/aarch64/cpunative/info_23 | 8 ++++++++ > .../gcc.target/aarch64/cpunative/native_cpu_23.c | 11 +++++++++++ > gcc/testsuite/gcc.target/aarch64/lse128-flag.c | 10 ++++++++++ > 4 files changed, 32 insertions(+), 1 deletion(-) > create mode 100644 gcc/testsuite/gcc.target/aarch64/cpunative/info_23 > create mode 100644 gcc/testsuite/gcc.target/aarch64/cpunative/native_cpu_23.c > create mode 100644 gcc/testsuite/gcc.target/aarch64/lse128-flag.c > > diff --git a/gcc/config/aarch64/aarch64-option-extensions.def b/gcc/config/aarch64/aarch64-option-extensions.def > index 1a3b91c68cf..ac54b899a06 100644 > --- a/gcc/config/aarch64/aarch64-option-extensions.def > +++ b/gcc/config/aarch64/aarch64-option-extensions.def > @@ -275,7 +275,9 @@ AARCH64_OPT_EXTENSION("mops", MOPS, (), (), (), "") > > AARCH64_OPT_EXTENSION("cssc", CSSC, (), (), (), "cssc") > > -AARCH64_OPT_EXTENSION("d128", D128, (), (), (), "d128") > +AARCH64_OPT_EXTENSION("lse128", LSE128, (LSE), (), (), "lse128") > + > +AARCH64_OPT_EXTENSION("d128", D128, (LSE128), (), (), "d128") > FWIW, looks good to me, I noticed that now we'll also have the dependency of d128 on lse128, although d128 didn't have the (implicit) dependency on lse before. Christophe > AARCH64_OPT_EXTENSION("the", THE, (), (), (), "the") > > diff --git a/gcc/testsuite/gcc.target/aarch64/cpunative/info_23 b/gcc/testsuite/gcc.target/aarch64/cpunative/info_23 > new file mode 100644 > index 00000000000..d77c25d2f61 > --- /dev/null > +++ b/gcc/testsuite/gcc.target/aarch64/cpunative/info_23 > @@ -0,0 +1,8 @@ > +processor : 0 > +BogoMIPS : 100.00 > +Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 asimddp atomics lse128 > +CPU implementer : 0xfe > +CPU architecture: 8 > +CPU variant : 0x0 > +CPU part : 0xd08 > +CPU revision : 2 > \ No newline at end of file > diff --git a/gcc/testsuite/gcc.target/aarch64/cpunative/native_cpu_23.c b/gcc/testsuite/gcc.target/aarch64/cpunative/native_cpu_23.c > new file mode 100644 > index 00000000000..8a1e235d8ab > --- /dev/null > +++ b/gcc/testsuite/gcc.target/aarch64/cpunative/native_cpu_23.c > @@ -0,0 +1,11 @@ > +/* { dg-do compile { target { { aarch64*-*-linux*} && native } } } */ > +/* { dg-set-compiler-env-var GCC_CPUINFO "$srcdir/gcc.target/aarch64/cpunative/info_23" } */ > +/* { dg-additional-options "-mcpu=native" } */ > + > +int main() > +{ > + return 0; > +} > + > +/* { dg-final { scan-assembler {\.arch armv8-a\+dotprod\+crc\+crypto\+lse128} } } */ > +/* Test one where lse128 is available and so should be emitted. */ > diff --git a/gcc/testsuite/gcc.target/aarch64/lse128-flag.c b/gcc/testsuite/gcc.target/aarch64/lse128-flag.c > new file mode 100644 > index 00000000000..71339c3af6d > --- /dev/null > +++ b/gcc/testsuite/gcc.target/aarch64/lse128-flag.c > @@ -0,0 +1,10 @@ > +/* { dg-do compile { target { aarch64*-*-*} } } */ > +/* { dg-additional-options "-march=armv9.4-a+lse128" } */ > + > +int main() > +{ > + return 0; > +} > + > +/* { dg-final { scan-assembler {\.arch armv9\.4-a\+crc\+lse128} } } */ > +/* Test a normal looking procinfo. */ > -- > 2.34.1 >