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 8ED693858D38 for ; Tue, 26 Mar 2024 12:26:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8ED693858D38 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8ED693858D38 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711455978; cv=none; b=cg7ugCpyj8dAF0dLt59KqQZ37ODfyq5+vMvOr0i+Lo72x1w7TTshUeYWQTX6nN4GtllrYwd4uc2NCQq3y9b+I8c+C3YzR5Adb2AGnW1cCxj+KCh6aBF4OOUu/UbjJ3bU2Uxu7yyVdcd3AMQW+kSWbaTNTQQdyvYuc8kC2GzdLV8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711455978; c=relaxed/simple; bh=dF+ea+dAFu6pdol9WrnlJnEvrcMrq3AAWBfYekl+/Iw=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=sTlvdRalrFtTBAvU/p47VdjnNXTe0ZiyCYoXeRZCY3/BnMhi/nyvhU6+smk/QPyn4eeQYBOTyS+rP214pGEPXSJSxIELrCYohQ5Zwj2E8x4bTusCzh7D85eh3sA9OOE1QVa4lcp2gW7wcChGBm+tvmy+Bbq2B1jqeePSip60S/c= ARC-Authentication-Results: i=1; server2.sourceware.org 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 B528F2F4; Tue, 26 Mar 2024 05:26:49 -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 7D6773F64C; Tue, 26 Mar 2024 05:26:15 -0700 (PDT) From: Richard Sandiford To: Victor Do Nascimento Mail-Followup-To: Victor Do Nascimento ,, , , richard.sandiford@arm.com Cc: , , Subject: Re: [PATCH] aarch64: Add +lse128 architectural extension command-line flag References: <20240315111452.1741691-1-victor.donascimento@arm.com> Date: Tue, 26 Mar 2024 12:26:14 +0000 In-Reply-To: <20240315111452.1741691-1-victor.donascimento@arm.com> (Victor Do Nascimento's message of "Fri, 15 Mar 2024 11:14:52 +0000") 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=-20.7 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: Victor Do Nascimento writes: > 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. The new extension should be documented in doc/invoke.texi. > --- > 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") > > 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. */ Not sure I understand the comment. Is procinfo part of this test? Looks good otherwise. Thanks, Richard