Skip to content

Commit

Permalink
[Backport][SME] aarch64: Define __ARM_FEATURE_RCPC
Browse files Browse the repository at this point in the history
Reference: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=c1b0a767f04a8ccbaff2a7b71d5c817cdb469630

ARM-software/acle#199 adds a new feature
macro for RCPC, for use in things like inline assembly.  This patch
adds the associated support to GCC.

Also, RCPC is required for Armv8.3-A and later, but the armv8.3-a
entry didn't include it.  This was probably harmless in practice
since GCC simply ignored the extension until now.  (The GAS
definition is OK.)

gcc/
	* config/aarch64/aarch64.h (AARCH64_ISA_RCPC): New macro.
	* config/aarch64/aarch64-arches.def (armv8.3-a): Include RCPC.
	* config/aarch64/aarch64-cores.def (thunderx3t110, zeus, neoverse-v1)
	(neoverse-512tvb, saphira): Remove RCPC from these Armv8.3-A+ cores.
	* config/aarch64/aarch64-c.cc (aarch64_update_cpp_builtins): Define
	__ARM_FEATURE_RCPC when appropriate.

gcc/testsuite/
	* gcc.target/aarch64/pragma_cpp_predefs_1.c: Add RCPC tests.
  • Loading branch information
rsandifo-arm authored and xiezhiheng committed Aug 23, 2024
1 parent 77a86d9 commit 53a858c
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 6 deletions.
2 changes: 1 addition & 1 deletion gcc/config/aarch64/aarch64-arches.def
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
AARCH64_ARCH("armv8-a", generic, V8A, 8, (SIMD))
AARCH64_ARCH("armv8.1-a", generic, V8_1A, 8, (V8A, LSE, CRC, RDMA))
AARCH64_ARCH("armv8.2-a", generic, V8_2A, 8, (V8_1A))
AARCH64_ARCH("armv8.3-a", generic, V8_3A, 8, (V8_2A, PAUTH))
AARCH64_ARCH("armv8.3-a", generic, V8_3A, 8, (V8_2A, PAUTH, RCPC))
AARCH64_ARCH("armv8.4-a", generic, V8_4A, 8, (V8_3A, F16FML, DOTPROD, FLAGM))
AARCH64_ARCH("armv8.5-a", generic, V8_5A, 8, (V8_4A, SB, SSBS, PREDRES))
AARCH64_ARCH("armv8.6-a", generic, V8_6A, 8, (V8_5A, I8MM, BF16))
Expand Down
1 change: 1 addition & 0 deletions gcc/config/aarch64/aarch64-c.cc
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ aarch64_update_cpp_builtins (cpp_reader *pfile)
"__ARM_FEATURE_BF16_SCALAR_ARITHMETIC", pfile);
aarch64_def_or_undef (TARGET_LS64,
"__ARM_FEATURE_LS64", pfile);
aarch64_def_or_undef (AARCH64_ISA_RCPC, "__ARM_FEATURE_RCPC", pfile);

/* Not for ACLE, but required to keep "float.h" correct if we switch
target between implementations that do or do not support ARMv8.2-A
Expand Down
10 changes: 5 additions & 5 deletions gcc/config/aarch64/aarch64-cores.def
Original file line number Diff line number Diff line change
Expand Up @@ -133,17 +133,17 @@ AARCH64_CORE("tsv110", tsv110, tsv110, V8_2A, (CRYPTO, F16), tsv110, 0x48, 0
/* ARMv8.3-A Architecture Processors. */

/* Marvell cores (TX3). */
AARCH64_CORE("thunderx3t110", thunderx3t110, thunderx3t110, V8_3A, (CRYPTO, RCPC, SM4, SHA3, F16FML), thunderx3t110, 0x43, 0x0b8, 0x0a)
AARCH64_CORE("thunderx3t110", thunderx3t110, thunderx3t110, V8_3A, (CRYPTO, SM4, SHA3, F16FML), thunderx3t110, 0x43, 0x0b8, 0x0a)

/* ARMv8.4-A Architecture Processors. */

/* Arm ('A') cores. */
AARCH64_CORE("zeus", zeus, cortexa57, V8_4A, (SVE, RCPC, I8MM, BF16, PROFILE, SSBS, RNG), neoversev1, 0x41, 0xd40, -1)
AARCH64_CORE("neoverse-v1", neoversev1, cortexa57, V8_4A, (SVE, RCPC, I8MM, BF16, PROFILE, SSBS, RNG), neoversev1, 0x41, 0xd40, -1)
AARCH64_CORE("neoverse-512tvb", neoverse512tvb, cortexa57, V8_4A, (SVE, RCPC, I8MM, BF16, PROFILE, SSBS, RNG), neoverse512tvb, INVALID_IMP, INVALID_CORE, -1)
AARCH64_CORE("zeus", zeus, cortexa57, V8_4A, (SVE, I8MM, BF16, PROFILE, SSBS, RNG), neoversev1, 0x41, 0xd40, -1)
AARCH64_CORE("neoverse-v1", neoversev1, cortexa57, V8_4A, (SVE, I8MM, BF16, PROFILE, SSBS, RNG), neoversev1, 0x41, 0xd40, -1)
AARCH64_CORE("neoverse-512tvb", neoverse512tvb, cortexa57, V8_4A, (SVE, I8MM, BF16, PROFILE, SSBS, RNG), neoverse512tvb, INVALID_IMP, INVALID_CORE, -1)

/* Qualcomm ('Q') cores. */
AARCH64_CORE("saphira", saphira, saphira, V8_4A, (CRYPTO, RCPC), saphira, 0x51, 0xC01, -1)
AARCH64_CORE("saphira", saphira, saphira, V8_4A, (CRYPTO), saphira, 0x51, 0xC01, -1)

/* ARMv8-A big.LITTLE implementations. */

Expand Down
1 change: 1 addition & 0 deletions gcc/config/aarch64/aarch64.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ enum class aarch64_feature : unsigned char {
#define AARCH64_ISA_SM4 (aarch64_isa_flags & AARCH64_FL_SM4)
#define AARCH64_ISA_SHA3 (aarch64_isa_flags & AARCH64_FL_SHA3)
#define AARCH64_ISA_F16FML (aarch64_isa_flags & AARCH64_FL_F16FML)
#define AARCH64_ISA_RCPC (aarch64_isa_flags & AARCH64_FL_RCPC)
#define AARCH64_ISA_RCPC8_4 (aarch64_isa_flags & AARCH64_FL_V8_4A)
#define AARCH64_ISA_RNG (aarch64_isa_flags & AARCH64_FL_RNG)
#define AARCH64_ISA_V8_5A (aarch64_isa_flags & AARCH64_FL_V8_5A)
Expand Down
20 changes: 20 additions & 0 deletions gcc/testsuite/gcc.target/aarch64/pragma_cpp_predefs_1.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,26 @@
#error "__ARM_FEATURE_CRC32 is not defined but should be!"
#endif

#pragma GCC target ("arch=armv8.2-a")
#ifdef __ARM_FEATURE_RCPC
#error "__ARM_FEATURE_RCPC is defined but should not be!"
#endif

#pragma GCC target ("arch=armv8.2-a+rcpc")
#ifndef __ARM_FEATURE_RCPC
#error "__ARM_FEATURE_RCPC is not defined but should be!"
#endif

#pragma GCC target ("+norcpc")
#ifdef __ARM_FEATURE_RCPC
#error "__ARM_FEATURE_RCPC is defined but should not be!"
#endif

#pragma GCC target ("arch=armv8.3-a")
#ifndef __ARM_FEATURE_RCPC
#error "__ARM_FEATURE_RCPC is not defined but should be!"
#endif

int
foo (int a)
{
Expand Down

0 comments on commit 53a858c

Please sign in to comment.