diff --git a/clang/test/Driver/aarch64-ite.c b/clang/test/Driver/aarch64-ite.c new file mode 100644 --- /dev/null +++ b/clang/test/Driver/aarch64-ite.c @@ -0,0 +1,17 @@ +// Test that target feature ite is implemented and available correctly + +// FEAT_ITE is optional (off by default) for v8.9a/9.4a and older, and can be enabled using +ite +// RUN: %clang -### -target aarch64-none-none-eabi -march=armv8.8-a %s 2>&1 | FileCheck %s --check-prefix=NOT_ENABLED +// RUN: %clang -### -target aarch64-none-none-eabi -march=armv8.8-a+ite %s 2>&1 | FileCheck %s --check-prefix=ENABLED +// RUN: %clang -### -target aarch64-none-none-eabi -march=armv8.8-a+noite %s 2>&1 | FileCheck %s --check-prefix=DISABLED +// RUN: %clang -### -target aarch64-none-none-eabi -march=armv9.3-a %s 2>&1 | FileCheck %s --check-prefix=NOT_ENABLED +// RUN: %clang -### -target aarch64-none-none-eabi -march=armv9.3-a+ite %s 2>&1 | FileCheck %s --check-prefix=ENABLED +// RUN: %clang -### -target aarch64-none-none-eabi -march=armv9.3-a+noite %s 2>&1 | FileCheck %s --check-prefix=DISABLED + +// FEAT_ITE is invalid before v8 +// RUN: %clang -### -target arm-none-none-eabi -march=armv7-a+ite %s 2>&1 | FileCheck %s --check-prefix=INVALID + +// INVALID: error: unsupported argument 'armv7-a+ite' to option '-march=' +// ENABLED: "-target-feature" "+ite" +// NOT_ENABLED-NOT: "-target-feature" "+ite" +// DISABLED: "-target-feature" "-ite" diff --git a/llvm/include/llvm/TargetParser/AArch64TargetParser.h b/llvm/include/llvm/TargetParser/AArch64TargetParser.h --- a/llvm/include/llvm/TargetParser/AArch64TargetParser.h +++ b/llvm/include/llvm/TargetParser/AArch64TargetParser.h @@ -146,6 +146,7 @@ AEK_LSE128 = 1ULL << 52, // FEAT_LSE128 AEK_SPECRES2 = 1ULL << 53, // FEAT_SPECRES2 AEK_RASv2 = 1ULL << 54, // FEAT_RASv2 + AEK_ITE = 1ULL << 55, // FEAT_ITE }; // clang-format on diff --git a/llvm/include/llvm/TargetParser/AArch64TargetParser.def b/llvm/include/llvm/TargetParser/AArch64TargetParser.def --- a/llvm/include/llvm/TargetParser/AArch64TargetParser.def +++ b/llvm/include/llvm/TargetParser/AArch64TargetParser.def @@ -217,6 +217,7 @@ AARCH64_ARCH_EXT_NAME("d128", AArch64::AEK_D128, "+d128", "-d128", MAX, "", 0) AARCH64_ARCH_EXT_NAME("lse128", AArch64::AEK_LSE128, "+lse128", "-lse128", MAX, "", 0) +AARCH64_ARCH_EXT_NAME("ite", AArch64::AEK_ITE, "+ite", "-ite", MAX, "", 0) AARCH64_ARCH_EXT_NAME("sha1", AArch64::AEK_NONE, {}, {}, SHA1, "+fp-armv8,+neon", 120) AARCH64_ARCH_EXT_NAME("pmull", AArch64::AEK_NONE, {}, {}, PMULL, diff --git a/llvm/unittests/TargetParser/TargetParserTest.cpp b/llvm/unittests/TargetParser/TargetParserTest.cpp --- a/llvm/unittests/TargetParser/TargetParserTest.cpp +++ b/llvm/unittests/TargetParser/TargetParserTest.cpp @@ -1610,6 +1610,7 @@ AArch64::AEK_B16B16, AArch64::AEK_SMEF16F16, AArch64::AEK_CSSC, AArch64::AEK_RCPC3, AArch64::AEK_THE, AArch64::AEK_D128, AArch64::AEK_LSE128, AArch64::AEK_SPECRES2, AArch64::AEK_RASv2, + AArch64::AEK_ITE, }; std::vector Features; @@ -1681,6 +1682,7 @@ EXPECT_TRUE(llvm::is_contained(Features, "+d128")); EXPECT_TRUE(llvm::is_contained(Features, "+lse128")); EXPECT_TRUE(llvm::is_contained(Features, "+specres2")); + EXPECT_TRUE(llvm::is_contained(Features, "+ite")); // Assuming we listed every extension above, this should produce the same // result. (note that AEK_NONE doesn't have a name so it won't be in the