https://github.com/davemgreen updated https://github.com/llvm/llvm-project/pull/126945
>From 5a17166859760dcbc258892be46f7f909c2b00a9 Mon Sep 17 00:00:00 2001 From: Tomas Matheson <tomas.mathe...@arm.com> Date: Wed, 12 Feb 2025 14:31:47 +0000 Subject: [PATCH 1/3] Add missing Neon Types The AAPCS64 adds a number of vector types to the C unconditionally: https://github.com/ARM-software/abi-aa/blob/main/aapcs64/aapcs64.rst#11appendix-support-for-advanced-simd-extensions The equivalent SVE types are already available in clang: https://github.com/ARM-software/abi-aa/blob/main/aapcs64/aapcs64.rst#12appendix-support-for-scalable-vectors __mfp8 is defined in the ACLE https://arm-software.github.io/acle/main/acle.html#data-types I'm not sure whether __mfp8 should be defined for A32. For now I have left it as it is. --- .../include/clang/Basic/AArch64ACLETypes.def | 36 +++++ clang/include/clang/Basic/LangOptions.def | 1 + clang/include/clang/Basic/Specifiers.h | 6 + clang/include/clang/Basic/TokenKinds.def | 6 + clang/include/clang/Sema/DeclSpec.h | 6 + clang/lib/AST/ASTContext.cpp | 14 +- clang/lib/Basic/IdentifierTable.cpp | 5 +- clang/lib/Basic/LangOptions.cpp | 3 + clang/lib/Parse/ParseDecl.cpp | 13 ++ clang/lib/Parse/ParseTentative.cpp | 8 ++ clang/lib/Sema/DeclSpec.cpp | 9 ++ clang/lib/Sema/SemaTemplateVariadic.cpp | 4 + clang/lib/Sema/SemaType.cpp | 7 + clang/test/AST/ast-dump-aarch64-neon-types.c | 128 ++++++++++++++++++ 14 files changed, 242 insertions(+), 4 deletions(-) create mode 100644 clang/test/AST/ast-dump-aarch64-neon-types.c diff --git a/clang/include/clang/Basic/AArch64ACLETypes.def b/clang/include/clang/Basic/AArch64ACLETypes.def index 89e8e31d9ce3a..e508b130569d4 100644 --- a/clang/include/clang/Basic/AArch64ACLETypes.def +++ b/clang/include/clang/Basic/AArch64ACLETypes.def @@ -205,6 +205,42 @@ SVE_OPAQUE_TYPE(__SVCount_t, __SVCount_t, SveCount, SveCountTy) SVE_SCALAR_TYPE(__mfp8, __mfp8, MFloat8, MFloat8Ty, 8) +// Unlike the SVE types above, the Neon vector types are parsed as keywords and +// mapped to the equivalent __attribute__(neon_vector_type(...)) vector type. +// They are not builtin types. +#ifndef NEON_VECTOR_TYPE +#define NEON_VECTOR_TYPE(Name, BaseType, ElBits, NumEls, VectorKind) +#endif +NEON_VECTOR_TYPE(__Int8x8_t, CharTy, 8, 8, VectorKind::Neon) +NEON_VECTOR_TYPE(__Int16x4_t, ShortTy, 16, 4, VectorKind::Neon) +NEON_VECTOR_TYPE(__Int32x2_t, IntTy, 32, 2, VectorKind::Neon) +NEON_VECTOR_TYPE(__Uint8x8_t, CharTy, 8, 8, VectorKind::Neon) +NEON_VECTOR_TYPE(__Uint16x4_t, UnsignedShortTy, 16, 4, VectorKind::Neon) +NEON_VECTOR_TYPE(__Uint32x2_t, UnsignedIntTy, 32, 2, VectorKind::Neon) +NEON_VECTOR_TYPE(__Float16x4_t, Float16Ty, 16, 4, VectorKind::Neon) +NEON_VECTOR_TYPE(__Float32x2_t, FloatTy, 32, 2, VectorKind::Neon) +NEON_VECTOR_TYPE(__Poly8x8_t, CharTy, 8, 8, VectorKind::NeonPoly) +NEON_VECTOR_TYPE(__Poly16x4_t, UnsignedShortTy, 16, 4, VectorKind::NeonPoly) +NEON_VECTOR_TYPE(__Bfloat16x4_t, BFloat16Ty, 16, 4, VectorKind::Neon) +NEON_VECTOR_TYPE(__Int8x16_t, CharTy, 8, 16, VectorKind::Neon) +NEON_VECTOR_TYPE(__Int16x8_t, ShortTy, 16, 8, VectorKind::Neon) +NEON_VECTOR_TYPE(__Int32x4_t, IntTy, 32, 4, VectorKind::Neon) +NEON_VECTOR_TYPE(__Int64x2_t, LongLongTy, 64, 2, VectorKind::Neon) +NEON_VECTOR_TYPE(__Uint8x16_t, CharTy, 8, 16, VectorKind::Neon) +NEON_VECTOR_TYPE(__Uint16x8_t, UnsignedShortTy, 16, 8, VectorKind::Neon) +NEON_VECTOR_TYPE(__Uint32x4_t, UnsignedIntTy, 32, 4, VectorKind::Neon) +NEON_VECTOR_TYPE(__Uint64x2_t, UnsignedLongLongTy, 64, 2, VectorKind::Neon) +NEON_VECTOR_TYPE(__Float16x8_t, Float16Ty, 16, 8, VectorKind::Neon) +NEON_VECTOR_TYPE(__Float32x4_t, FloatTy, 32, 4, VectorKind::Neon) +NEON_VECTOR_TYPE(__Float64x2_t, DoubleTy, 64, 2, VectorKind::Neon) +NEON_VECTOR_TYPE(__Poly8x16_t, CharTy, 8, 16, VectorKind::NeonPoly) +NEON_VECTOR_TYPE(__Poly16x8_t, UnsignedShortTy, 16, 8, VectorKind::NeonPoly) +NEON_VECTOR_TYPE(__Poly64x2_t, UnsignedLongLongTy, 64, 2, VectorKind::NeonPoly) +NEON_VECTOR_TYPE(__Bfloat16x8_t, BFloat16Ty, 16, 8, VectorKind::Neon) +NEON_VECTOR_TYPE(__Mfloat8x8_t, MFloat8Ty, 8, 8, VectorKind::Neon) +NEON_VECTOR_TYPE(__Mfloat8x16_t, MFloat8Ty, 16, 8, VectorKind::Neon) + +#undef NEON_VECTOR_TYPE #undef SVE_VECTOR_TYPE #undef SVE_VECTOR_TYPE_MFLOAT #undef SVE_VECTOR_TYPE_BFLOAT diff --git a/clang/include/clang/Basic/LangOptions.def b/clang/include/clang/Basic/LangOptions.def index 789761c1f3647..cd2af3e13499d 100644 --- a/clang/include/clang/Basic/LangOptions.def +++ b/clang/include/clang/Basic/LangOptions.def @@ -463,6 +463,7 @@ COMPATIBLE_VALUE_LANGOPT(FunctionAlignment, 5, 0, "Default alignment for functio COMPATIBLE_VALUE_LANGOPT(LoopAlignment, 32, 0, "Default alignment for loops") LANGOPT(FixedPoint, 1, 0, "fixed point types") +LANGOPT(ACLE, 1, 0, "Arm C Language Extensions") LANGOPT(PaddingOnUnsignedFixedPoint, 1, 0, "unsigned fixed point types having one extra padding bit") diff --git a/clang/include/clang/Basic/Specifiers.h b/clang/include/clang/Basic/Specifiers.h index 491badcc804e7..37684d1136ec6 100644 --- a/clang/include/clang/Basic/Specifiers.h +++ b/clang/include/clang/Basic/Specifiers.h @@ -98,6 +98,12 @@ namespace clang { #define GENERIC_IMAGE_TYPE(ImgType, Id) \ TST_##ImgType##_t, // OpenCL image types #include "clang/Basic/OpenCLImageTypes.def" + +#define NEON_VECTOR_TYPE(Name, BaseType, ElBits, NumEls, VectorKind) \ + TST_##Name, +#define SVE_TYPE(Name, Id, SingletonId) +#include "clang/Basic/AArch64SVEACLETypes.def" + #define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) \ TST_##Name, // HLSL Intangible Types #include "clang/Basic/HLSLIntangibleTypes.def" diff --git a/clang/include/clang/Basic/TokenKinds.def b/clang/include/clang/Basic/TokenKinds.def index 94e72fea56a68..70e1fe5c75649 100644 --- a/clang/include/clang/Basic/TokenKinds.def +++ b/clang/include/clang/Basic/TokenKinds.def @@ -687,6 +687,12 @@ KEYWORD(__bool , KEYALTIVEC|KEYZVECTOR) ALIAS("__fp16", half , KEYALL) KEYWORD(__bf16 , KEYALL) +// ARM NEON types +#define NEON_VECTOR_TYPE(Name, BaseType, ElBits, NumEls, VectorKind) \ + KEYWORD(Name, KEYACLE) +#define SVE_TYPE(Name, Id, SingletonId) +#include "clang/Basic/AArch64SVEACLETypes.def" + // OpenCL Extension. KEYWORD(half , HALFSUPPORT) diff --git a/clang/include/clang/Sema/DeclSpec.h b/clang/include/clang/Sema/DeclSpec.h index 6c4a32c4ac2f0..db794dc677136 100644 --- a/clang/include/clang/Sema/DeclSpec.h +++ b/clang/include/clang/Sema/DeclSpec.h @@ -321,6 +321,12 @@ class DeclSpec { #define GENERIC_IMAGE_TYPE(ImgType, Id) \ static const TST TST_##ImgType##_t = clang::TST_##ImgType##_t; #include "clang/Basic/OpenCLImageTypes.def" + +#define NEON_VECTOR_TYPE(Name, BaseType, ElBits, NumEls, VectorKind) \ + static const TST TST_##Name = clang::TST_##Name; +#define SVE_TYPE(Name, Id, SingletonId) +#include "clang/Basic/AArch64SVEACLETypes.def" + #define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) \ static const TST TST_##Name = clang::TST_##Name; #include "clang/Basic/HLSLIntangibleTypes.def" diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 04eb44dc9426e..d808d6adc9f98 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -1450,11 +1450,19 @@ void ASTContext::InitBuiltinTypes(const TargetInfo &Target, if (Target.hasAArch64SVETypes() || (AuxTarget && AuxTarget->hasAArch64SVETypes())) { -#define SVE_TYPE(Name, Id, SingletonId) \ - InitBuiltinType(SingletonId, BuiltinType::Id); -#include "clang/Basic/AArch64ACLETypes.def" +#define SVE_VECTOR_TYPE(Name, MangledName, Id, SingletonId) \ + InitBuiltinType(SingletonId, BuiltinType::Id); +#define SVE_PREDICATE_TYPE(Name, MangledName, Id, SingletonId) \ + InitBuiltinType(SingletonId, BuiltinType::Id); +#define SVE_OPAQUE_TYPE(Name, MangledName, Id, SingletonId) \ + InitBuiltinType(SingletonId, BuiltinType::Id); +#define SVE_TYPE(Name, MangledName, SingletonId) +#include "clang/Basic/AArch64SVEACLETypes.def" } + if (LangOpts.ACLE) + InitBuiltinType(MFloat8Ty, BuiltinType::MFloat8); + if (Target.getTriple().isPPC64()) { #define PPC_VECTOR_MMA_TYPE(Name, Id, Size) \ InitBuiltinType(Id##Ty, BuiltinType::Id); diff --git a/clang/lib/Basic/IdentifierTable.cpp b/clang/lib/Basic/IdentifierTable.cpp index 099f2e8a18da5..bc22e355f72cb 100644 --- a/clang/lib/Basic/IdentifierTable.cpp +++ b/clang/lib/Basic/IdentifierTable.cpp @@ -111,7 +111,8 @@ enum TokenKey : unsigned { KEYNOZOS = 0x4000000, KEYHLSL = 0x8000000, KEYFIXEDPOINT = 0x10000000, - KEYMAX = KEYFIXEDPOINT, // The maximum key + KEYACLE = 0x20000000, // Enable Arm Neon vector type keywords + KEYMAX = KEYACLE, // The maximum key KEYALLCXX = KEYCXX | KEYCXX11 | KEYCXX20, KEYALL = (KEYMAX | (KEYMAX - 1)) & ~KEYNOMS18 & ~KEYNOOPENCL & ~KEYNOZOS // KEYNOMS18, KEYNOOPENCL, KEYNOZOS are excluded. @@ -216,6 +217,8 @@ static KeywordStatus getKeywordStatusHelper(const LangOptions &LangOpts, return KS_Unknown; case KEYFIXEDPOINT: return LangOpts.FixedPoint ? KS_Enabled : KS_Disabled; + case KEYACLE: + return LangOpts.ACLE ? KS_Enabled : KS_Disabled; default: llvm_unreachable("Unknown KeywordStatus flag"); } diff --git a/clang/lib/Basic/LangOptions.cpp b/clang/lib/Basic/LangOptions.cpp index 7e696620993f9..68e2b473f5dfc 100644 --- a/clang/lib/Basic/LangOptions.cpp +++ b/clang/lib/Basic/LangOptions.cpp @@ -203,6 +203,9 @@ void LangOptions::setLangDefaults(LangOptions &Opts, Language Lang, Opts.setDefaultFPContractMode(LangOptions::FPM_Fast); } + if (T.isARM() || T.isAArch64()) + Opts.ACLE = true; + // OpenCL, C++ and C23 have bool, true, false keywords. Opts.Bool = Opts.OpenCL || Opts.CPlusPlus || Opts.C23; diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index f7eb56426f6de..7efd506c56603 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -4442,6 +4442,15 @@ void Parser::ParseDeclarationSpecifiers( goto DoneWithDeclSpec; \ break; #include "clang/Basic/OpenCLImageTypes.def" + +#define NEON_VECTOR_TYPE(Name, BaseType, ElBits, NumEls, VectorKind) \ + case tok::kw_##Name: \ + isInvalid = DS.SetTypeSpecType(DeclSpec::TST_##Name, Loc, PrevSpec, \ + DiagID, Policy); \ + break; +#define SVE_TYPE(Name, Id, SingletonId) +#include "clang/Basic/AArch64SVEACLETypes.def" + case tok::kw___unknown_anytype: isInvalid = DS.SetTypeSpecType(TST_unknown_anytype, Loc, PrevSpec, DiagID, Policy); @@ -5955,6 +5964,10 @@ bool Parser::isDeclarationSpecifier( case tok::kw___read_only: case tok::kw___read_write: case tok::kw___write_only: +#define NEON_VECTOR_TYPE(Name, BaseType, ElBits, NumEls, VectorKind) \ + case tok::kw_##Name: +#define SVE_TYPE(Name, Id, SingletonId) +#include "clang/Basic/AArch64SVEACLETypes.def" #define GENERIC_IMAGE_TYPE(ImgType, Id) case tok::kw_##ImgType##_t: #include "clang/Basic/OpenCLImageTypes.def" #define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) case tok::kw_##Name: diff --git a/clang/lib/Parse/ParseTentative.cpp b/clang/lib/Parse/ParseTentative.cpp index 95cee824c40b7..cda04a7073991 100644 --- a/clang/lib/Parse/ParseTentative.cpp +++ b/clang/lib/Parse/ParseTentative.cpp @@ -1472,6 +1472,10 @@ Parser::isCXXDeclarationSpecifier(ImplicitTypenameContext AllowImplicitTypename, case tok::kw__Fract: case tok::kw__Sat: case tok::annot_pack_indexing_type: +#define NEON_VECTOR_TYPE(Name, BaseType, ElBits, NumEls, VectorKind) \ + case tok::kw_##Name: +#define SVE_TYPE(Name, Id, SingletonId) +#include "clang/Basic/AArch64SVEACLETypes.def" #define GENERIC_IMAGE_TYPE(ImgType, Id) case tok::kw_##ImgType##_t: #include "clang/Basic/OpenCLImageTypes.def" #define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) case tok::kw_##Name: @@ -1600,6 +1604,10 @@ bool Parser::isCXXDeclarationSpecifierAType() { case tok::kw__Accum: case tok::kw__Fract: case tok::kw__Sat: +#define NEON_VECTOR_TYPE(Name, BaseType, ElBits, NumEls, VectorKind) \ + case tok::kw_##Name: +#define SVE_TYPE(Name, Id, SingletonId) +#include "clang/Basic/AArch64SVEACLETypes.def" #define GENERIC_IMAGE_TYPE(ImgType, Id) case tok::kw_##ImgType##_t: #include "clang/Basic/OpenCLImageTypes.def" #define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) case tok::kw_##Name: diff --git a/clang/lib/Sema/DeclSpec.cpp b/clang/lib/Sema/DeclSpec.cpp index ee5a862c32509..0faf012dcb192 100644 --- a/clang/lib/Sema/DeclSpec.cpp +++ b/clang/lib/Sema/DeclSpec.cpp @@ -374,6 +374,10 @@ bool Declarator::isDeclarationOfFunction() const { case TST_typename_pack_indexing: #define GENERIC_IMAGE_TYPE(ImgType, Id) case TST_##ImgType##_t: #include "clang/Basic/OpenCLImageTypes.def" +#define NEON_VECTOR_TYPE(Name, BaseType, ElBits, NumEls, VectorKind) \ + case TST_##Name: +#define SVE_TYPE(Name, Id, SingletonId) +#include "clang/Basic/AArch64SVEACLETypes.def" #define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) case TST_##Name: #include "clang/Basic/HLSLIntangibleTypes.def" return false; @@ -607,6 +611,11 @@ const char *DeclSpec::getSpecifierName(DeclSpec::TST T, case DeclSpec::TST_##ImgType##_t: \ return #ImgType "_t"; #include "clang/Basic/OpenCLImageTypes.def" +#define NEON_VECTOR_TYPE(Name, BaseType, ElBits, NumEls, VectorKind) \ + case DeclSpec::TST_##Name: \ + return #Name; +#define SVE_TYPE(Name, Id, SingletonId) +#include "clang/Basic/AArch64SVEACLETypes.def" #define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) \ case DeclSpec::TST_##Name: \ return #Name; diff --git a/clang/lib/Sema/SemaTemplateVariadic.cpp b/clang/lib/Sema/SemaTemplateVariadic.cpp index 5f0e968ff18c4..b24ce78f4e5e5 100644 --- a/clang/lib/Sema/SemaTemplateVariadic.cpp +++ b/clang/lib/Sema/SemaTemplateVariadic.cpp @@ -1056,6 +1056,10 @@ bool Sema::containsUnexpandedParameterPacks(Declarator &D) { case TST_BFloat16: #define GENERIC_IMAGE_TYPE(ImgType, Id) case TST_##ImgType##_t: #include "clang/Basic/OpenCLImageTypes.def" +#define NEON_VECTOR_TYPE(Name, BaseType, ElBits, NumEls, VectorKind) \ + case TST_##Name: +#define SVE_TYPE(Name, Id, SingletonId) +#include "clang/Basic/AArch64SVEACLETypes.def" #define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) case TST_##Name: #include "clang/Basic/HLSLIntangibleTypes.def" case TST_unknown_anytype: diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index 338b81fe89748..2839fdc6d20ac 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -1365,6 +1365,13 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) { break; #include "clang/Basic/OpenCLImageTypes.def" +#define NEON_VECTOR_TYPE(Name, BaseType, ElBits, NumEls, VectorKind) \ + case DeclSpec::TST_##Name: \ + Result = Context.getVectorType(Context.BaseType, NumEls, VectorKind); \ + break; +#define SVE_TYPE(Name, Id, SingletonId) +#include "clang/Basic/AArch64SVEACLETypes.def" + #define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) \ case DeclSpec::TST_##Name: \ Result = Context.SingletonId; \ diff --git a/clang/test/AST/ast-dump-aarch64-neon-types.c b/clang/test/AST/ast-dump-aarch64-neon-types.c new file mode 100644 index 0000000000000..4875edd80fde0 --- /dev/null +++ b/clang/test/AST/ast-dump-aarch64-neon-types.c @@ -0,0 +1,128 @@ +// Test that NEON types are defined, even when arm_neon.h is not included. +// as required by AAPCS64 "Support for Advanced SIMD Extensions". + +// RUN: %clang_cc1 -ast-dump -triple arm-linux-gnu -D A32 %s -x c | FileCheck --check-prefixes=CHECK %s +// RUN: %clang_cc1 -ast-dump -triple arm-linux-gnu -D A32 %s -x c++ | FileCheck --check-prefixes=CHECK %s +// RUN: %clang_cc1 -ast-dump -triple aarch64-linux-gnu %s -x c | FileCheck --check-prefixes=CHECK,A64 %s +// RUN: %clang_cc1 -ast-dump -triple aarch64-linux-gnu %s -x c++ | FileCheck --check-prefixes=CHECK,A64 %s +// RUN: %clang_cc1 -verify -verify-ignore-unexpected=note -triple x86_64 %s -x c +// RUN: %clang_cc1 -verify -verify-ignore-unexpected=note -triple x86_64 %s -x c++ + +__Int8x8_t Int8x8; +// CHECK: Int8x8 '__attribute__((neon_vector_type(8))) char' +// expected-error@-2{{unknown type name '__Int8x8_t'}} + +__Int16x4_t Int16x4; +// CHECK: Int16x4 '__attribute__((neon_vector_type(16))) short' +// expected-error@-2{{unknown type name '__Int16x4_t'}} + +__Int32x2_t Int32x2; +// CHECK: Int32x2 '__attribute__((neon_vector_type(32))) int' +// expected-error@-2{{unknown type name '__Int32x2_t'}} + +__Uint8x8_t Uint8x8; +// CHECK: Uint8x8 '__attribute__((neon_vector_type(8))) char' +// expected-error@-2{{unknown type name '__Uint8x8_t'}} + +__Uint16x4_t Uint16x4; +// CHECK: Uint16x4 '__attribute__((neon_vector_type(16))) unsigned short' +// expected-error@-2{{unknown type name '__Uint16x4_t'}} + +__Uint32x2_t Uint32x2; +// CHECK: Uint32x2 '__attribute__((neon_vector_type(32))) unsigned int' +// expected-error@-2{{unknown type name '__Uint32x2_t'}} + +__Float16x4_t Float16x4; +// CHECK: Float16x4 '__attribute__((neon_vector_type(16))) _Float16' +// expected-error@-2{{unknown type name '__Float16x4_t'}} + +__Float32x2_t Float32x2; +// CHECK: Float32x2 '__attribute__((neon_vector_type(32))) float' +// expected-error@-2{{unknown type name '__Float32x2_t'}} + +__Poly8x8_t Poly8x8; +// CHECK: Poly8x8 '__attribute__((neon_polyvector_type(8))) char' +// expected-error@-2{{unknown type name '__Poly8x8_t'}} + +__Poly16x4_t Poly16x4; +// CHECK: Poly16x4 '__attribute__((neon_polyvector_type(16))) unsigned short' +// expected-error@-2{{unknown type name '__Poly16x4_t'}} + +__Bfloat16x4_t Bfloat16x4; +// CHECK: Bfloat16x4 '__attribute__((neon_vector_type(16))) __bf16' +// expected-error@-2{{unknown type name '__Bfloat16x4_t'}} + +__Int8x16_t Int8x16; +// CHECK: Int8x16 '__attribute__((neon_vector_type(8))) char' +// expected-error@-2{{unknown type name '__Int8x16_t'}} + +__Int16x8_t Int16x8; +// CHECK: Int16x8 '__attribute__((neon_vector_type(16))) short' +// expected-error@-2{{unknown type name '__Int16x8_t'}} + +__Int32x4_t Int32x4; +// CHECK: Int32x4 '__attribute__((neon_vector_type(32))) int' +// expected-error@-2{{unknown type name '__Int32x4_t'}} + +__Int64x2_t Int64x2; +// CHECK: Int64x2 '__attribute__((neon_vector_type(64))) long long' +// expected-error@-2{{unknown type name '__Int64x2_t'}} + +__Uint8x16_t Uint8x16; +// CHECK: Uint8x16 '__attribute__((neon_vector_type(8))) char' +// expected-error@-2{{unknown type name '__Uint8x16_t'}} + +__Uint16x8_t Uint16x8; +// CHECK: Uint16x8 '__attribute__((neon_vector_type(16))) unsigned short' +// expected-error@-2{{unknown type name '__Uint16x8_t'}} + +__Uint32x4_t Uint32x4; +// CHECK: Uint32x4 '__attribute__((neon_vector_type(32))) unsigned int' +// expected-error@-2{{unknown type name '__Uint32x4_t'}} + +__Uint64x2_t Uint64x2; +// CHECK: Uint64x2 '__attribute__((neon_vector_type(64))) unsigned long long' +// expected-error@-2{{unknown type name '__Uint64x2_t'}} + +__Float16x8_t Float16x8; +// CHECK: Float16x8 '__attribute__((neon_vector_type(16))) _Float16' +// expected-error@-2{{unknown type name '__Float16x8_t'}} + +__Float32x4_t Float32x4; +// CHECK: Float32x4 '__attribute__((neon_vector_type(32))) float' +// expected-error@-2{{unknown type name '__Float32x4_t'}} + +__Float64x2_t Float64x2; +// CHECK: Float64x2 '__attribute__((neon_vector_type(64))) double' +// expected-error@-2{{unknown type name '__Float64x2_t'}} + +__Poly8x16_t Poly8x16; +// CHECK: Poly8x16 '__attribute__((neon_polyvector_type(8))) char' +// expected-error@-2{{unknown type name '__Poly8x16_t'}} + +__Poly16x8_t Poly16x8; +// CHECK: Poly16x8 '__attribute__((neon_polyvector_type(16))) unsigned short' +// expected-error@-2{{unknown type name '__Poly16x8_t'}} + +__Poly64x2_t Poly64x2; +// CHECK: Poly64x2 '__attribute__((neon_polyvector_type(64))) unsigned long long' +// expected-error@-2{{unknown type name '__Poly64x2_t'}} + +__Bfloat16x8_t Bfloat16x8; +// CHECK: Bfloat16x8 '__attribute__((neon_vector_type(16))) __bf16' +// expected-error@-2{{unknown type name '__Bfloat16x8_t'}} + + +#ifndef A32 +__mfp8 mfp8; +// A64: mfp8 '__mfp8' +// expected-error@-2{{unknown type name '__mfp8'}} + +__Mfloat8x8_t Mfloat8x8; +// A64: Mfloat8x8 '__attribute__((neon_vector_type(8))) __mfp8' +// expected-error@-2{{unknown type name '__Mfloat8x8_t'}} + +__Mfloat8x16_t Mfloat8x16; +// A64: Mfloat8x16 '__attribute__((neon_vector_type(16))) __mfp8' +// expected-error@-2{{unknown type name '__Mfloat8x16_t'}} +#endif >From eb218032c3d1923e1352399caf872c56849a5ffc Mon Sep 17 00:00:00 2001 From: David Green <david.gr...@arm.com> Date: Mon, 19 May 2025 11:13:11 +0100 Subject: [PATCH 2/3] Updates and cleanup. --- .../include/clang/Basic/AArch64ACLETypes.def | 80 ++++++++++--------- clang/include/clang/Basic/LangOptions.def | 1 - clang/include/clang/Basic/Specifiers.h | 6 -- clang/include/clang/Basic/TargetInfo.h | 6 +- clang/include/clang/Basic/TokenKinds.def | 6 -- clang/include/clang/Sema/DeclSpec.h | 6 -- clang/lib/AST/ASTContext.cpp | 18 ++--- clang/lib/Basic/IdentifierTable.cpp | 5 +- clang/lib/Basic/LangOptions.cpp | 3 - clang/lib/Basic/TargetInfo.cpp | 2 +- clang/lib/Basic/Targets/AArch64.cpp | 6 +- clang/lib/Parse/ParseDecl.cpp | 13 --- clang/lib/Parse/ParseTentative.cpp | 8 -- clang/lib/Sema/DeclSpec.cpp | 9 --- clang/lib/Sema/Sema.cpp | 7 +- clang/lib/Sema/SemaTemplateVariadic.cpp | 4 - clang/lib/Sema/SemaType.cpp | 7 -- clang/test/AST/ast-dump-aarch64-neon-types.c | 63 +++++++-------- clang/test/CodeGen/AArch64/mixed-neon-types.c | 73 +++++++++++++++++ 19 files changed, 164 insertions(+), 159 deletions(-) create mode 100644 clang/test/CodeGen/AArch64/mixed-neon-types.c diff --git a/clang/include/clang/Basic/AArch64ACLETypes.def b/clang/include/clang/Basic/AArch64ACLETypes.def index e508b130569d4..9acfd693288cf 100644 --- a/clang/include/clang/Basic/AArch64ACLETypes.def +++ b/clang/include/clang/Basic/AArch64ACLETypes.def @@ -6,7 +6,13 @@ // //===----------------------------------------------------------------------===// // -// This file defines various SVE builtin types. The macros are: +// This file defines various Neon and SVE builtin types. The macros are: +// +// NEON_VECTOR_TYPE: +// - (Name, BaseType, ElBits, NumEls, VectorKind) +// Unlike the SVE types, the Neon vector types are not builtin types and +// mapped to the equivalent __attribute__(neon_vector_type(...)) vector type. +// They are not builtin types. // // SVE_TYPE: // - (Name, MangledName, Id, SingletonId) @@ -57,6 +63,10 @@ // - IsBF true for vector of brain float elements. //===----------------------------------------------------------------------===// +#ifndef NEON_VECTOR_TYPE +#define NEON_VECTOR_TYPE(Name, BaseType, ElBits, NumEls, VectorKind) +#endif + #ifndef SVE_TYPE #define SVE_TYPE(Name, Id, SingletonId) #endif @@ -111,7 +121,38 @@ SVE_TYPE(Name, Id, SingletonId) #endif -//===- Vector point types -----------------------------------------------===// +//===- Neon Vector point types --------------------------------------------===// + +NEON_VECTOR_TYPE(__Int8x8_t, CharTy, 8, 8, VectorKind::Neon) +NEON_VECTOR_TYPE(__Int16x4_t, ShortTy, 16, 4, VectorKind::Neon) +NEON_VECTOR_TYPE(__Int32x2_t, IntTy, 32, 2, VectorKind::Neon) +NEON_VECTOR_TYPE(__Uint8x8_t, CharTy, 8, 8, VectorKind::Neon) +NEON_VECTOR_TYPE(__Uint16x4_t, UnsignedShortTy, 16, 4, VectorKind::Neon) +NEON_VECTOR_TYPE(__Uint32x2_t, UnsignedIntTy, 32, 2, VectorKind::Neon) +NEON_VECTOR_TYPE(__Float16x4_t, Float16Ty, 16, 4, VectorKind::Neon) +NEON_VECTOR_TYPE(__Float32x2_t, FloatTy, 32, 2, VectorKind::Neon) +NEON_VECTOR_TYPE(__Poly8x8_t, CharTy, 8, 8, VectorKind::NeonPoly) +NEON_VECTOR_TYPE(__Poly16x4_t, UnsignedShortTy, 16, 4, VectorKind::NeonPoly) +NEON_VECTOR_TYPE(__Bfloat16x4_t, BFloat16Ty, 16, 4, VectorKind::Neon) +NEON_VECTOR_TYPE(__Int8x16_t, CharTy, 8, 16, VectorKind::Neon) +NEON_VECTOR_TYPE(__Int16x8_t, ShortTy, 16, 8, VectorKind::Neon) +NEON_VECTOR_TYPE(__Int32x4_t, IntTy, 32, 4, VectorKind::Neon) +NEON_VECTOR_TYPE(__Int64x2_t, LongLongTy, 64, 2, VectorKind::Neon) +NEON_VECTOR_TYPE(__Uint8x16_t, CharTy, 8, 16, VectorKind::Neon) +NEON_VECTOR_TYPE(__Uint16x8_t, UnsignedShortTy, 16, 8, VectorKind::Neon) +NEON_VECTOR_TYPE(__Uint32x4_t, UnsignedIntTy, 32, 4, VectorKind::Neon) +NEON_VECTOR_TYPE(__Uint64x2_t, UnsignedLongLongTy, 64, 2, VectorKind::Neon) +NEON_VECTOR_TYPE(__Float16x8_t, Float16Ty, 16, 8, VectorKind::Neon) +NEON_VECTOR_TYPE(__Float32x4_t, FloatTy, 32, 4, VectorKind::Neon) +NEON_VECTOR_TYPE(__Float64x2_t, DoubleTy, 64, 2, VectorKind::Neon) +NEON_VECTOR_TYPE(__Poly8x16_t, CharTy, 8, 16, VectorKind::NeonPoly) +NEON_VECTOR_TYPE(__Poly16x8_t, UnsignedShortTy, 16, 8, VectorKind::NeonPoly) +NEON_VECTOR_TYPE(__Poly64x2_t, UnsignedLongLongTy, 64, 2, VectorKind::NeonPoly) +NEON_VECTOR_TYPE(__Bfloat16x8_t, BFloat16Ty, 16, 8, VectorKind::Neon) +NEON_VECTOR_TYPE(__Mfloat8x8_t, MFloat8Ty, 8, 8, VectorKind::Neon) +NEON_VECTOR_TYPE(__Mfloat8x16_t, MFloat8Ty, 8, 16, VectorKind::Neon) + +//===- SVE Vector point types ---------------------------------------------===// SVE_VECTOR_TYPE_INT(__SVInt8_t, __SVInt8_t, SveInt8, SveInt8Ty, 16, 8, 1, true) SVE_VECTOR_TYPE_INT(__SVInt16_t, __SVInt16_t, SveInt16, SveInt16Ty, 8, 16, 1, true) @@ -205,41 +246,6 @@ SVE_OPAQUE_TYPE(__SVCount_t, __SVCount_t, SveCount, SveCountTy) SVE_SCALAR_TYPE(__mfp8, __mfp8, MFloat8, MFloat8Ty, 8) -// Unlike the SVE types above, the Neon vector types are parsed as keywords and -// mapped to the equivalent __attribute__(neon_vector_type(...)) vector type. -// They are not builtin types. -#ifndef NEON_VECTOR_TYPE -#define NEON_VECTOR_TYPE(Name, BaseType, ElBits, NumEls, VectorKind) -#endif -NEON_VECTOR_TYPE(__Int8x8_t, CharTy, 8, 8, VectorKind::Neon) -NEON_VECTOR_TYPE(__Int16x4_t, ShortTy, 16, 4, VectorKind::Neon) -NEON_VECTOR_TYPE(__Int32x2_t, IntTy, 32, 2, VectorKind::Neon) -NEON_VECTOR_TYPE(__Uint8x8_t, CharTy, 8, 8, VectorKind::Neon) -NEON_VECTOR_TYPE(__Uint16x4_t, UnsignedShortTy, 16, 4, VectorKind::Neon) -NEON_VECTOR_TYPE(__Uint32x2_t, UnsignedIntTy, 32, 2, VectorKind::Neon) -NEON_VECTOR_TYPE(__Float16x4_t, Float16Ty, 16, 4, VectorKind::Neon) -NEON_VECTOR_TYPE(__Float32x2_t, FloatTy, 32, 2, VectorKind::Neon) -NEON_VECTOR_TYPE(__Poly8x8_t, CharTy, 8, 8, VectorKind::NeonPoly) -NEON_VECTOR_TYPE(__Poly16x4_t, UnsignedShortTy, 16, 4, VectorKind::NeonPoly) -NEON_VECTOR_TYPE(__Bfloat16x4_t, BFloat16Ty, 16, 4, VectorKind::Neon) -NEON_VECTOR_TYPE(__Int8x16_t, CharTy, 8, 16, VectorKind::Neon) -NEON_VECTOR_TYPE(__Int16x8_t, ShortTy, 16, 8, VectorKind::Neon) -NEON_VECTOR_TYPE(__Int32x4_t, IntTy, 32, 4, VectorKind::Neon) -NEON_VECTOR_TYPE(__Int64x2_t, LongLongTy, 64, 2, VectorKind::Neon) -NEON_VECTOR_TYPE(__Uint8x16_t, CharTy, 8, 16, VectorKind::Neon) -NEON_VECTOR_TYPE(__Uint16x8_t, UnsignedShortTy, 16, 8, VectorKind::Neon) -NEON_VECTOR_TYPE(__Uint32x4_t, UnsignedIntTy, 32, 4, VectorKind::Neon) -NEON_VECTOR_TYPE(__Uint64x2_t, UnsignedLongLongTy, 64, 2, VectorKind::Neon) -NEON_VECTOR_TYPE(__Float16x8_t, Float16Ty, 16, 8, VectorKind::Neon) -NEON_VECTOR_TYPE(__Float32x4_t, FloatTy, 32, 4, VectorKind::Neon) -NEON_VECTOR_TYPE(__Float64x2_t, DoubleTy, 64, 2, VectorKind::Neon) -NEON_VECTOR_TYPE(__Poly8x16_t, CharTy, 8, 16, VectorKind::NeonPoly) -NEON_VECTOR_TYPE(__Poly16x8_t, UnsignedShortTy, 16, 8, VectorKind::NeonPoly) -NEON_VECTOR_TYPE(__Poly64x2_t, UnsignedLongLongTy, 64, 2, VectorKind::NeonPoly) -NEON_VECTOR_TYPE(__Bfloat16x8_t, BFloat16Ty, 16, 8, VectorKind::Neon) -NEON_VECTOR_TYPE(__Mfloat8x8_t, MFloat8Ty, 8, 8, VectorKind::Neon) -NEON_VECTOR_TYPE(__Mfloat8x16_t, MFloat8Ty, 16, 8, VectorKind::Neon) - #undef NEON_VECTOR_TYPE #undef SVE_VECTOR_TYPE #undef SVE_VECTOR_TYPE_MFLOAT diff --git a/clang/include/clang/Basic/LangOptions.def b/clang/include/clang/Basic/LangOptions.def index cd2af3e13499d..789761c1f3647 100644 --- a/clang/include/clang/Basic/LangOptions.def +++ b/clang/include/clang/Basic/LangOptions.def @@ -463,7 +463,6 @@ COMPATIBLE_VALUE_LANGOPT(FunctionAlignment, 5, 0, "Default alignment for functio COMPATIBLE_VALUE_LANGOPT(LoopAlignment, 32, 0, "Default alignment for loops") LANGOPT(FixedPoint, 1, 0, "fixed point types") -LANGOPT(ACLE, 1, 0, "Arm C Language Extensions") LANGOPT(PaddingOnUnsignedFixedPoint, 1, 0, "unsigned fixed point types having one extra padding bit") diff --git a/clang/include/clang/Basic/Specifiers.h b/clang/include/clang/Basic/Specifiers.h index 37684d1136ec6..491badcc804e7 100644 --- a/clang/include/clang/Basic/Specifiers.h +++ b/clang/include/clang/Basic/Specifiers.h @@ -98,12 +98,6 @@ namespace clang { #define GENERIC_IMAGE_TYPE(ImgType, Id) \ TST_##ImgType##_t, // OpenCL image types #include "clang/Basic/OpenCLImageTypes.def" - -#define NEON_VECTOR_TYPE(Name, BaseType, ElBits, NumEls, VectorKind) \ - TST_##Name, -#define SVE_TYPE(Name, Id, SingletonId) -#include "clang/Basic/AArch64SVEACLETypes.def" - #define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) \ TST_##Name, // HLSL Intangible Types #include "clang/Basic/HLSLIntangibleTypes.def" diff --git a/clang/include/clang/Basic/TargetInfo.h b/clang/include/clang/Basic/TargetInfo.h index 652dc064a7b1c..c3bce6e807f34 100644 --- a/clang/include/clang/Basic/TargetInfo.h +++ b/clang/include/clang/Basic/TargetInfo.h @@ -270,7 +270,7 @@ class TargetInfo : public TransferrableTargetInfo, unsigned HasBuiltinMSVaList : 1; LLVM_PREFERRED_TYPE(bool) - unsigned HasAArch64SVETypes : 1; + unsigned HasAArch64ACLETypes : 1; LLVM_PREFERRED_TYPE(bool) unsigned HasRISCVVTypes : 1; @@ -1055,9 +1055,9 @@ class TargetInfo : public TransferrableTargetInfo, /// available on this target. bool hasBuiltinMSVaList() const { return HasBuiltinMSVaList; } - /// Returns whether or not the AArch64 SVE built-in types are + /// Returns whether or not the AArch64 ACLE built-in types are /// available on this target. - bool hasAArch64SVETypes() const { return HasAArch64SVETypes; } + bool hasAArch64ACLETypes() const { return HasAArch64ACLETypes; } /// Returns whether or not the RISC-V V built-in types are /// available on this target. diff --git a/clang/include/clang/Basic/TokenKinds.def b/clang/include/clang/Basic/TokenKinds.def index 70e1fe5c75649..94e72fea56a68 100644 --- a/clang/include/clang/Basic/TokenKinds.def +++ b/clang/include/clang/Basic/TokenKinds.def @@ -687,12 +687,6 @@ KEYWORD(__bool , KEYALTIVEC|KEYZVECTOR) ALIAS("__fp16", half , KEYALL) KEYWORD(__bf16 , KEYALL) -// ARM NEON types -#define NEON_VECTOR_TYPE(Name, BaseType, ElBits, NumEls, VectorKind) \ - KEYWORD(Name, KEYACLE) -#define SVE_TYPE(Name, Id, SingletonId) -#include "clang/Basic/AArch64SVEACLETypes.def" - // OpenCL Extension. KEYWORD(half , HALFSUPPORT) diff --git a/clang/include/clang/Sema/DeclSpec.h b/clang/include/clang/Sema/DeclSpec.h index db794dc677136..6c4a32c4ac2f0 100644 --- a/clang/include/clang/Sema/DeclSpec.h +++ b/clang/include/clang/Sema/DeclSpec.h @@ -321,12 +321,6 @@ class DeclSpec { #define GENERIC_IMAGE_TYPE(ImgType, Id) \ static const TST TST_##ImgType##_t = clang::TST_##ImgType##_t; #include "clang/Basic/OpenCLImageTypes.def" - -#define NEON_VECTOR_TYPE(Name, BaseType, ElBits, NumEls, VectorKind) \ - static const TST TST_##Name = clang::TST_##Name; -#define SVE_TYPE(Name, Id, SingletonId) -#include "clang/Basic/AArch64SVEACLETypes.def" - #define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) \ static const TST TST_##Name = clang::TST_##Name; #include "clang/Basic/HLSLIntangibleTypes.def" diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index d808d6adc9f98..e73975975167a 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -1448,21 +1448,13 @@ void ASTContext::InitBuiltinTypes(const TargetInfo &Target, #include "clang/Basic/HLSLIntangibleTypes.def" } - if (Target.hasAArch64SVETypes() || - (AuxTarget && AuxTarget->hasAArch64SVETypes())) { -#define SVE_VECTOR_TYPE(Name, MangledName, Id, SingletonId) \ - InitBuiltinType(SingletonId, BuiltinType::Id); -#define SVE_PREDICATE_TYPE(Name, MangledName, Id, SingletonId) \ - InitBuiltinType(SingletonId, BuiltinType::Id); -#define SVE_OPAQUE_TYPE(Name, MangledName, Id, SingletonId) \ + if (Target.hasAArch64ACLETypes() || + (AuxTarget && AuxTarget->hasAArch64ACLETypes())) { +#define SVE_TYPE(Name, Id, SingletonId) \ InitBuiltinType(SingletonId, BuiltinType::Id); -#define SVE_TYPE(Name, MangledName, SingletonId) -#include "clang/Basic/AArch64SVEACLETypes.def" +#include "clang/Basic/AArch64ACLETypes.def" } - if (LangOpts.ACLE) - InitBuiltinType(MFloat8Ty, BuiltinType::MFloat8); - if (Target.getTriple().isPPC64()) { #define PPC_VECTOR_MMA_TYPE(Name, Id, Size) \ InitBuiltinType(Id##Ty, BuiltinType::Id); @@ -4538,7 +4530,7 @@ QualType ASTContext::getWebAssemblyExternrefType() const { /// type. QualType ASTContext::getScalableVectorType(QualType EltTy, unsigned NumElts, unsigned NumFields) const { - if (Target->hasAArch64SVETypes()) { + if (Target->hasAArch64ACLETypes()) { uint64_t EltTySize = getTypeSize(EltTy); #define SVE_VECTOR_TYPE_INT(Name, MangledName, Id, SingletonId, NumEls, \ diff --git a/clang/lib/Basic/IdentifierTable.cpp b/clang/lib/Basic/IdentifierTable.cpp index bc22e355f72cb..099f2e8a18da5 100644 --- a/clang/lib/Basic/IdentifierTable.cpp +++ b/clang/lib/Basic/IdentifierTable.cpp @@ -111,8 +111,7 @@ enum TokenKey : unsigned { KEYNOZOS = 0x4000000, KEYHLSL = 0x8000000, KEYFIXEDPOINT = 0x10000000, - KEYACLE = 0x20000000, // Enable Arm Neon vector type keywords - KEYMAX = KEYACLE, // The maximum key + KEYMAX = KEYFIXEDPOINT, // The maximum key KEYALLCXX = KEYCXX | KEYCXX11 | KEYCXX20, KEYALL = (KEYMAX | (KEYMAX - 1)) & ~KEYNOMS18 & ~KEYNOOPENCL & ~KEYNOZOS // KEYNOMS18, KEYNOOPENCL, KEYNOZOS are excluded. @@ -217,8 +216,6 @@ static KeywordStatus getKeywordStatusHelper(const LangOptions &LangOpts, return KS_Unknown; case KEYFIXEDPOINT: return LangOpts.FixedPoint ? KS_Enabled : KS_Disabled; - case KEYACLE: - return LangOpts.ACLE ? KS_Enabled : KS_Disabled; default: llvm_unreachable("Unknown KeywordStatus flag"); } diff --git a/clang/lib/Basic/LangOptions.cpp b/clang/lib/Basic/LangOptions.cpp index 68e2b473f5dfc..7e696620993f9 100644 --- a/clang/lib/Basic/LangOptions.cpp +++ b/clang/lib/Basic/LangOptions.cpp @@ -203,9 +203,6 @@ void LangOptions::setLangDefaults(LangOptions &Opts, Language Lang, Opts.setDefaultFPContractMode(LangOptions::FPM_Fast); } - if (T.isARM() || T.isAArch64()) - Opts.ACLE = true; - // OpenCL, C++ and C23 have bool, true, false keywords. Opts.Bool = Opts.OpenCL || Opts.CPlusPlus || Opts.C23; diff --git a/clang/lib/Basic/TargetInfo.cpp b/clang/lib/Basic/TargetInfo.cpp index ab13c32f6943e..a82573b5b43f9 100644 --- a/clang/lib/Basic/TargetInfo.cpp +++ b/clang/lib/Basic/TargetInfo.cpp @@ -157,7 +157,7 @@ TargetInfo::TargetInfo(const llvm::Triple &T) : Triple(T) { SSERegParmMax = 0; HasAlignMac68kSupport = false; HasBuiltinMSVaList = false; - HasAArch64SVETypes = false; + HasAArch64ACLETypes = false; HasRISCVVTypes = false; AllowAMDGPUUnsafeFPAtomics = false; HasUnalignedAccess = false; diff --git a/clang/lib/Basic/Targets/AArch64.cpp b/clang/lib/Basic/Targets/AArch64.cpp index 1195c9293f3ea..a29c7240cf4d3 100644 --- a/clang/lib/Basic/Targets/AArch64.cpp +++ b/clang/lib/Basic/Targets/AArch64.cpp @@ -240,15 +240,15 @@ AArch64TargetInfo::AArch64TargetInfo(const llvm::Triple &Triple, // Make __builtin_ms_va_list available. HasBuiltinMSVaList = true; - // Make the SVE types available. Note that this deliberately doesn't - // depend on SveMode, since in principle it should be possible to turn + // Make the Neon ACLE and SVE types available. Note that this deliberately + // doesn't depend on SveMode, since in principle it should be possible to turn // SVE on and off within a translation unit. It should also be possible // to compile the global declaration: // // __SVInt8_t *ptr; // // even without SVE. - HasAArch64SVETypes = true; + HasAArch64ACLETypes = true; // {} in inline assembly are neon specifiers, not assembly variant // specifiers. diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 7efd506c56603..f7eb56426f6de 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -4442,15 +4442,6 @@ void Parser::ParseDeclarationSpecifiers( goto DoneWithDeclSpec; \ break; #include "clang/Basic/OpenCLImageTypes.def" - -#define NEON_VECTOR_TYPE(Name, BaseType, ElBits, NumEls, VectorKind) \ - case tok::kw_##Name: \ - isInvalid = DS.SetTypeSpecType(DeclSpec::TST_##Name, Loc, PrevSpec, \ - DiagID, Policy); \ - break; -#define SVE_TYPE(Name, Id, SingletonId) -#include "clang/Basic/AArch64SVEACLETypes.def" - case tok::kw___unknown_anytype: isInvalid = DS.SetTypeSpecType(TST_unknown_anytype, Loc, PrevSpec, DiagID, Policy); @@ -5964,10 +5955,6 @@ bool Parser::isDeclarationSpecifier( case tok::kw___read_only: case tok::kw___read_write: case tok::kw___write_only: -#define NEON_VECTOR_TYPE(Name, BaseType, ElBits, NumEls, VectorKind) \ - case tok::kw_##Name: -#define SVE_TYPE(Name, Id, SingletonId) -#include "clang/Basic/AArch64SVEACLETypes.def" #define GENERIC_IMAGE_TYPE(ImgType, Id) case tok::kw_##ImgType##_t: #include "clang/Basic/OpenCLImageTypes.def" #define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) case tok::kw_##Name: diff --git a/clang/lib/Parse/ParseTentative.cpp b/clang/lib/Parse/ParseTentative.cpp index cda04a7073991..95cee824c40b7 100644 --- a/clang/lib/Parse/ParseTentative.cpp +++ b/clang/lib/Parse/ParseTentative.cpp @@ -1472,10 +1472,6 @@ Parser::isCXXDeclarationSpecifier(ImplicitTypenameContext AllowImplicitTypename, case tok::kw__Fract: case tok::kw__Sat: case tok::annot_pack_indexing_type: -#define NEON_VECTOR_TYPE(Name, BaseType, ElBits, NumEls, VectorKind) \ - case tok::kw_##Name: -#define SVE_TYPE(Name, Id, SingletonId) -#include "clang/Basic/AArch64SVEACLETypes.def" #define GENERIC_IMAGE_TYPE(ImgType, Id) case tok::kw_##ImgType##_t: #include "clang/Basic/OpenCLImageTypes.def" #define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) case tok::kw_##Name: @@ -1604,10 +1600,6 @@ bool Parser::isCXXDeclarationSpecifierAType() { case tok::kw__Accum: case tok::kw__Fract: case tok::kw__Sat: -#define NEON_VECTOR_TYPE(Name, BaseType, ElBits, NumEls, VectorKind) \ - case tok::kw_##Name: -#define SVE_TYPE(Name, Id, SingletonId) -#include "clang/Basic/AArch64SVEACLETypes.def" #define GENERIC_IMAGE_TYPE(ImgType, Id) case tok::kw_##ImgType##_t: #include "clang/Basic/OpenCLImageTypes.def" #define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) case tok::kw_##Name: diff --git a/clang/lib/Sema/DeclSpec.cpp b/clang/lib/Sema/DeclSpec.cpp index 0faf012dcb192..ee5a862c32509 100644 --- a/clang/lib/Sema/DeclSpec.cpp +++ b/clang/lib/Sema/DeclSpec.cpp @@ -374,10 +374,6 @@ bool Declarator::isDeclarationOfFunction() const { case TST_typename_pack_indexing: #define GENERIC_IMAGE_TYPE(ImgType, Id) case TST_##ImgType##_t: #include "clang/Basic/OpenCLImageTypes.def" -#define NEON_VECTOR_TYPE(Name, BaseType, ElBits, NumEls, VectorKind) \ - case TST_##Name: -#define SVE_TYPE(Name, Id, SingletonId) -#include "clang/Basic/AArch64SVEACLETypes.def" #define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) case TST_##Name: #include "clang/Basic/HLSLIntangibleTypes.def" return false; @@ -611,11 +607,6 @@ const char *DeclSpec::getSpecifierName(DeclSpec::TST T, case DeclSpec::TST_##ImgType##_t: \ return #ImgType "_t"; #include "clang/Basic/OpenCLImageTypes.def" -#define NEON_VECTOR_TYPE(Name, BaseType, ElBits, NumEls, VectorKind) \ - case DeclSpec::TST_##Name: \ - return #Name; -#define SVE_TYPE(Name, Id, SingletonId) -#include "clang/Basic/AArch64SVEACLETypes.def" #define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) \ case DeclSpec::TST_##Name: \ return #Name; diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp index f8bfd60f2faad..fc63be037236e 100644 --- a/clang/lib/Sema/Sema.cpp +++ b/clang/lib/Sema/Sema.cpp @@ -515,11 +515,14 @@ void Sema::Initialize() { #include "clang/Basic/OpenCLExtensionTypes.def" } - if (Context.getTargetInfo().hasAArch64SVETypes() || + if (Context.getTargetInfo().hasAArch64ACLETypes() || (Context.getAuxTargetInfo() && - Context.getAuxTargetInfo()->hasAArch64SVETypes())) { + Context.getAuxTargetInfo()->hasAArch64ACLETypes())) { #define SVE_TYPE(Name, Id, SingletonId) \ addImplicitTypedef(#Name, Context.SingletonId); +#define NEON_VECTOR_TYPE(Name, BaseType, ElBits, NumEls, VectorKind) \ + addImplicitTypedef( \ + #Name, Context.getVectorType(Context.BaseType, NumEls, VectorKind)); #include "clang/Basic/AArch64ACLETypes.def" } diff --git a/clang/lib/Sema/SemaTemplateVariadic.cpp b/clang/lib/Sema/SemaTemplateVariadic.cpp index b24ce78f4e5e5..5f0e968ff18c4 100644 --- a/clang/lib/Sema/SemaTemplateVariadic.cpp +++ b/clang/lib/Sema/SemaTemplateVariadic.cpp @@ -1056,10 +1056,6 @@ bool Sema::containsUnexpandedParameterPacks(Declarator &D) { case TST_BFloat16: #define GENERIC_IMAGE_TYPE(ImgType, Id) case TST_##ImgType##_t: #include "clang/Basic/OpenCLImageTypes.def" -#define NEON_VECTOR_TYPE(Name, BaseType, ElBits, NumEls, VectorKind) \ - case TST_##Name: -#define SVE_TYPE(Name, Id, SingletonId) -#include "clang/Basic/AArch64SVEACLETypes.def" #define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) case TST_##Name: #include "clang/Basic/HLSLIntangibleTypes.def" case TST_unknown_anytype: diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index 2839fdc6d20ac..338b81fe89748 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -1365,13 +1365,6 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) { break; #include "clang/Basic/OpenCLImageTypes.def" -#define NEON_VECTOR_TYPE(Name, BaseType, ElBits, NumEls, VectorKind) \ - case DeclSpec::TST_##Name: \ - Result = Context.getVectorType(Context.BaseType, NumEls, VectorKind); \ - break; -#define SVE_TYPE(Name, Id, SingletonId) -#include "clang/Basic/AArch64SVEACLETypes.def" - #define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) \ case DeclSpec::TST_##Name: \ Result = Context.SingletonId; \ diff --git a/clang/test/AST/ast-dump-aarch64-neon-types.c b/clang/test/AST/ast-dump-aarch64-neon-types.c index 4875edd80fde0..5300b93241d52 100644 --- a/clang/test/AST/ast-dump-aarch64-neon-types.c +++ b/clang/test/AST/ast-dump-aarch64-neon-types.c @@ -1,128 +1,125 @@ // Test that NEON types are defined, even when arm_neon.h is not included. // as required by AAPCS64 "Support for Advanced SIMD Extensions". -// RUN: %clang_cc1 -ast-dump -triple arm-linux-gnu -D A32 %s -x c | FileCheck --check-prefixes=CHECK %s -// RUN: %clang_cc1 -ast-dump -triple arm-linux-gnu -D A32 %s -x c++ | FileCheck --check-prefixes=CHECK %s // RUN: %clang_cc1 -ast-dump -triple aarch64-linux-gnu %s -x c | FileCheck --check-prefixes=CHECK,A64 %s // RUN: %clang_cc1 -ast-dump -triple aarch64-linux-gnu %s -x c++ | FileCheck --check-prefixes=CHECK,A64 %s // RUN: %clang_cc1 -verify -verify-ignore-unexpected=note -triple x86_64 %s -x c // RUN: %clang_cc1 -verify -verify-ignore-unexpected=note -triple x86_64 %s -x c++ +// RUN: %clang_cc1 -verify -verify-ignore-unexpected=note -triple arm-linux-gnu %s -x c +// RUN: %clang_cc1 -verify -verify-ignore-unexpected=note -triple arm-linux-gnu %s -x c++ __Int8x8_t Int8x8; -// CHECK: Int8x8 '__attribute__((neon_vector_type(8))) char' +// CHECK: Int8x8 '__Int8x8_t':'__attribute__((neon_vector_type(8))) char' // expected-error@-2{{unknown type name '__Int8x8_t'}} __Int16x4_t Int16x4; -// CHECK: Int16x4 '__attribute__((neon_vector_type(16))) short' +// CHECK: Int16x4 '__Int16x4_t':'__attribute__((neon_vector_type(4))) short' // expected-error@-2{{unknown type name '__Int16x4_t'}} __Int32x2_t Int32x2; -// CHECK: Int32x2 '__attribute__((neon_vector_type(32))) int' +// CHECK: Int32x2 '__Int32x2_t':'__attribute__((neon_vector_type(2))) int' // expected-error@-2{{unknown type name '__Int32x2_t'}} __Uint8x8_t Uint8x8; -// CHECK: Uint8x8 '__attribute__((neon_vector_type(8))) char' +// CHECK: Uint8x8 '__Uint8x8_t':'__attribute__((neon_vector_type(8))) char' // expected-error@-2{{unknown type name '__Uint8x8_t'}} __Uint16x4_t Uint16x4; -// CHECK: Uint16x4 '__attribute__((neon_vector_type(16))) unsigned short' +// CHECK: Uint16x4 '__Uint16x4_t':'__attribute__((neon_vector_type(4))) unsigned short' // expected-error@-2{{unknown type name '__Uint16x4_t'}} __Uint32x2_t Uint32x2; -// CHECK: Uint32x2 '__attribute__((neon_vector_type(32))) unsigned int' +// CHECK: Uint32x2 '__Uint32x2_t':'__attribute__((neon_vector_type(2))) unsigned int' // expected-error@-2{{unknown type name '__Uint32x2_t'}} __Float16x4_t Float16x4; -// CHECK: Float16x4 '__attribute__((neon_vector_type(16))) _Float16' +// CHECK: Float16x4 '__Float16x4_t':'__attribute__((neon_vector_type(4))) _Float16' // expected-error@-2{{unknown type name '__Float16x4_t'}} __Float32x2_t Float32x2; -// CHECK: Float32x2 '__attribute__((neon_vector_type(32))) float' +// CHECK: Float32x2 '__Float32x2_t':'__attribute__((neon_vector_type(2))) float' // expected-error@-2{{unknown type name '__Float32x2_t'}} __Poly8x8_t Poly8x8; -// CHECK: Poly8x8 '__attribute__((neon_polyvector_type(8))) char' +// CHECK: Poly8x8 '__Poly8x8_t':'__attribute__((neon_polyvector_type(8))) char' // expected-error@-2{{unknown type name '__Poly8x8_t'}} __Poly16x4_t Poly16x4; -// CHECK: Poly16x4 '__attribute__((neon_polyvector_type(16))) unsigned short' +// CHECK: Poly16x4 '__Poly16x4_t':'__attribute__((neon_polyvector_type(4))) unsigned short' // expected-error@-2{{unknown type name '__Poly16x4_t'}} __Bfloat16x4_t Bfloat16x4; -// CHECK: Bfloat16x4 '__attribute__((neon_vector_type(16))) __bf16' +// CHECK: Bfloat16x4 '__Bfloat16x4_t':'__attribute__((neon_vector_type(4))) __bf16' // expected-error@-2{{unknown type name '__Bfloat16x4_t'}} __Int8x16_t Int8x16; -// CHECK: Int8x16 '__attribute__((neon_vector_type(8))) char' +// CHECK: Int8x16 '__Int8x16_t':'__attribute__((neon_vector_type(16))) char' // expected-error@-2{{unknown type name '__Int8x16_t'}} __Int16x8_t Int16x8; -// CHECK: Int16x8 '__attribute__((neon_vector_type(16))) short' +// CHECK: Int16x8 '__Int16x8_t':'__attribute__((neon_vector_type(8))) short' // expected-error@-2{{unknown type name '__Int16x8_t'}} __Int32x4_t Int32x4; -// CHECK: Int32x4 '__attribute__((neon_vector_type(32))) int' +// CHECK: Int32x4 '__Int32x4_t':'__attribute__((neon_vector_type(4))) int' // expected-error@-2{{unknown type name '__Int32x4_t'}} __Int64x2_t Int64x2; -// CHECK: Int64x2 '__attribute__((neon_vector_type(64))) long long' +// CHECK: Int64x2 '__Int64x2_t':'__attribute__((neon_vector_type(2))) long long' // expected-error@-2{{unknown type name '__Int64x2_t'}} __Uint8x16_t Uint8x16; -// CHECK: Uint8x16 '__attribute__((neon_vector_type(8))) char' +// CHECK: Uint8x16 '__Uint8x16_t':'__attribute__((neon_vector_type(16))) char' // expected-error@-2{{unknown type name '__Uint8x16_t'}} __Uint16x8_t Uint16x8; -// CHECK: Uint16x8 '__attribute__((neon_vector_type(16))) unsigned short' +// CHECK: Uint16x8 '__Uint16x8_t':'__attribute__((neon_vector_type(8))) unsigned short' // expected-error@-2{{unknown type name '__Uint16x8_t'}} __Uint32x4_t Uint32x4; -// CHECK: Uint32x4 '__attribute__((neon_vector_type(32))) unsigned int' +// CHECK: Uint32x4 '__Uint32x4_t':'__attribute__((neon_vector_type(4))) unsigned int' // expected-error@-2{{unknown type name '__Uint32x4_t'}} __Uint64x2_t Uint64x2; -// CHECK: Uint64x2 '__attribute__((neon_vector_type(64))) unsigned long long' +// CHECK: Uint64x2 '__Uint64x2_t':'__attribute__((neon_vector_type(2))) unsigned long long' // expected-error@-2{{unknown type name '__Uint64x2_t'}} __Float16x8_t Float16x8; -// CHECK: Float16x8 '__attribute__((neon_vector_type(16))) _Float16' +// CHECK: Float16x8 '__Float16x8_t':'__attribute__((neon_vector_type(8))) _Float16' // expected-error@-2{{unknown type name '__Float16x8_t'}} __Float32x4_t Float32x4; -// CHECK: Float32x4 '__attribute__((neon_vector_type(32))) float' +// CHECK: Float32x4 '__Float32x4_t':'__attribute__((neon_vector_type(4))) float' // expected-error@-2{{unknown type name '__Float32x4_t'}} __Float64x2_t Float64x2; -// CHECK: Float64x2 '__attribute__((neon_vector_type(64))) double' +// CHECK: Float64x2 '__Float64x2_t':'__attribute__((neon_vector_type(2))) double' // expected-error@-2{{unknown type name '__Float64x2_t'}} __Poly8x16_t Poly8x16; -// CHECK: Poly8x16 '__attribute__((neon_polyvector_type(8))) char' +// CHECK: Poly8x16 '__Poly8x16_t':'__attribute__((neon_polyvector_type(16))) char' // expected-error@-2{{unknown type name '__Poly8x16_t'}} __Poly16x8_t Poly16x8; -// CHECK: Poly16x8 '__attribute__((neon_polyvector_type(16))) unsigned short' +// CHECK: Poly16x8 '__Poly16x8_t':'__attribute__((neon_polyvector_type(8))) unsigned short' // expected-error@-2{{unknown type name '__Poly16x8_t'}} __Poly64x2_t Poly64x2; -// CHECK: Poly64x2 '__attribute__((neon_polyvector_type(64))) unsigned long long' +// CHECK: Poly64x2 '__Poly64x2_t':'__attribute__((neon_polyvector_type(2))) unsigned long long' // expected-error@-2{{unknown type name '__Poly64x2_t'}} __Bfloat16x8_t Bfloat16x8; -// CHECK: Bfloat16x8 '__attribute__((neon_vector_type(16))) __bf16' +// CHECK: Bfloat16x8 '__Bfloat16x8_t':'__attribute__((neon_vector_type(8))) __bf16' // expected-error@-2{{unknown type name '__Bfloat16x8_t'}} - -#ifndef A32 __mfp8 mfp8; // A64: mfp8 '__mfp8' // expected-error@-2{{unknown type name '__mfp8'}} __Mfloat8x8_t Mfloat8x8; -// A64: Mfloat8x8 '__attribute__((neon_vector_type(8))) __mfp8' +// A64: Mfloat8x8 '__Mfloat8x8_t':'__attribute__((neon_vector_type(8))) __mfp8' // expected-error@-2{{unknown type name '__Mfloat8x8_t'}} __Mfloat8x16_t Mfloat8x16; -// A64: Mfloat8x16 '__attribute__((neon_vector_type(16))) __mfp8' +// A64: Mfloat8x16 '__Mfloat8x16_t':'__attribute__((neon_vector_type(16))) __mfp8' // expected-error@-2{{unknown type name '__Mfloat8x16_t'}} -#endif diff --git a/clang/test/CodeGen/AArch64/mixed-neon-types.c b/clang/test/CodeGen/AArch64/mixed-neon-types.c new file mode 100644 index 0000000000000..52c30eb4fa657 --- /dev/null +++ b/clang/test/CodeGen/AArch64/mixed-neon-types.c @@ -0,0 +1,73 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 +// RUN: %clang_cc1 -triple aarch64-linux-gnu -target-feature +neon -x c %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-C +// RUN: %clang_cc1 -triple aarch64-linux-gnu -target-feature +neon -x c++ %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-CPP + +typedef __Uint32x4_t X; + +// CHECK-C-LABEL: define dso_local <4 x i32> @test( +// CHECK-C-SAME: <4 x i32> noundef [[X:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-C-NEXT: [[ENTRY:.*:]] +// CHECK-C-NEXT: [[X_ADDR:%.*]] = alloca <4 x i32>, align 16 +// CHECK-C-NEXT: store <4 x i32> [[X]], ptr [[X_ADDR]], align 16 +// CHECK-C-NEXT: [[TMP0:%.*]] = load <4 x i32>, ptr [[X_ADDR]], align 16 +// CHECK-C-NEXT: ret <4 x i32> [[TMP0]] +// +// CHECK-CPP-LABEL: define dso_local noundef <4 x i32> @_Z4test12__Uint32x4_t( +// CHECK-CPP-SAME: <4 x i32> noundef [[X:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-CPP-NEXT: [[ENTRY:.*:]] +// CHECK-CPP-NEXT: [[X_ADDR:%.*]] = alloca <4 x i32>, align 16 +// CHECK-CPP-NEXT: store <4 x i32> [[X]], ptr [[X_ADDR]], align 16 +// CHECK-CPP-NEXT: [[TMP0:%.*]] = load <4 x i32>, ptr [[X_ADDR]], align 16 +// CHECK-CPP-NEXT: ret <4 x i32> [[TMP0]] +// +X test(X x) { + return x; +} + +#include <arm_neon.h> + +// CHECK-C-LABEL: define dso_local <16 x i8> @testboth( +// CHECK-C-SAME: <4 x i32> noundef [[X:%.*]]) #[[ATTR0]] { +// CHECK-C-NEXT: [[ENTRY:.*:]] +// CHECK-C-NEXT: [[__P0_ADDR_I:%.*]] = alloca <16 x i8>, align 16 +// CHECK-C-NEXT: [[__P1_ADDR_I:%.*]] = alloca <16 x i8>, align 16 +// CHECK-C-NEXT: [[__RET_I:%.*]] = alloca <16 x i8>, align 16 +// CHECK-C-NEXT: [[X_ADDR:%.*]] = alloca <4 x i32>, align 16 +// CHECK-C-NEXT: store <4 x i32> [[X]], ptr [[X_ADDR]], align 16 +// CHECK-C-NEXT: [[TMP0:%.*]] = load <4 x i32>, ptr [[X_ADDR]], align 16 +// CHECK-C-NEXT: [[TMP1:%.*]] = bitcast <4 x i32> [[TMP0]] to <16 x i8> +// CHECK-C-NEXT: [[TMP2:%.*]] = load <4 x i32>, ptr [[X_ADDR]], align 16 +// CHECK-C-NEXT: [[TMP3:%.*]] = bitcast <4 x i32> [[TMP2]] to <16 x i8> +// CHECK-C-NEXT: store <16 x i8> [[TMP1]], ptr [[__P0_ADDR_I]], align 16 +// CHECK-C-NEXT: store <16 x i8> [[TMP3]], ptr [[__P1_ADDR_I]], align 16 +// CHECK-C-NEXT: [[TMP4:%.*]] = load <16 x i8>, ptr [[__P0_ADDR_I]], align 16 +// CHECK-C-NEXT: [[TMP5:%.*]] = load <16 x i8>, ptr [[__P1_ADDR_I]], align 16 +// CHECK-C-NEXT: [[ADD_I:%.*]] = add <16 x i8> [[TMP4]], [[TMP5]] +// CHECK-C-NEXT: store <16 x i8> [[ADD_I]], ptr [[__RET_I]], align 16 +// CHECK-C-NEXT: [[TMP6:%.*]] = load <16 x i8>, ptr [[__RET_I]], align 16 +// CHECK-C-NEXT: ret <16 x i8> [[TMP6]] +// +// CHECK-CPP-LABEL: define dso_local noundef <16 x i8> @_Z8testboth12__Uint32x4_t( +// CHECK-CPP-SAME: <4 x i32> noundef [[X:%.*]]) #[[ATTR0]] { +// CHECK-CPP-NEXT: [[ENTRY:.*:]] +// CHECK-CPP-NEXT: [[__P0_ADDR_I:%.*]] = alloca <16 x i8>, align 16 +// CHECK-CPP-NEXT: [[__P1_ADDR_I:%.*]] = alloca <16 x i8>, align 16 +// CHECK-CPP-NEXT: [[__RET_I:%.*]] = alloca <16 x i8>, align 16 +// CHECK-CPP-NEXT: [[X_ADDR:%.*]] = alloca <4 x i32>, align 16 +// CHECK-CPP-NEXT: store <4 x i32> [[X]], ptr [[X_ADDR]], align 16 +// CHECK-CPP-NEXT: [[TMP0:%.*]] = load <4 x i32>, ptr [[X_ADDR]], align 16 +// CHECK-CPP-NEXT: [[TMP1:%.*]] = bitcast <4 x i32> [[TMP0]] to <16 x i8> +// CHECK-CPP-NEXT: [[TMP2:%.*]] = load <4 x i32>, ptr [[X_ADDR]], align 16 +// CHECK-CPP-NEXT: [[TMP3:%.*]] = bitcast <4 x i32> [[TMP2]] to <16 x i8> +// CHECK-CPP-NEXT: store <16 x i8> [[TMP1]], ptr [[__P0_ADDR_I]], align 16 +// CHECK-CPP-NEXT: store <16 x i8> [[TMP3]], ptr [[__P1_ADDR_I]], align 16 +// CHECK-CPP-NEXT: [[TMP4:%.*]] = load <16 x i8>, ptr [[__P0_ADDR_I]], align 16 +// CHECK-CPP-NEXT: [[TMP5:%.*]] = load <16 x i8>, ptr [[__P1_ADDR_I]], align 16 +// CHECK-CPP-NEXT: [[ADD_I:%.*]] = add <16 x i8> [[TMP4]], [[TMP5]] +// CHECK-CPP-NEXT: store <16 x i8> [[ADD_I]], ptr [[__RET_I]], align 16 +// CHECK-CPP-NEXT: [[TMP6:%.*]] = load <16 x i8>, ptr [[__RET_I]], align 16 +// CHECK-CPP-NEXT: ret <16 x i8> [[TMP6]] +// +int8x16_t testboth(X x) { + return vaddq_u8(x, x); +} >From 452384edb87653ef32a8a8e63502f28f316f5c8e Mon Sep 17 00:00:00 2001 From: David Green <david.gr...@arm.com> Date: Wed, 28 May 2025 11:01:48 +0100 Subject: [PATCH 3/3] Remove A64 check prefix --- clang/test/AST/ast-dump-aarch64-neon-types.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/clang/test/AST/ast-dump-aarch64-neon-types.c b/clang/test/AST/ast-dump-aarch64-neon-types.c index 5300b93241d52..16255cd51c9d8 100644 --- a/clang/test/AST/ast-dump-aarch64-neon-types.c +++ b/clang/test/AST/ast-dump-aarch64-neon-types.c @@ -1,8 +1,8 @@ // Test that NEON types are defined, even when arm_neon.h is not included. // as required by AAPCS64 "Support for Advanced SIMD Extensions". -// RUN: %clang_cc1 -ast-dump -triple aarch64-linux-gnu %s -x c | FileCheck --check-prefixes=CHECK,A64 %s -// RUN: %clang_cc1 -ast-dump -triple aarch64-linux-gnu %s -x c++ | FileCheck --check-prefixes=CHECK,A64 %s +// RUN: %clang_cc1 -ast-dump -triple aarch64-linux-gnu %s -x c | FileCheck %s +// RUN: %clang_cc1 -ast-dump -triple aarch64-linux-gnu %s -x c++ | FileCheck %s // RUN: %clang_cc1 -verify -verify-ignore-unexpected=note -triple x86_64 %s -x c // RUN: %clang_cc1 -verify -verify-ignore-unexpected=note -triple x86_64 %s -x c++ // RUN: %clang_cc1 -verify -verify-ignore-unexpected=note -triple arm-linux-gnu %s -x c @@ -113,13 +113,13 @@ __Bfloat16x8_t Bfloat16x8; // expected-error@-2{{unknown type name '__Bfloat16x8_t'}} __mfp8 mfp8; -// A64: mfp8 '__mfp8' +// CHECK: mfp8 '__mfp8' // expected-error@-2{{unknown type name '__mfp8'}} __Mfloat8x8_t Mfloat8x8; -// A64: Mfloat8x8 '__Mfloat8x8_t':'__attribute__((neon_vector_type(8))) __mfp8' +// CHECK: Mfloat8x8 '__Mfloat8x8_t':'__attribute__((neon_vector_type(8))) __mfp8' // expected-error@-2{{unknown type name '__Mfloat8x8_t'}} __Mfloat8x16_t Mfloat8x16; -// A64: Mfloat8x16 '__Mfloat8x16_t':'__attribute__((neon_vector_type(16))) __mfp8' +// CHECK: Mfloat8x16 '__Mfloat8x16_t':'__attribute__((neon_vector_type(16))) __mfp8' // expected-error@-2{{unknown type name '__Mfloat8x16_t'}} _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits