[clang] [ARM] arm_acle.h add Coprocessor Instrinsics (PR #75440)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 1 07:34:32 PST 2024
https://github.com/hstk30-hw updated https://github.com/llvm/llvm-project/pull/75440
>From ce9db667e6567532fe119ff8d793281215f223dc Mon Sep 17 00:00:00 2001
From: hstk30-hw <hanwei62 at huawei.com>
Date: Thu, 14 Dec 2023 15:40:03 +0800
Subject: [PATCH] feat: arm_acle.h add Coprocessor Instrinsics
---
clang/lib/Basic/Targets/ARM.cpp | 65 ++++
clang/lib/Basic/Targets/ARM.h | 13 +
clang/lib/Headers/arm_acle.h | 52 +++
clang/test/CodeGen/arm-acle-coproc.c | 346 ++++++++++++++++++
.../Preprocessor/aarch64-target-features.c | 1 +
5 files changed, 477 insertions(+)
create mode 100644 clang/test/CodeGen/arm-acle-coproc.c
diff --git a/clang/lib/Basic/Targets/ARM.cpp b/clang/lib/Basic/Targets/ARM.cpp
index ce7e4d4639ceac..d68ae21b219535 100644
--- a/clang/lib/Basic/Targets/ARM.cpp
+++ b/clang/lib/Basic/Targets/ARM.cpp
@@ -17,6 +17,7 @@
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSwitch.h"
+#include "llvm/TargetParser/ARMTargetParser.h"
using namespace clang;
using namespace clang::targets;
@@ -836,6 +837,70 @@ void ARMTargetInfo::getTargetDefines(const LangOptions &Opts,
if (Opts.RWPI)
Builder.defineMacro("__ARM_RWPI", "1");
+ // Macros for enabling co-proc intrinsics
+ uint64_t FeatureCoprocBF = 0;
+ switch (ArchKind) {
+ default:
+ break;
+ case llvm::ARM::ArchKind::ARMV4:
+ // Filter __arm_ldcl and __arm_stcl in acle.h
+ FeatureCoprocBF = FEATURE_COPROC_B1;
+ break;
+ case llvm::ARM::ArchKind::ARM5T:
+ FeatureCoprocBF = isThumb() ? 0 : FEATURE_COPROC_B1;
+ break;
+ case llvm::ARM::ArchKind::ARMV5TE:
+ case llvm::ARM::ArchKind::ARMV5TEJ:
+ if (!isThumb())
+ FeatureCoprocBF =
+ FEATURE_COPROC_B1 | FEATURE_COPROC_B2 | FEATURE_COPROC_B3;
+ break;
+ case llvm::ARM::ArchKind::ARMV6:
+ case llvm::ARM::ArchKind::ARMV6K:
+ case llvm::ARM::ArchKind::ARMV6KZ:
+ case llvm::ARM::ArchKind::ARMV6T2:
+ if (!isThumb() || ArchKind == llvm::ARM::ArchKind::ARMV6T2)
+ FeatureCoprocBF = FEATURE_COPROC_B1 | FEATURE_COPROC_B2 |
+ FEATURE_COPROC_B3 | FEATURE_COPROC_B4;
+ break;
+ case llvm::ARM::ArchKind::ARMV7A:
+ case llvm::ARM::ArchKind::ARMV7R:
+ case llvm::ARM::ArchKind::ARMV7M:
+ case llvm::ARM::ArchKind::ARMV7S:
+ case llvm::ARM::ArchKind::ARMV7EM:
+ FeatureCoprocBF = FEATURE_COPROC_B1 | FEATURE_COPROC_B2 |
+ FEATURE_COPROC_B3 | FEATURE_COPROC_B4;
+ break;
+ case llvm::ARM::ArchKind::ARMV8A:
+ case llvm::ARM::ArchKind::ARMV8R:
+ case llvm::ARM::ArchKind::ARMV8_1A:
+ case llvm::ARM::ArchKind::ARMV8_2A:
+ case llvm::ARM::ArchKind::ARMV8_3A:
+ case llvm::ARM::ArchKind::ARMV8_4A:
+ case llvm::ARM::ArchKind::ARMV8_5A:
+ case llvm::ARM::ArchKind::ARMV8_6A:
+ case llvm::ARM::ArchKind::ARMV8_7A:
+ case llvm::ARM::ArchKind::ARMV8_8A:
+ case llvm::ARM::ArchKind::ARMV8_9A:
+ // Filter __arm_cdp, __arm_ldcl, __arm_stcl in arm_acle.h
+ FeatureCoprocBF = FEATURE_COPROC_B1 | FEATURE_COPROC_B3;
+ break;
+ case llvm::ARM::ArchKind::ARMV8MMainline:
+ FeatureCoprocBF = FEATURE_COPROC_B1 | FEATURE_COPROC_B2 |
+ FEATURE_COPROC_B3 | FEATURE_COPROC_B4;
+ break;
+ case llvm::ARM::ArchKind::ARMV9A:
+ case llvm::ARM::ArchKind::ARMV9_1A:
+ case llvm::ARM::ArchKind::ARMV9_2A:
+ case llvm::ARM::ArchKind::ARMV9_3A:
+ case llvm::ARM::ArchKind::ARMV9_4A:
+ FeatureCoprocBF = FEATURE_COPROC_B1 | FEATURE_COPROC_B2 |
+ FEATURE_COPROC_B3 | FEATURE_COPROC_B4;
+ break;
+ }
+ Builder.defineMacro("__ARM_FEATURE_COPROC",
+ "0x" + Twine::utohexstr(FeatureCoprocBF));
+
if (ArchKind == llvm::ARM::ArchKind::XSCALE)
Builder.defineMacro("__XSCALE__");
diff --git a/clang/lib/Basic/Targets/ARM.h b/clang/lib/Basic/Targets/ARM.h
index b1aa2794c7e4c3..9802eb01abf3c4 100644
--- a/clang/lib/Basic/Targets/ARM.h
+++ b/clang/lib/Basic/Targets/ARM.h
@@ -100,6 +100,19 @@ class LLVM_LIBRARY_VISIBILITY ARMTargetInfo : public TargetInfo {
};
uint32_t HW_FP;
+ enum {
+ /// __arm_cdp __arm_ldc, __arm_ldcl, __arm_stc,
+ /// __arm_stcl, __arm_mcr and __arm_mrc
+ FEATURE_COPROC_B1 = (1 << 0),
+ /// __arm_cdp2, __arm_ldc2, __arm_stc2, __arm_ldc2l,
+ /// __arm_stc2l, __arm_mcr2 and __arm_mrc2
+ FEATURE_COPROC_B2 = (1 << 1),
+ /// __arm_mcrr, __arm_mrrc
+ FEATURE_COPROC_B3 = (1 << 2),
+ /// __arm_mcrr2, __arm_mrrc2
+ FEATURE_COPROC_B4 = (1 << 3),
+ };
+
void setABIAAPCS();
void setABIAPCS(bool IsAAPCS16);
diff --git a/clang/lib/Headers/arm_acle.h b/clang/lib/Headers/arm_acle.h
index 61d80258d166a1..8a7e9a7930920b 100644
--- a/clang/lib/Headers/arm_acle.h
+++ b/clang/lib/Headers/arm_acle.h
@@ -756,6 +756,58 @@ __arm_st64bv0(void *__addr, data512_t __value) {
__builtin_arm_mops_memset_tag(__tagged_address, __value, __size)
#endif
+/* Coprocessor Intrinsics */
+#if defined(__ARM_FEATURE_COPROC)
+
+#if (__ARM_FEATURE_COPROC & 0x1)
+
+#if (__ARM_ARCH != 8)
+#define __arm_cdp(coproc, opc1, CRd, CRn, CRm, opc2) \
+ __builtin_arm_cdp(coproc, opc1, CRd, CRn, CRm, opc2)
+#endif /* __ARM_ARCH != 8 */
+
+#define __arm_ldc(coproc, CRd, p) __builtin_arm_ldc(coproc, CRd, p)
+#define __arm_stc(coproc, CRd, p) __builtin_arm_stc(coproc, CRd, p)
+
+#define __arm_mcr(coproc, opc1, value, CRn, CRm, opc2) \
+ __builtin_arm_mcr(coproc, opc1, value, CRn, CRm, opc2)
+#define __arm_mrc(coproc, opc1, CRn, CRm, opc2) \
+ __builtin_arm_mrc(coproc, opc1, CRn, CRm, opc2)
+
+#if (__ARM_ARCH != 4) && (__ARM_ARCH != 8)
+#define __arm_ldcl(coproc, CRd, p) __builtin_arm_ldcl(coproc, CRd, p)
+#define __arm_stcl(coproc, CRd, p) __builtin_arm_stcl(coproc, CRd, p)
+#endif /* (__ARM_ARCH != 4) && (__ARM_ARCH != 8) */
+
+#endif /* __ARM_FEATURE_COPROC & 0x1 */
+
+#if (__ARM_FEATURE_COPROC & 0x2)
+#define __arm_cdp2(coproc, opc1, CRd, CRn, CRm, opc2) \
+ __builtin_arm_cdp2(coproc, opc1, CRd, CRn, CRm, opc2)
+#define __arm_ldc2(coproc, CRd, p) __builtin_arm_ldc2(coproc, CRd, p)
+#define __arm_stc2(coproc, CRd, p) __builtin_arm_stc2(coproc, CRd, p)
+#define __arm_ldc2l(coproc, CRd, p) __builtin_arm_ldc2l(coproc, CRd, p)
+#define __arm_stc2l(coproc, CRd, p) __builtin_arm_stc2l(coproc, CRd, p)
+#define __arm_mcr2(coproc, opc1, value, CRn, CRm, opc2) \
+ __builtin_arm_mcr2(coproc, opc1, value, CRn, CRm, opc2)
+#define __arm_mrc2(coproc, opc1, CRn, CRm, opc2) \
+ __builtin_arm_mrc2(coproc, opc1, CRn, CRm, opc2)
+#endif
+
+#if (__ARM_FEATURE_COPROC & 0x4)
+#define __arm_mcrr(coproc, opc1, value, CRm) \
+ __builtin_arm_mcrr(coproc, opc1, value, CRm)
+#define __arm_mrrc(coproc, opc1, CRm) __builtin_arm_mrrc(coproc, opc1, CRm)
+#endif
+
+#if (__ARM_FEATURE_COPROC & 0x8)
+#define __arm_mcrr2(coproc, opc1, value, CRm) \
+ __builtin_arm_mcrr2(coproc, opc1, value, CRm)
+#define __arm_mrrc2(coproc, opc1, CRm) __builtin_arm_mrrc2(coproc, opc1, CRm)
+#endif
+
+#endif // __ARM_FEATURE_COPROC
+
/* Transactional Memory Extension (TME) Intrinsics */
#if defined(__ARM_FEATURE_TME) && __ARM_FEATURE_TME
diff --git a/clang/test/CodeGen/arm-acle-coproc.c b/clang/test/CodeGen/arm-acle-coproc.c
new file mode 100644
index 00000000000000..b4f6d1bc0da03a
--- /dev/null
+++ b/clang/test/CodeGen/arm-acle-coproc.c
@@ -0,0 +1,346 @@
+// RUN: %clang_cc1 -triple armv4 %s -E -dD -o - | FileCheck --check-prefix=CHECK-V4 %s
+// RUN: %clang_cc1 -triple armv4t %s -E -dD -o - | FileCheck --check-prefix=CHECK-V4 %s
+// RUN: %clang_cc1 -triple armv5 %s -E -dD -o - | FileCheck --check-prefix=CHECK-V5 %s
+// RUN: %clang_cc1 -triple armv5te %s -E -dD -o - | FileCheck --check-prefix=CHECK-V5-TE %s
+// RUN: %clang_cc1 -triple armv5tej %s -E -dD -o - | FileCheck --check-prefix=CHECK-V5-TE %s
+// RUN: %clang_cc1 -triple armv6 %s -E -dD -o - | FileCheck --check-prefix=CHECK-V6 %s
+// RUN: %clang_cc1 -triple armv6m %s -E -dD -o - | FileCheck --check-prefix=CHECK-V6M %s
+// RUN: %clang_cc1 -triple armv7a %s -E -dD -o - | FileCheck --check-prefix=CHECK-V7 %s
+// RUN: %clang_cc1 -triple armv7r %s -E -dD -o - | FileCheck --check-prefix=CHECK-V7 %s
+// RUN: %clang_cc1 -triple armv7m %s -E -dD -o - | FileCheck --check-prefix=CHECK-V7 %s
+// RUN: %clang_cc1 -triple armv8a %s -E -dD -o - | FileCheck --check-prefix=CHECK-V8 %s
+// RUN: %clang_cc1 -triple armv8r %s -E -dD -o - | FileCheck --check-prefix=CHECK-V8 %s
+// RUN: %clang_cc1 -triple armv8.1a %s -E -dD -o - | FileCheck --check-prefix=CHECK-V8 %s
+// RUN: %clang_cc1 -triple armv8.2a %s -E -dD -o - | FileCheck --check-prefix=CHECK-V8 %s
+// RUN: %clang_cc1 -triple armv8.3a %s -E -dD -o - | FileCheck --check-prefix=CHECK-V8 %s
+// RUN: %clang_cc1 -triple armv8.4a %s -E -dD -o - | FileCheck --check-prefix=CHECK-V8 %s
+// RUN: %clang_cc1 -triple armv8.5a %s -E -dD -o - | FileCheck --check-prefix=CHECK-V8 %s
+// RUN: %clang_cc1 -triple thumbv4 %s -E -dD -o - | FileCheck --check-prefix=CHECK-V4-THUMB %s
+// RUN: %clang_cc1 -triple thumbv4t %s -E -dD -o - | FileCheck --check-prefix=CHECK-V4-THUMB %s
+// RUN: %clang_cc1 -triple thumbv5 %s -E -dD -o - | FileCheck --check-prefix=CHECK-V5-THUMB %s
+// RUN: %clang_cc1 -triple thumbv5te %s -E -dD -o - | FileCheck --check-prefix=CHECK-V5-TE-THUMB %s
+// RUN: %clang_cc1 -triple thumbv5tej %s -E -dD -o - | FileCheck --check-prefix=CHECK-V5-TE-THUMB %s
+// RUN: %clang_cc1 -triple thumbv6 %s -E -dD -o - | FileCheck --check-prefix=CHECK-V6-THUMB %s
+// RUN: %clang_cc1 -triple thumbv6k %s -E -dD -o - | FileCheck --check-prefix=CHECK-V6-THUMB %s
+// RUN: %clang_cc1 -triple thumbv6kz %s -E -dD -o - | FileCheck --check-prefix=CHECK-V6-THUMB %s
+// RUN: %clang_cc1 -triple thumbv6m %s -E -dD -o - | FileCheck --check-prefix=CHECK-V6M %s
+// RUN: %clang_cc1 -triple thumbv7a %s -E -dD -o - | FileCheck --check-prefix=CHECK-V7 %s
+// RUN: %clang_cc1 -triple thumbv7r %s -E -dD -o - | FileCheck --check-prefix=CHECK-V7 %s
+// RUN: %clang_cc1 -triple thumbv7m %s -E -dD -o - | FileCheck --check-prefix=CHECK-V7 %s
+// RUN: %clang_cc1 -triple thumbv8a %s -E -dD -o - | FileCheck --check-prefix=CHECK-V8 %s
+// RUN: %clang_cc1 -triple thumbv8.1a %s -E -dD -o - | FileCheck --check-prefix=CHECK-V8 %s
+// RUN: %clang_cc1 -triple thumbv8.2a %s -E -dD -o - | FileCheck --check-prefix=CHECK-V8 %s
+// RUN: %clang_cc1 -triple thumbv8.3a %s -E -dD -o - | FileCheck --check-prefix=CHECK-V8 %s
+// RUN: %clang_cc1 -triple thumbv8.4a %s -E -dD -o - | FileCheck --check-prefix=CHECK-V8 %s
+// RUN: %clang_cc1 -triple thumbv8.5a %s -E -dD -o - | FileCheck --check-prefix=CHECK-V8 %s
+// RUN: %clang_cc1 -triple thumbv8r %s -E -dD -o - | FileCheck --check-prefix=CHECK-V8 %s
+// RUN: %clang_cc1 -triple thumbv8m.base %s -E -dD -o - | FileCheck --check-prefix=CHECK-V8-BASE %s
+// RUN: %clang_cc1 -triple thumbv8m.main %s -E -dD -o - | FileCheck --check-prefix=CHECK-V8-MAIN %s
+
+#include <arm_acle.h>
+
+void cdp() {
+ __arm_cdp(1, 2, 3, 4, 5, 6);
+ // CHECK-V4: __builtin_arm_cdp
+ // CHECK-V4-THUMB-NOT: __builtin_arm_cdp
+ // CHECK-V5: __builtin_arm_cdp
+ // CHECK-V5-TE: __builtin_arm_cdp
+ // CHECK-V5-THUMB-NOT: __builtin_arm_cdp
+ // CHECK-V5-TE-THUMB-NOT: __builtin_arm_cdp
+ // CHECK-V6: __builtin_arm_cdp
+ // CHECK-V6-THUMB-NOT: __builtin_arm_cdp
+ // CHECK-V6M-NOT: __builtin_arm_cdp
+ // CHECK-V7: __builtin_arm_cdp
+ // CHECK-V8-NOT: __builtin_arm_cdp
+ // CHECK-V8-BASE-NOT: __builtin_arm_cdp
+ // CHECK-V8-MAIN: __builtin_arm_cdp
+}
+
+void cdp2() {
+ __arm_cdp2(1, 2, 3, 4, 5, 6);
+ // CHECK-V4-NOT: __builtin_arm_cdp2
+ // CHECK-V4-THUMB-NOT: __builtin_arm_cdp2
+ // CHECK-V5: __builtin_arm_cdp2
+ // CHECK-V5-TE: __builtin_arm_cdp2
+ // CHECK-V5-THUMB-NOT: __builtin_arm_cdp2
+ // CHECK-V5-TE-THUMB-NOT: __builtin_arm_cdp2
+ // CHECK-V6: __builtin_arm_cdp2
+ // CHECK-V6-THUMB-NOT: __builtin_arm_cdp2
+ // CHECK-V6M-NOT: __builtin_arm_cdp2
+ // CHECK-V7: __builtin_arm_cdp2
+ // CHECK-V8-NOT: __builtin_arm_cdp2
+ // CHECK-V8-BASE-NOT: __builtin_arm_cdp2
+ // CHECK-V8-MAIN: __builtin_arm_cdp2
+}
+
+void ldc(int i) {
+ __arm_ldc(1, 2, &i);
+ // CHECK-V4: __builtin_arm_ldc
+ // CHECK-V4-THUMB-NOT: __builtin_arm_ldc
+ // CHECK-V5: __builtin_arm_ldc
+ // CHECK-V5-TE: __builtin_arm_ldc
+ // CHECK-V5-THUMB-NOT: __builtin_arm_ldc
+ // CHECK-V5-TE-THUMB-NOT: __builtin_arm_ldc
+ // CHECK-V6: __builtin_arm_ldc
+ // CHECK-V6-THUMB-NOT: __builtin_arm_ldc
+ // CHECK-V6M-NOT: __builtin_arm_ldc
+ // CHECK-V7: __builtin_arm_ldc
+ // CHECK-V8: __builtin_arm_ldc
+ // CHECK-V8-BASE-NOT: __builtin_arm_ldc
+ // CHECK-V8-MAIN: __builtin_arm_ldc
+}
+
+void ldcl(int i) {
+ __arm_ldcl(1, 2, &i);
+ // CHECK-V4-NOT: __builtin_arm_ldcl
+ // CHECK-V4-THUMB-NOT: __builtin_arm_ldcl
+ // CHECK-V5: __builtin_arm_ldcl
+ // CHECK-V5-TE: __builtin_arm_ldcl
+ // CHECK-V5-THUMB-NOT: __builtin_arm_ldcl
+ // CHECK-V5-TE-THUMB-NOT: __builtin_arm_ldcl
+ // CHECK-V6: __builtin_arm_ldcl
+ // CHECK-V6-THUMB-NOT: __builtin_arm_ldcl
+ // CHECK-V6M-NOT: __builtin_arm_ldcl
+ // CHECK-V7: __builtin_arm_ldcl
+ // CHECK-V8-NOT: __builtin_arm_ldcl
+ // CHECK-V8-BASE-NOT: __builtin_arm_ldcl
+ // CHECK-V8-MAIN: __builtin_arm_ldcl
+}
+
+void ldc2(int i) {
+ __arm_ldc2(1, 2, &i);
+ // CHECK-V4-NOT: __builtin_arm_ldc2
+ // CHECK-V4-THUMB-NOT: __builtin_arm_ldc2
+ // CHECK-V5: __builtin_arm_ldc2
+ // CHECK-V5-TE: __builtin_arm_ldc2
+ // CHECK-V5-THUMB-NOT: __builtin_arm_ldc2
+ // CHECK-V5-TE-THUMB-NOT: __builtin_arm_ldc2
+ // CHECK-V6: __builtin_arm_ldc2
+ // CHECK-V6-THUMB-NOT: __builtin_arm_ldc2
+ // CHECK-V6M-NOT: __builtin_arm_ldc2
+ // CHECK-V7: __builtin_arm_ldc2
+ // CHECK-V8-NOT: __builtin_arm_ldc2
+ // CHECK-V8-BASE-NOT: __builtin_arm_ldc2
+ // CHECK-V8-MAIN: __builtin_arm_ldc2
+}
+
+void ldc2l(int i) {
+ __arm_ldc2l(1, 2, &i);
+ // CHECK-V4-NOT: __builtin_arm_ldc2l
+ // CHECK-V4-THUMB-NOT: __builtin_arm_ldc2l
+ // CHECK-V5: __builtin_arm_ldc2l
+ // CHECK-V5-TE: __builtin_arm_ldc2l
+ // CHECK-V5-THUMB-NOT: __builtin_arm_ldc2l
+ // CHECK-V5-TE-THUMB-NOT: __builtin_arm_ldc2l
+ // CHECK-V6: __builtin_arm_ldc2l
+ // CHECK-V6-THUMB-NOT: __builtin_arm_ldc2l
+ // CHECK-V6M-NOT: __builtin_arm_ldc2l
+ // CHECK-V7: __builtin_arm_ldc2l
+ // CHECK-V8-NOT: __builtin_arm_ldc2l
+ // CHECK-V8-BASE-NOT: __builtin_arm_ldc2l
+ // CHECK-V8-MAIN: __builtin_arm_ldc2l
+}
+
+void stc(int i) {
+ __arm_stc(1, 2, &i);
+ // CHECK-V4: __builtin_arm_stc
+ // CHECK-V4-THUMB-NOT: __builtin_arm_stc
+ // CHECK-V5: __builtin_arm_stc
+ // CHECK-V5-TE: __builtin_arm_stc
+ // CHECK-V5-THUMB-NOT: __builtin_arm_stc
+ // CHECK-V5-TE-THUMB-NOT: __builtin_arm_stc
+ // CHECK-V6: __builtin_arm_stc
+ // CHECK-V6-THUMB-NOT: __builtin_arm_stc
+ // CHECK-V6M-NOT: __builtin_arm_stc
+ // CHECK-V7: __builtin_arm_stc
+ // CHECK-V8: __builtin_arm_stc
+ // CHECK-V8-BASE-NOT: __builtin_arm_stc
+ // CHECK-V8-MAIN: __builtin_arm_stc
+}
+
+void stcl(int i) {
+ __arm_stcl(1, 2, &i);
+ // CHECK-V4-NOT: __builtin_arm_stcl
+ // CHECK-V4-THUMB-NOT: __builtin_arm_stcl
+ // CHECK-V5: __builtin_arm_stcl
+ // CHECK-V5-TE: __builtin_arm_stcl
+ // CHECK-V5-THUMB-NOT: __builtin_arm_stcl
+ // CHECK-V5-TE-THUMB-NOT: __builtin_arm_stcl
+ // CHECK-V6: __builtin_arm_stcl
+ // CHECK-V6-THUMB-NOT: __builtin_arm_stcl
+ // CHECK-V6M-NOT: __builtin_arm_stcl
+ // CHECK-V7: __builtin_arm_stcl
+ // CHECK-V8-NOT: __builtin_arm_stcl
+ // CHECK-V8-BASE-NOT: __builtin_arm_stcl
+ // CHECK-V8-MAIN: __builtin_arm_stcl
+}
+
+void stc2(int i) {
+ __arm_stc2(1, 2, &i);
+ // CHECK-V4-NOT: __builtin_arm_stc2
+ // CHECK-V4-THUMB-NOT: __builtin_arm_stc2
+ // CHECK-V5: __builtin_arm_stc2
+ // CHECK-V5-TE: __builtin_arm_stc2
+ // CHECK-V5-THUMB-NOT: __builtin_arm_stc2
+ // CHECK-V5-TE-THUMB-NOT: __builtin_arm_stc2
+ // CHECK-V6: __builtin_arm_stc2
+ // CHECK-V6-THUMB-NOT: __builtin_arm_stc2
+ // CHECK-V6M-NOT: __builtin_arm_stc2
+ // CHECK-V7: __builtin_arm_stc2
+ // CHECK-V8-NOT: __builtin_arm_stc2
+ // CHECK-V8-BASE-NOT: __builtin_arm_stc2
+ // CHECK-V8-MAIN: __builtin_arm_stc2
+}
+
+void stc2l(int i) {
+ __arm_stc2l(1, 2, &i);
+ // CHECK-V4-NOT: __builtin_arm_stc2l
+ // CHECK-V4-THUMB-NOT: __builtin_arm_stc2l
+ // CHECK-V5: __builtin_arm_stc2l
+ // CHECK-V5-TE: __builtin_arm_stc2l
+ // CHECK-V5-THUMB-NOT: __builtin_arm_stc2l
+ // CHECK-V5-TE-THUMB-NOT: __builtin_arm_stc2l
+ // CHECK-V6: __builtin_arm_stc2l
+ // CHECK-V6-THUMB-NOT: __builtin_arm_stc2l
+ // CHECK-V6M-NOT: __builtin_arm_stc2l
+ // CHECK-V7: __builtin_arm_stc2l
+ // CHECK-V8-NOT: __builtin_arm_stc2l
+ // CHECK-V8-BASE-NOT: __builtin_arm_stc2l
+ // CHECK-V8-MAIN: __builtin_arm_stc2l
+}
+
+void mcr() {
+ __arm_mcr(1, 2, 3, 4, 5, 6);
+ // CHECK-V4: __builtin_arm_mcr
+ // CHECK-V4-THUMB-NOT: __builtin_arm_mcr
+ // CHECK-V5: __builtin_arm_mcr
+ // CHECK-V5-TE: __builtin_arm_mcr
+ // CHECK-V5-THUMB-NOT: __builtin_arm_mcr
+ // CHECK-V5-TE-THUMB-NOT: __builtin_arm_mcr
+ // CHECK-V6: __builtin_arm_mcr
+ // CHECK-V6-THUMB-NOT: __builtin_arm_mcr
+ // CHECK-V6M-NOT: __builtin_arm_mcr
+ // CHECK-V7: __builtin_arm_mcr
+ // CHECK-V8: __builtin_arm_mcr
+ // CHECK-V8-BASE-NOT: __builtin_arm_mcr
+ // CHECK-V8-MAIN: __builtin_arm_mcr
+}
+
+void mcr2() {
+ __arm_mcr2(1, 2, 3, 4, 5, 6);
+ // CHECK-V4-NOT: __builtin_arm_mcr2
+ // CHECK-V4-THUMB-NOT: __builtin_arm_mcr2
+ // CHECK-V5: __builtin_arm_mcr2
+ // CHECK-V5-TE: __builtin_arm_mcr2
+ // CHECK-V5-THUMB-NOT: __builtin_arm_mcr2
+ // CHECK-V5-TE-THUMB-NOT: __builtin_arm_mcr2
+ // CHECK-V6: __builtin_arm_mcr2
+ // CHECK-V6-THUMB-NOT: __builtin_arm_mcr2
+ // CHECK-V6M-NOT: __builtin_arm_mcr2
+ // CHECK-V7: __builtin_arm_mcr2
+ // CHECK-V8-NOT: __builtin_arm_mcr2
+ // CHECK-V8-BASE-NOT: __builtin_arm_mcr2
+ // CHECK-V8-MAIN: __builtin_arm_mcr2
+}
+
+void mrc() {
+ __arm_mrc(1, 2, 3, 4, 5);
+ // CHECK-V4: __builtin_arm_mrc
+ // CHECK-V4-THUMB-NOT: __builtin_arm_mrc
+ // CHECK-V5: __builtin_arm_mrc
+ // CHECK-V5-TE: __builtin_arm_mrc
+ // CHECK-V5-THUMB-NOT: __builtin_arm_mrc
+ // CHECK-V5-TE-THUMB-NOT: __builtin_arm_mrc
+ // CHECK-V6: __builtin_arm_mrc
+ // CHECK-V6-THUMB-NOT: __builtin_arm_mrc
+ // CHECK-V6M-NOT: __builtin_arm_mrc
+ // CHECK-V7: __builtin_arm_mrc
+ // CHECK-V8: __builtin_arm_mrc
+ // CHECK-V8-BASE-NOT: __builtin_arm_mrc
+ // CHECK-V8-MAIN: __builtin_arm_mrc
+}
+
+void mrc2() {
+ __arm_mrc2(1, 2, 3, 4, 5);
+ // CHECK-V4-NOT: __builtin_arm_mrc2
+ // CHECK-V4-THUMB-NOT: __builtin_arm_mrc2
+ // CHECK-V5: __builtin_arm_mrc2
+ // CHECK-V5-TE: __builtin_arm_mrc2
+ // CHECK-V5-THUMB-NOT: __builtin_arm_mrc2
+ // CHECK-V5-TE-THUMB-NOT: __builtin_arm_mrc2
+ // CHECK-V6: __builtin_arm_mrc2
+ // CHECK-V6-THUMB-NOT: __builtin_arm_mrc2
+ // CHECK-V6M-NOT: __builtin_arm_mrc2
+ // CHECK-V7: __builtin_arm_mrc2
+ // CHECK-V8-NOT: __builtin_arm_mrc2
+ // CHECK-V8-BASE-NOT: __builtin_arm_mrc2
+ // CHECK-V8-MAIN: __builtin_arm_mrc2
+}
+
+void mcrr() {
+ __arm_mcrr(1, 2, 3, 4);
+ // CHECK-V4-NOT: __builtin_arm_mcrr
+ // CHECK-V4-THUMB-NOT: __builtin_arm_mcrr
+ // CHECK-V5-NOT: __builtin_arm_mcrr
+ // CHECK-V5-TE: __builtin_arm_mcrr
+ // CHECK-V5-THUMB-NOT: __builtin_arm_mcrr
+ // CHECK-V5-THUMB-NOT: __builtin_arm_mcrr
+ // CHECK-V6: __builtin_arm_mcrr
+ // CHECK-V6-THUMB-NOT: __builtin_arm_mcrr
+ // CHECK-V6M-NOT: __builtin_arm_mcrr
+ // CHECK-V7: __builtin_arm_mcrr
+ // CHECK-V8: __builtin_arm_mcrr
+ // CHECK-V8-BASE-NOT: __builtin_arm_mcrr
+ // CHECK-V8-MAIN: __builtin_arm_mcrr
+}
+
+void mcrr2() {
+ __arm_mcrr2(1, 2, 3, 4);
+ // CHECK-V4-NOT: __builtin_arm_mcrr2
+ // CHECK-V4-THUMB-NOT: __builtin_arm_mcrr2
+ // CHECK-V5-NOT: __builtin_arm_mcrr2
+ // CHECK-V5-TE-NOT: __builtin_arm_mcrr2
+ // CHECK-V5-THUMB-NOT: __builtin_arm_mcrr2
+ // CHECK-V5-TE-THUMB-NOT: __builtin_arm_mcrr2
+ // CHECK-V6: __builtin_arm_mcrr2
+ // CHECK-V6-THUMB-NOT: __builtin_arm_mcrr2
+ // CHECK-V6M-NOT: __builtin_arm_mcrr2
+ // CHECK-V7: __builtin_arm_mcrr2
+ // CHECK-V8-NOT: __builtin_arm_mcrr2
+ // CHECK-V8-BASE-NOT: __builtin_arm_mcrr2
+ // CHECK-V8-MAIN: __builtin_arm_mcrr2
+}
+
+void mrrc() {
+ __arm_mrrc(1, 2, 3);
+ // CHECK-V4-NOT: __builtin_arm_mrrc
+ // CHECK-V4-THUMB-NOT: __builtin_arm_mrrc
+ // CHECK-V5-NOT: __builtin_arm_mrrc
+ // CHECK-V5-TE: __builtin_arm_mrrc
+ // CHECK-V5-THUMB-NOT: __builtin_arm_mrrc
+ // CHECK-V5-THUMB-TE-NOT: __builtin_arm_mrrc
+ // CHECK-V6: __builtin_arm_mrrc
+ // CHECK-V6-THUMB-NOT: __builtin_arm_mrrc
+ // CHECK-V6M-NOT: __builtin_arm_mrrc
+ // CHECK-V7: __builtin_arm_mrrc
+ // CHECK-V8: __builtin_arm_mrrc
+ // CHECK-V8-BASE-NOT: __builtin_arm_mrrc
+ // CHECK-V8-MAIN: __builtin_arm_mrrc
+}
+
+void mrrc2() {
+ __arm_mrrc2(1, 2, 3);
+ // CHECK-V4-NOT: __builtin_arm_mrrc2
+ // CHECK-V4-THUMB-NOT: __builtin_arm_mrrc2
+ // CHECK-V5-NOT: __builtin_arm_mrrc2
+ // CHECK-V5-TE-NOT: __builtin_arm_mrrc2
+ // CHECK-V5-THUMB-NOT: __builtin_arm_mrrc2
+ // CHECK-V5-TE-THUMB-NOT: __builtin_arm_mrrc2
+ // CHECK-V6: __builtin_arm_mrrc2
+ // CHECK-V6-THUMB-NOT: __builtin_arm_mrrc2
+ // CHECK-V6M-NOT: __builtin_arm_mrrc2
+ // CHECK-V7: __builtin_arm_mrrc2
+ // CHECK-V8-NOT: __builtin_arm_mrrc2
+ // CHECK-V8-BASE-NOT: __builtin_arm_mrrc2
+ // CHECK-V8-MAIN: __builtin_arm_mrrc2
+}
diff --git a/clang/test/Preprocessor/aarch64-target-features.c b/clang/test/Preprocessor/aarch64-target-features.c
index db89aa7b608ad5..45208735920d00 100644
--- a/clang/test/Preprocessor/aarch64-target-features.c
+++ b/clang/test/Preprocessor/aarch64-target-features.c
@@ -45,6 +45,7 @@
// CHECK-NOT: __ARM_PCS_VFP 1
// CHECK-NOT: __ARM_SIZEOF_MINIMAL_ENUM 1
// CHECK-NOT: __ARM_SIZEOF_WCHAR_T 2
+// CHECK-NOT: __ARM_FEATURE_COPROC
// CHECK-NOT: __ARM_FEATURE_SVE
// CHECK-NOT: __ARM_FEATURE_DOTPROD
// CHECK-NOT: __ARM_FEATURE_PAC_DEFAULT
More information about the cfe-commits
mailing list