diff --git a/clang/lib/Basic/Targets/AArch64.h b/clang/lib/Basic/Targets/AArch64.h --- a/clang/lib/Basic/Targets/AArch64.h +++ b/clang/lib/Basic/Targets/AArch64.h @@ -82,6 +82,7 @@ bool HasNoSVE = false; bool HasFMV = true; bool HasGCS = false; + bool HasRCPC3 = false; const llvm::AArch64::ArchInfo *ArchInfo = &llvm::AArch64::ARMV8A; diff --git a/clang/lib/Basic/Targets/AArch64.cpp b/clang/lib/Basic/Targets/AArch64.cpp --- a/clang/lib/Basic/Targets/AArch64.cpp +++ b/clang/lib/Basic/Targets/AArch64.cpp @@ -415,7 +415,9 @@ if (HasCRC) Builder.defineMacro("__ARM_FEATURE_CRC32", "1"); - if (HasRCPC) + if (HasRCPC3) + Builder.defineMacro("__ARM_FEATURE_RCPC", "3"); + else if (HasRCPC) Builder.defineMacro("__ARM_FEATURE_RCPC", "1"); if (HasFMV) @@ -671,6 +673,7 @@ .Case("bti", HasBTI) .Cases("ls64", "ls64_v", "ls64_accdata", HasLS64) .Case("wfxt", HasWFxT) + .Case("rcpc3", HasRCPC3) .Default(false); } @@ -928,6 +931,8 @@ HasD128 = true; if (Feature == "+gcs") HasGCS = true; + if (Feature == "+rcpc3") + HasRCPC3 = true; } // Check features that are manually disabled by command line options. diff --git a/clang/test/Preprocessor/aarch64-target-features.c b/clang/test/Preprocessor/aarch64-target-features.c --- a/clang/test/Preprocessor/aarch64-target-features.c +++ b/clang/test/Preprocessor/aarch64-target-features.c @@ -27,6 +27,7 @@ // CHECK: __ARM_FEATURE_LDREX 0xF // CHECK: __ARM_FEATURE_NUMERIC_MAXMIN 1 // CHECK-NOT: __ARM_FEATURE_RCPC 1 +// CHECK-NOT: __ARM_FEATURE_RCPC 3 // CHECK-NOT: __ARM_FEATURE_SHA2 1 // CHECK-NOT: __ARM_FEATURE_SHA3 1 // CHECK-NOT: __ARM_FEATURE_SHA512 1 @@ -612,3 +613,6 @@ // RUN: %clang --target=aarch64 -march=armv8.2-a+rcpc -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-RCPC %s // CHECK-RCPC: __ARM_FEATURE_RCPC 1 + +// RUN: %clang --target=aarch64 -march=armv8.2-a+rcpc3 -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-RCPC3 %s +// CHECK-RCPC3: __ARM_FEATURE_RCPC 3