This revision was automatically updated to reflect the committed changes. Closed by commit rGe32b818db187: [ARM][clang] Define feature test macro for the PACBTI-M extension (authored by stuij).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D112431/new/ https://reviews.llvm.org/D112431 Files: clang/lib/Basic/Targets/ARM.cpp clang/lib/Basic/Targets/ARM.h clang/test/Preprocessor/arm-target-features.c Index: clang/test/Preprocessor/arm-target-features.c =================================================================== --- clang/test/Preprocessor/arm-target-features.c +++ clang/test/Preprocessor/arm-target-features.c @@ -896,6 +896,13 @@ // CHECK-PAC-LEAF: #define __ARM_FEATURE_PAC_DEFAULT 5 // CHECK-PAC-BKEY-LEAF: #define __ARM_FEATURE_PAC_DEFAULT 6 +// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main -x c -E -dM %s -o - | FileCheck --check-prefixes=CHECK-NOBTI-EXT,CHECK-NOPAC-EXT %s +// RUN: %clang -target arm-arm-none-eabi -march=armv7-m+pacbti -x c -E -dM %s -o - | FileCheck --check-prefixes=CHECK-PACBTI-EXT %s +// CHECK-NOBTI-EXT-NOT: #define __ARM_FEATURE_BTI 1 +// CHECK-NOPAC-EXT-NOT: #define __ARM_FEATURE_PAUTH 1 +// CHECK-PACBTI-EXT: #define __ARM_FEATURE_BTI 1 +// CHECK-PACBTI-EXT: #define __ARM_FEATURE_PAUTH 1 + // ================== Check BFloat16 Extensions. // RUN: %clang -target arm-arm-none-eabi -march=armv8.6-a+bf16 -x c -E -dM %s -o - 2>&1 | FileCheck -check-prefix=CHECK-BFLOAT %s // CHECK-BFLOAT: #define __ARM_BF16_FORMAT_ALTERNATIVE 1 Index: clang/lib/Basic/Targets/ARM.h =================================================================== --- clang/lib/Basic/Targets/ARM.h +++ clang/lib/Basic/Targets/ARM.h @@ -79,6 +79,8 @@ unsigned DotProd : 1; unsigned HasMatMul : 1; unsigned FPRegsDisabled : 1; + unsigned HasPAC : 1; + unsigned HasBTI : 1; enum { LDREX_B = (1 << 0), /// byte (8-bit) Index: clang/lib/Basic/Targets/ARM.cpp =================================================================== --- clang/lib/Basic/Targets/ARM.cpp +++ clang/lib/Basic/Targets/ARM.cpp @@ -465,6 +465,8 @@ HWDiv = 0; DotProd = 0; HasMatMul = 0; + HasPAC = 0; + HasBTI = 0; HasFloat16 = true; ARMCDECoprocMask = 0; HasBFloat16 = false; @@ -547,6 +549,9 @@ HasBFloat16 = true; } else if (Feature == "-fpregs") { FPRegsDisabled = true; + } else if (Feature == "+pacbti") { + HasPAC = 1; + HasBTI = 1; } } @@ -890,6 +895,12 @@ if (HasMatMul) Builder.defineMacro("__ARM_FEATURE_MATMUL_INT8", "1"); + if (HasPAC) + Builder.defineMacro("__ARM_FEATURE_PAUTH", "1"); + + if (HasBTI) + Builder.defineMacro("__ARM_FEATURE_BTI", "1"); + if (HasBFloat16) { Builder.defineMacro("__ARM_FEATURE_BF16", "1"); Builder.defineMacro("__ARM_FEATURE_BF16_VECTOR_ARITHMETIC", "1");
Index: clang/test/Preprocessor/arm-target-features.c =================================================================== --- clang/test/Preprocessor/arm-target-features.c +++ clang/test/Preprocessor/arm-target-features.c @@ -896,6 +896,13 @@ // CHECK-PAC-LEAF: #define __ARM_FEATURE_PAC_DEFAULT 5 // CHECK-PAC-BKEY-LEAF: #define __ARM_FEATURE_PAC_DEFAULT 6 +// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main -x c -E -dM %s -o - | FileCheck --check-prefixes=CHECK-NOBTI-EXT,CHECK-NOPAC-EXT %s +// RUN: %clang -target arm-arm-none-eabi -march=armv7-m+pacbti -x c -E -dM %s -o - | FileCheck --check-prefixes=CHECK-PACBTI-EXT %s +// CHECK-NOBTI-EXT-NOT: #define __ARM_FEATURE_BTI 1 +// CHECK-NOPAC-EXT-NOT: #define __ARM_FEATURE_PAUTH 1 +// CHECK-PACBTI-EXT: #define __ARM_FEATURE_BTI 1 +// CHECK-PACBTI-EXT: #define __ARM_FEATURE_PAUTH 1 + // ================== Check BFloat16 Extensions. // RUN: %clang -target arm-arm-none-eabi -march=armv8.6-a+bf16 -x c -E -dM %s -o - 2>&1 | FileCheck -check-prefix=CHECK-BFLOAT %s // CHECK-BFLOAT: #define __ARM_BF16_FORMAT_ALTERNATIVE 1 Index: clang/lib/Basic/Targets/ARM.h =================================================================== --- clang/lib/Basic/Targets/ARM.h +++ clang/lib/Basic/Targets/ARM.h @@ -79,6 +79,8 @@ unsigned DotProd : 1; unsigned HasMatMul : 1; unsigned FPRegsDisabled : 1; + unsigned HasPAC : 1; + unsigned HasBTI : 1; enum { LDREX_B = (1 << 0), /// byte (8-bit) Index: clang/lib/Basic/Targets/ARM.cpp =================================================================== --- clang/lib/Basic/Targets/ARM.cpp +++ clang/lib/Basic/Targets/ARM.cpp @@ -465,6 +465,8 @@ HWDiv = 0; DotProd = 0; HasMatMul = 0; + HasPAC = 0; + HasBTI = 0; HasFloat16 = true; ARMCDECoprocMask = 0; HasBFloat16 = false; @@ -547,6 +549,9 @@ HasBFloat16 = true; } else if (Feature == "-fpregs") { FPRegsDisabled = true; + } else if (Feature == "+pacbti") { + HasPAC = 1; + HasBTI = 1; } } @@ -890,6 +895,12 @@ if (HasMatMul) Builder.defineMacro("__ARM_FEATURE_MATMUL_INT8", "1"); + if (HasPAC) + Builder.defineMacro("__ARM_FEATURE_PAUTH", "1"); + + if (HasBTI) + Builder.defineMacro("__ARM_FEATURE_BTI", "1"); + if (HasBFloat16) { Builder.defineMacro("__ARM_FEATURE_BF16", "1"); Builder.defineMacro("__ARM_FEATURE_BF16_VECTOR_ARITHMETIC", "1");
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits