[clang] [Clang] Remove preprocessor guards and global feature checks for NEON (PR #95102)
@@ -8084,29 +8084,6 @@ static void HandleNeonVectorTypeAttr(QualType , const ParsedAttr , AuxTI && (AuxTI->getTriple().isAArch64() || AuxTI->getTriple().isARM()); } - // Target must have NEON (or MVE, whose vectors are similar enough - // not to need a separate attribute) - if (!(S.Context.getTargetInfo().hasFeature("neon") || -S.Context.getTargetInfo().hasFeature("mve") || -S.Context.getTargetInfo().hasFeature("sve") || -S.Context.getTargetInfo().hasFeature("sme") || -IsTargetCUDAAndHostARM) && - VecKind == VectorKind::Neon) { -S.Diag(Attr.getLoc(), diag::err_attribute_unsupported) -<< Attr << "'neon', 'mve', 'sve' or 'sme'"; -Attr.setInvalid(); -return; - } - if (!(S.Context.getTargetInfo().hasFeature("neon") || momchil-velikov wrote: You can preserve the behaviour for MVE if you alter the diagnostics condition to be `"NEON type seen" && "no MVE" && "compiling for M-class".` https://github.com/llvm/llvm-project/pull/95102 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang] Remove preprocessor guards and global feature checks for NEON (PR #95102)
@@ -8084,29 +8084,6 @@ static void HandleNeonVectorTypeAttr(QualType , const ParsedAttr , AuxTI && (AuxTI->getTriple().isAArch64() || AuxTI->getTriple().isARM()); } - // Target must have NEON (or MVE, whose vectors are similar enough - // not to need a separate attribute) - if (!(S.Context.getTargetInfo().hasFeature("neon") || -S.Context.getTargetInfo().hasFeature("mve") || -S.Context.getTargetInfo().hasFeature("sve") || -S.Context.getTargetInfo().hasFeature("sme") || -IsTargetCUDAAndHostARM) && - VecKind == VectorKind::Neon) { -S.Diag(Attr.getLoc(), diag::err_attribute_unsupported) -<< Attr << "'neon', 'mve', 'sve' or 'sme'"; -Attr.setInvalid(); -return; - } - if (!(S.Context.getTargetInfo().hasFeature("neon") || Lukacma wrote: Do we ? From my understanding this checks are Neon vector types and are unrelated to MVE. The only reason MVE is used is because MVE vectors are similar enough so we can use them as neon vectors https://github.com/llvm/llvm-project/pull/95102 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang] Remove preprocessor guards and global feature checks for NEON (PR #95102)
@@ -8084,29 +8084,6 @@ static void HandleNeonVectorTypeAttr(QualType , const ParsedAttr , AuxTI && (AuxTI->getTriple().isAArch64() || AuxTI->getTriple().isARM()); } - // Target must have NEON (or MVE, whose vectors are similar enough - // not to need a separate attribute) - if (!(S.Context.getTargetInfo().hasFeature("neon") || -S.Context.getTargetInfo().hasFeature("mve") || -S.Context.getTargetInfo().hasFeature("sve") || -S.Context.getTargetInfo().hasFeature("sme") || -IsTargetCUDAAndHostARM) && - VecKind == VectorKind::Neon) { -S.Diag(Attr.getLoc(), diag::err_attribute_unsupported) -<< Attr << "'neon', 'mve', 'sve' or 'sme'"; -Attr.setInvalid(); -return; - } - if (!(S.Context.getTargetInfo().hasFeature("neon") || CarolineConcatto wrote: I believe we may need to leave still the test for MVE. We need to leave a comment in the ACLE stating that the MVE header is still needed. https://github.com/llvm/llvm-project/pull/95102 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang] Remove preprocessor guards and global feature checks for NEON (PR #95102)
llvmbot wrote: @llvm/pr-subscribers-clang Author: None (Lukacma) Changes To enable function multi-versioning (FMV), current checks which rely on cmd line options or global macros to see if target feature is present need to be removed. This patch removes those for NEON and also implements changes to NEON header file as proposed in [ACLE](https://github.com/ARM-software/acle/pull/321). --- Full diff: https://github.com/llvm/llvm-project/pull/95102.diff 4 Files Affected: - (modified) clang/lib/Sema/SemaType.cpp (-23) - (modified) clang/test/Sema/arm-vector-types-support.c (-2) - (removed) clang/test/SemaCUDA/neon-attrs.cu (-22) - (modified) clang/utils/TableGen/NeonEmitter.cpp (-5) ``diff diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index 441fdcca0758f..65b87f62e294f 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -8084,29 +8084,6 @@ static void HandleNeonVectorTypeAttr(QualType , const ParsedAttr , AuxTI && (AuxTI->getTriple().isAArch64() || AuxTI->getTriple().isARM()); } - // Target must have NEON (or MVE, whose vectors are similar enough - // not to need a separate attribute) - if (!(S.Context.getTargetInfo().hasFeature("neon") || -S.Context.getTargetInfo().hasFeature("mve") || -S.Context.getTargetInfo().hasFeature("sve") || -S.Context.getTargetInfo().hasFeature("sme") || -IsTargetCUDAAndHostARM) && - VecKind == VectorKind::Neon) { -S.Diag(Attr.getLoc(), diag::err_attribute_unsupported) -<< Attr << "'neon', 'mve', 'sve' or 'sme'"; -Attr.setInvalid(); -return; - } - if (!(S.Context.getTargetInfo().hasFeature("neon") || -S.Context.getTargetInfo().hasFeature("mve") || -IsTargetCUDAAndHostARM) && - VecKind == VectorKind::NeonPoly) { -S.Diag(Attr.getLoc(), diag::err_attribute_unsupported) -<< Attr << "'neon' or 'mve'"; -Attr.setInvalid(); -return; - } - // Check the attribute arguments. if (Attr.getNumArgs() != 1) { S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) diff --git a/clang/test/Sema/arm-vector-types-support.c b/clang/test/Sema/arm-vector-types-support.c index ed5f5ba175a94..1d2e1c9336fc6 100644 --- a/clang/test/Sema/arm-vector-types-support.c +++ b/clang/test/Sema/arm-vector-types-support.c @@ -2,6 +2,4 @@ // RUN: %clang_cc1 %s -triple aarch64 -fsyntax-only -verify // RUN: %clang_cc1 %s -triple aarch64 -target-feature -fp-armv8 -target-abi aapcs-soft -fsyntax-only -verify -typedef __attribute__((neon_vector_type(2))) int int32x2_t; // expected-error{{'neon_vector_type' attribute is not supported on targets missing 'neon', 'mve', 'sve' or 'sme'; specify an appropriate -march= or -mcpu=}} -typedef __attribute__((neon_polyvector_type(16))) short poly8x16_t; // expected-error{{'neon_polyvector_type' attribute is not supported on targets missing 'neon' or 'mve'; specify an appropriate -march= or -mcpu=}} typedef __attribute__((arm_sve_vector_bits(256))) void nosveflag; // expected-error{{'arm_sve_vector_bits' attribute is not supported on targets missing 'sve'; specify an appropriate -march= or -mcpu=}} diff --git a/clang/test/SemaCUDA/neon-attrs.cu b/clang/test/SemaCUDA/neon-attrs.cu deleted file mode 100644 index 129056741ac9a..0 --- a/clang/test/SemaCUDA/neon-attrs.cu +++ /dev/null @@ -1,22 +0,0 @@ -// CPU-side compilation on ARM with neon enabled (no errors expected). -// RUN: %clang_cc1 -triple arm64-linux-gnu -target-feature +neon -aux-triple nvptx64 -x cuda -fsyntax-only -verify=quiet %s - -// CPU-side compilation on ARM with neon disabled. -// RUN: %clang_cc1 -triple arm64-linux-gnu -target-feature -neon -aux-triple nvptx64 -x cuda -fsyntax-only -verify %s - -// GPU-side compilation on ARM (no errors expected). -// RUN: %clang_cc1 -triple nvptx64 -aux-triple arm64-linux-gnu -fcuda-is-device -x cuda -fsyntax-only -verify=quiet %s - -// Regular C++ compilation on ARM with neon enabled (no errors expected). -// RUN: %clang_cc1 -triple arm64-linux-gnu -target-feature +neon -x c++ -fsyntax-only -verify=quiet %s - -// Regular C++ compilation on ARM with neon disabled. -// RUN: %clang_cc1 -triple arm64-linux-gnu -target-feature -neon -x c++ -fsyntax-only -verify %s - -// quiet-no-diagnostics -typedef __attribute__((neon_vector_type(4))) float float32x4_t; -// expected-error@-1 {{'neon_vector_type' attribute is not supported on targets missing 'neon', 'mve', 'sve' or 'sme'}} -// expect -typedef unsigned char poly8_t; -typedef __attribute__((neon_polyvector_type(8))) poly8_t poly8x8_t; -// expected-error@-1 {{'neon_polyvector_type' attribute is not supported on targets missing 'neon' or 'mve'}} diff --git a/clang/utils/TableGen/NeonEmitter.cpp b/clang/utils/TableGen/NeonEmitter.cpp index 56f1fdf9ef574..626031d38cf00 100644 --- a/clang/utils/TableGen/NeonEmitter.cpp +++ b/clang/utils/TableGen/NeonEmitter.cpp @@ -2370,10 +2370,6 @@ void
[clang] [Clang] Remove preprocessor guards and global feature checks for NEON (PR #95102)
https://github.com/Lukacma created https://github.com/llvm/llvm-project/pull/95102 To enable function multi-versioning (FMV), current checks which rely on cmd line options or global macros to see if target feature is present need to be removed. This patch removes those for NEON and also implements changes to NEON header file as proposed in [ACLE](https://github.com/ARM-software/acle/pull/321). >From cdffede6773ae1bdbe759d636f582a9218522c32 Mon Sep 17 00:00:00 2001 From: Marian Lukac Date: Tue, 11 Jun 2024 11:00:42 + Subject: [PATCH] [Clang] Remove preprocessor guards and global feature checks for NEON --- clang/lib/Sema/SemaType.cpp| 23 -- clang/test/Sema/arm-vector-types-support.c | 2 -- clang/test/SemaCUDA/neon-attrs.cu | 22 - clang/utils/TableGen/NeonEmitter.cpp | 5 - 4 files changed, 52 deletions(-) delete mode 100644 clang/test/SemaCUDA/neon-attrs.cu diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index 441fdcca0758f..65b87f62e294f 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -8084,29 +8084,6 @@ static void HandleNeonVectorTypeAttr(QualType , const ParsedAttr , AuxTI && (AuxTI->getTriple().isAArch64() || AuxTI->getTriple().isARM()); } - // Target must have NEON (or MVE, whose vectors are similar enough - // not to need a separate attribute) - if (!(S.Context.getTargetInfo().hasFeature("neon") || -S.Context.getTargetInfo().hasFeature("mve") || -S.Context.getTargetInfo().hasFeature("sve") || -S.Context.getTargetInfo().hasFeature("sme") || -IsTargetCUDAAndHostARM) && - VecKind == VectorKind::Neon) { -S.Diag(Attr.getLoc(), diag::err_attribute_unsupported) -<< Attr << "'neon', 'mve', 'sve' or 'sme'"; -Attr.setInvalid(); -return; - } - if (!(S.Context.getTargetInfo().hasFeature("neon") || -S.Context.getTargetInfo().hasFeature("mve") || -IsTargetCUDAAndHostARM) && - VecKind == VectorKind::NeonPoly) { -S.Diag(Attr.getLoc(), diag::err_attribute_unsupported) -<< Attr << "'neon' or 'mve'"; -Attr.setInvalid(); -return; - } - // Check the attribute arguments. if (Attr.getNumArgs() != 1) { S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) diff --git a/clang/test/Sema/arm-vector-types-support.c b/clang/test/Sema/arm-vector-types-support.c index ed5f5ba175a94..1d2e1c9336fc6 100644 --- a/clang/test/Sema/arm-vector-types-support.c +++ b/clang/test/Sema/arm-vector-types-support.c @@ -2,6 +2,4 @@ // RUN: %clang_cc1 %s -triple aarch64 -fsyntax-only -verify // RUN: %clang_cc1 %s -triple aarch64 -target-feature -fp-armv8 -target-abi aapcs-soft -fsyntax-only -verify -typedef __attribute__((neon_vector_type(2))) int int32x2_t; // expected-error{{'neon_vector_type' attribute is not supported on targets missing 'neon', 'mve', 'sve' or 'sme'; specify an appropriate -march= or -mcpu=}} -typedef __attribute__((neon_polyvector_type(16))) short poly8x16_t; // expected-error{{'neon_polyvector_type' attribute is not supported on targets missing 'neon' or 'mve'; specify an appropriate -march= or -mcpu=}} typedef __attribute__((arm_sve_vector_bits(256))) void nosveflag; // expected-error{{'arm_sve_vector_bits' attribute is not supported on targets missing 'sve'; specify an appropriate -march= or -mcpu=}} diff --git a/clang/test/SemaCUDA/neon-attrs.cu b/clang/test/SemaCUDA/neon-attrs.cu deleted file mode 100644 index 129056741ac9a..0 --- a/clang/test/SemaCUDA/neon-attrs.cu +++ /dev/null @@ -1,22 +0,0 @@ -// CPU-side compilation on ARM with neon enabled (no errors expected). -// RUN: %clang_cc1 -triple arm64-linux-gnu -target-feature +neon -aux-triple nvptx64 -x cuda -fsyntax-only -verify=quiet %s - -// CPU-side compilation on ARM with neon disabled. -// RUN: %clang_cc1 -triple arm64-linux-gnu -target-feature -neon -aux-triple nvptx64 -x cuda -fsyntax-only -verify %s - -// GPU-side compilation on ARM (no errors expected). -// RUN: %clang_cc1 -triple nvptx64 -aux-triple arm64-linux-gnu -fcuda-is-device -x cuda -fsyntax-only -verify=quiet %s - -// Regular C++ compilation on ARM with neon enabled (no errors expected). -// RUN: %clang_cc1 -triple arm64-linux-gnu -target-feature +neon -x c++ -fsyntax-only -verify=quiet %s - -// Regular C++ compilation on ARM with neon disabled. -// RUN: %clang_cc1 -triple arm64-linux-gnu -target-feature -neon -x c++ -fsyntax-only -verify %s - -// quiet-no-diagnostics -typedef __attribute__((neon_vector_type(4))) float float32x4_t; -// expected-error@-1 {{'neon_vector_type' attribute is not supported on targets missing 'neon', 'mve', 'sve' or 'sme'}} -// expect -typedef unsigned char poly8_t; -typedef __attribute__((neon_polyvector_type(8))) poly8_t poly8x8_t; -// expected-error@-1 {{'neon_polyvector_type' attribute is not supported on targets missing 'neon' or 'mve'}} diff --git