diff --git a/clang/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h --- a/clang/include/clang/AST/ASTContext.h +++ b/clang/include/clang/AST/ASTContext.h @@ -1007,7 +1007,7 @@ #define SVE_TYPE(Name, Id, SingletonId) \ CanQualType SingletonId; #include "clang/Basic/AArch64SVEACLETypes.def" -#define PPC_MMA_VECTOR_TYPE(Name, Id, Size) \ +#define PPC_VECTOR_TYPE(Name, Id, Size) \ CanQualType Id##Ty; #include "clang/Basic/PPCTypes.def" diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h --- a/clang/include/clang/AST/Type.h +++ b/clang/include/clang/AST/Type.h @@ -2489,7 +2489,7 @@ #define SVE_TYPE(Name, Id, SingletonId) Id, #include "clang/Basic/AArch64SVEACLETypes.def" // PPC MMA Types -#define PPC_MMA_VECTOR_TYPE(Name, Id, Size) Id, +#define PPC_VECTOR_TYPE(Name, Id, Size) Id, #include "clang/Basic/PPCTypes.def" // All other builtin types #define BUILTIN_TYPE(Id, SingletonId) Id, diff --git a/clang/include/clang/AST/TypeProperties.td b/clang/include/clang/AST/TypeProperties.td --- a/clang/include/clang/AST/TypeProperties.td +++ b/clang/include/clang/AST/TypeProperties.td @@ -761,7 +761,7 @@ case BuiltinType::ID: return ctx.SINGLETON_ID; #include "clang/Basic/AArch64SVEACLETypes.def" -#define PPC_MMA_VECTOR_TYPE(NAME, ID, SIZE) \ +#define PPC_VECTOR_TYPE(NAME, ID, SIZE) \ case BuiltinType::ID: return ctx.ID##Ty; #include "clang/Basic/PPCTypes.def" diff --git a/clang/include/clang/Basic/PPCTypes.def b/clang/include/clang/Basic/PPCTypes.def --- a/clang/include/clang/Basic/PPCTypes.def +++ b/clang/include/clang/Basic/PPCTypes.def @@ -7,14 +7,32 @@ //===----------------------------------------------------------------------===// // // This file defines PPC types. -// Custom code should define this macro: +// Custom code should define one of these macros: // -// PPC_MMA_VECTOR_TYPE(Name, Id, Size) - A MMA vector type of a given size +// PPC_VECTOR_TYPE(Name, Id, Size) - A PPC vector type of a given size // (in bits). // +// PPC_VECTOR_MMA_TYPE(Name, Id, Size) - A PPC MMA vector type of a given +// size (in bits). +// +// PPC_VECTOR_VSX_TYPE(Name, Id, Size) - A PPC VSX vector type of a given +// size (in bits). +// //===----------------------------------------------------------------------===// -PPC_MMA_VECTOR_TYPE(__vector_quad, VectorQuad, 512) -PPC_MMA_VECTOR_TYPE(__vector_pair, VectorPair, 256) +#if defined(PPC_VECTOR_TYPE) + #define PPC_VECTOR_MMA_TYPE(Name, Id, Size) PPC_VECTOR_TYPE(Name, Id, Size) + #define PPC_VECTOR_VSX_TYPE(Name, Id, Size) PPC_VECTOR_TYPE(Name, Id, Size) +#elif defined(PPC_VECTOR_MMA_TYPE) + #define PPC_VECTOR_VSX_TYPE(Name, Id, Size) +#elif defined(PPC_VECTOR_VSX_TYPE) + #define PPC_VECTOR_MMA_TYPE(Name, Id, Size) +#endif + + +PPC_VECTOR_MMA_TYPE(__vector_quad, VectorQuad, 512) +PPC_VECTOR_VSX_TYPE(__vector_pair, VectorPair, 256) -#undef PPC_MMA_VECTOR_TYPE +#undef PPC_VECTOR_MMA_TYPE +#undef PPC_VECTOR_VSX_TYPE +#undef PPC_VECTOR_TYPE diff --git a/clang/include/clang/Serialization/ASTBitCodes.h b/clang/include/clang/Serialization/ASTBitCodes.h --- a/clang/include/clang/Serialization/ASTBitCodes.h +++ b/clang/include/clang/Serialization/ASTBitCodes.h @@ -1081,7 +1081,7 @@ #define SVE_TYPE(Name, Id, SingletonId) PREDEF_TYPE_##Id##_ID, #include "clang/Basic/AArch64SVEACLETypes.def" // \brief PowerPC MMA types with auto numeration -#define PPC_MMA_VECTOR_TYPE(Name, Id, Size) PREDEF_TYPE_##Id##_ID, +#define PPC_VECTOR_TYPE(Name, Id, Size) PREDEF_TYPE_##Id##_ID, #include "clang/Basic/PPCTypes.def" }; diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -1423,8 +1423,14 @@ #include "clang/Basic/AArch64SVEACLETypes.def" } - if (Target.getTriple().isPPC64() && Target.hasFeature("mma")) { -#define PPC_MMA_VECTOR_TYPE(Name, Id, Size) \ + if (Target.getTriple().isPPC64() && + Target.hasFeature("paired-vector-memops")) { + if (Target.hasFeature("mma")) { +#define PPC_VECTOR_MMA_TYPE(Name, Id, Size) \ + InitBuiltinType(Id##Ty, BuiltinType::Id); +#include "clang/Basic/PPCTypes.def" + } +#define PPC_VECTOR_VSX_TYPE(Name, Id, Size) \ InitBuiltinType(Id##Ty, BuiltinType::Id); #include "clang/Basic/PPCTypes.def" } @@ -2154,11 +2160,11 @@ Align = 16; \ break; #include "clang/Basic/AArch64SVEACLETypes.def" -#define PPC_MMA_VECTOR_TYPE(Name, Id, Size) \ +#define PPC_VECTOR_TYPE(Name, Id, Size) \ case BuiltinType::Id: \ - Width = Size; \ - Align = Size; \ - break; + Width = Size; \ + Align = Size; \ + break; #include "clang/Basic/PPCTypes.def" } break; @@ -7238,7 +7244,7 @@ case BuiltinType::OCLReserveID: case BuiltinType::OCLSampler: case BuiltinType::Dependent: -#define PPC_MMA_VECTOR_TYPE(Name, Id, Size) \ +#define PPC_VECTOR_TYPE(Name, Id, Size) \ case BuiltinType::Id: #include "clang/Basic/PPCTypes.def" #define BUILTIN_TYPE(KIND, ID) diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp --- a/clang/lib/AST/ASTImporter.cpp +++ b/clang/lib/AST/ASTImporter.cpp @@ -1035,7 +1035,7 @@ case BuiltinType::Id: \ return Importer.getToContext().SingletonId; #include "clang/Basic/AArch64SVEACLETypes.def" -#define PPC_MMA_VECTOR_TYPE(Name, Id, Size) \ +#define PPC_VECTOR_TYPE(Name, Id, Size) \ case BuiltinType::Id: \ return Importer.getToContext().Id##Ty; #include "clang/Basic/PPCTypes.def" diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -10965,7 +10965,7 @@ #define SVE_TYPE(Name, Id, SingletonId) \ case BuiltinType::Id: #include "clang/Basic/AArch64SVEACLETypes.def" -#define PPC_MMA_VECTOR_TYPE(Name, Id, Size) \ +#define PPC_VECTOR_TYPE(Name, Id, Size) \ case BuiltinType::Id: #include "clang/Basic/PPCTypes.def" return GCCTypeClass::None; diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp --- a/clang/lib/AST/ItaniumMangle.cpp +++ b/clang/lib/AST/ItaniumMangle.cpp @@ -2853,7 +2853,7 @@ << type_name; \ break; #include "clang/Basic/AArch64SVEACLETypes.def" -#define PPC_MMA_VECTOR_TYPE(Name, Id, Size) \ +#define PPC_VECTOR_TYPE(Name, Id, Size) \ case BuiltinType::Id: \ type_name = #Name; \ Out << 'u' << type_name.size() << type_name; \ diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp --- a/clang/lib/AST/MicrosoftMangle.cpp +++ b/clang/lib/AST/MicrosoftMangle.cpp @@ -2328,7 +2328,7 @@ #define SVE_TYPE(Name, Id, SingletonId) \ case BuiltinType::Id: #include "clang/Basic/AArch64SVEACLETypes.def" -#define PPC_MMA_VECTOR_TYPE(Name, Id, Size) \ +#define PPC_VECTOR_TYPE(Name, Id, Size) \ case BuiltinType::Id: #include "clang/Basic/PPCTypes.def" case BuiltinType::ShortAccum: diff --git a/clang/lib/AST/NSAPI.cpp b/clang/lib/AST/NSAPI.cpp --- a/clang/lib/AST/NSAPI.cpp +++ b/clang/lib/AST/NSAPI.cpp @@ -474,7 +474,7 @@ #define SVE_TYPE(Name, Id, SingletonId) \ case BuiltinType::Id: #include "clang/Basic/AArch64SVEACLETypes.def" -#define PPC_MMA_VECTOR_TYPE(Name, Id, Size) \ +#define PPC_VECTOR_TYPE(Name, Id, Size) \ case BuiltinType::Id: #include "clang/Basic/PPCTypes.def" case BuiltinType::BoundMember: diff --git a/clang/lib/AST/PrintfFormatString.cpp b/clang/lib/AST/PrintfFormatString.cpp --- a/clang/lib/AST/PrintfFormatString.cpp +++ b/clang/lib/AST/PrintfFormatString.cpp @@ -791,7 +791,7 @@ #define SVE_TYPE(Name, Id, SingletonId) \ case BuiltinType::Id: #include "clang/Basic/AArch64SVEACLETypes.def" -#define PPC_MMA_VECTOR_TYPE(Name, Id, Size) \ +#define PPC_VECTOR_TYPE(Name, Id, Size) \ case BuiltinType::Id: #include "clang/Basic/PPCTypes.def" #define SIGNED_TYPE(Id, SingletonId) diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp --- a/clang/lib/AST/Type.cpp +++ b/clang/lib/AST/Type.cpp @@ -3084,7 +3084,7 @@ case Id: \ return Name; #include "clang/Basic/AArch64SVEACLETypes.def" -#define PPC_MMA_VECTOR_TYPE(Name, Id, Size) \ +#define PPC_VECTOR_TYPE(Name, Id, Size) \ case Id: \ return #Name; #include "clang/Basic/PPCTypes.def" @@ -4105,7 +4105,7 @@ #define SVE_TYPE(Name, Id, SingletonId) \ case BuiltinType::Id: #include "clang/Basic/AArch64SVEACLETypes.def" -#define PPC_MMA_VECTOR_TYPE(Name, Id, Size) \ +#define PPC_VECTOR_TYPE(Name, Id, Size) \ case BuiltinType::Id: #include "clang/Basic/PPCTypes.def" case BuiltinType::BuiltinFn: diff --git a/clang/lib/AST/TypeLoc.cpp b/clang/lib/AST/TypeLoc.cpp --- a/clang/lib/AST/TypeLoc.cpp +++ b/clang/lib/AST/TypeLoc.cpp @@ -403,7 +403,7 @@ #define SVE_TYPE(Name, Id, SingletonId) \ case BuiltinType::Id: #include "clang/Basic/AArch64SVEACLETypes.def" -#define PPC_MMA_VECTOR_TYPE(Name, Id, Size) \ +#define PPC_VECTOR_TYPE(Name, Id, Size) \ case BuiltinType::Id: #include "clang/Basic/PPCTypes.def" case BuiltinType::BuiltinFn: diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -754,7 +754,7 @@ } // It doesn't make sense to generate debug info for PowerPC MMA vector types. // So we return a safe type here to avoid generating an error. -#define PPC_MMA_VECTOR_TYPE(Name, Id, size) \ +#define PPC_VECTOR_TYPE(Name, Id, size) \ case BuiltinType::Id: #include "clang/Basic/PPCTypes.def" return CreateType(cast(CGM.getContext().IntTy)); diff --git a/clang/lib/CodeGen/CodeGenTypes.cpp b/clang/lib/CodeGen/CodeGenTypes.cpp --- a/clang/lib/CodeGen/CodeGenTypes.cpp +++ b/clang/lib/CodeGen/CodeGenTypes.cpp @@ -595,7 +595,7 @@ Info.EC.getKnownMinValue() * Info.NumVectors); } -#define PPC_MMA_VECTOR_TYPE(Name, Id, Size) \ +#define PPC_VECTOR_TYPE(Name, Id, Size) \ case BuiltinType::Id: \ ResultType = \ llvm::FixedVectorType::get(ConvertType(Context.BoolTy), Size); \ diff --git a/clang/lib/CodeGen/ItaniumCXXABI.cpp b/clang/lib/CodeGen/ItaniumCXXABI.cpp --- a/clang/lib/CodeGen/ItaniumCXXABI.cpp +++ b/clang/lib/CodeGen/ItaniumCXXABI.cpp @@ -3093,7 +3093,7 @@ #define SVE_TYPE(Name, Id, SingletonId) \ case BuiltinType::Id: #include "clang/Basic/AArch64SVEACLETypes.def" -#define PPC_MMA_VECTOR_TYPE(Name, Id, Size) \ +#define PPC_VECTOR_TYPE(Name, Id, Size) \ case BuiltinType::Id: #include "clang/Basic/PPCTypes.def" case BuiltinType::ShortAccum: diff --git a/clang/lib/Index/USRGeneration.cpp b/clang/lib/Index/USRGeneration.cpp --- a/clang/lib/Index/USRGeneration.cpp +++ b/clang/lib/Index/USRGeneration.cpp @@ -729,7 +729,7 @@ #define SVE_TYPE(Name, Id, SingletonId) \ case BuiltinType::Id: #include "clang/Basic/AArch64SVEACLETypes.def" -#define PPC_MMA_VECTOR_TYPE(Name, Id, Size) \ +#define PPC_VECTOR_TYPE(Name, Id, Size) \ case BuiltinType::Id: #include "clang/Basic/PPCTypes.def" case BuiltinType::ShortAccum: diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp --- a/clang/lib/Sema/Sema.cpp +++ b/clang/lib/Sema/Sema.cpp @@ -370,8 +370,13 @@ } if (Context.getTargetInfo().getTriple().isPPC64() && - Context.getTargetInfo().hasFeature("mma")) { -#define PPC_MMA_VECTOR_TYPE(Name, Id, Size) \ + Context.getTargetInfo().hasFeature("paired-vector-memops")) { + if (Context.getTargetInfo().hasFeature("mma")) { +#define PPC_VECTOR_MMA_TYPE(Name, Id, Size) \ + addImplicitTypedef(#Name, Context.Id##Ty); +#include "clang/Basic/PPCTypes.def" + } +#define PPC_VECTOR_VSX_TYPE(Name, Id, Size) \ addImplicitTypedef(#Name, Context.Id##Ty); #include "clang/Basic/PPCTypes.def" } diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -3198,7 +3198,7 @@ Str = End; QualType Type; switch (size) { - #define PPC_MMA_VECTOR_TYPE(typeName, Id, size) \ + #define PPC_VECTOR_TYPE(typeName, Id, size) \ case size: Type = Context.Id##Ty; break; #include "clang/Basic/PPCTypes.def" default: llvm_unreachable("Invalid PowerPC MMA vector type"); @@ -3316,7 +3316,7 @@ return false; QualType CoreType = Type.getCanonicalType().getUnqualifiedType(); -#define PPC_MMA_VECTOR_TYPE(Name, Id, Size) || CoreType == Context.Id##Ty +#define PPC_VECTOR_TYPE(Name, Id, Size) || CoreType == Context.Id##Ty if (false #include "clang/Basic/PPCTypes.def" ) { diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -5990,7 +5990,7 @@ #define SVE_TYPE(Name, Id, SingletonId) \ case BuiltinType::Id: #include "clang/Basic/AArch64SVEACLETypes.def" -#define PPC_MMA_VECTOR_TYPE(Name, Id, Size) \ +#define PPC_VECTOR_TYPE(Name, Id, Size) \ case BuiltinType::Id: #include "clang/Basic/PPCTypes.def" #define PLACEHOLDER_TYPE(ID, SINGLETON_ID) @@ -19237,7 +19237,7 @@ #define SVE_TYPE(Name, Id, SingletonId) \ case BuiltinType::Id: #include "clang/Basic/AArch64SVEACLETypes.def" -#define PPC_MMA_VECTOR_TYPE(Name, Id, Size) \ +#define PPC_VECTOR_TYPE(Name, Id, Size) \ case BuiltinType::Id: #include "clang/Basic/PPCTypes.def" #define BUILTIN_TYPE(Id, SingletonId) case BuiltinType::Id: diff --git a/clang/lib/Serialization/ASTCommon.cpp b/clang/lib/Serialization/ASTCommon.cpp --- a/clang/lib/Serialization/ASTCommon.cpp +++ b/clang/lib/Serialization/ASTCommon.cpp @@ -237,7 +237,7 @@ ID = PREDEF_TYPE_##Id##_ID; \ break; #include "clang/Basic/AArch64SVEACLETypes.def" -#define PPC_MMA_VECTOR_TYPE(Name, Id, Size) \ +#define PPC_VECTOR_TYPE(Name, Id, Size) \ case BuiltinType::Id: \ ID = PREDEF_TYPE_##Id##_ID; \ break; diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -7025,7 +7025,7 @@ T = Context.SingletonId; \ break; #include "clang/Basic/AArch64SVEACLETypes.def" -#define PPC_MMA_VECTOR_TYPE(Name, Id, Size) \ +#define PPC_VECTOR_TYPE(Name, Id, Size) \ case PREDEF_TYPE_##Id##_ID: \ T = Context.Id##Ty; \ break; diff --git a/clang/test/AST/ast-dump-ppc-mma-types.c b/clang/test/AST/ast-dump-ppc-types.c rename from clang/test/AST/ast-dump-ppc-mma-types.c rename to clang/test/AST/ast-dump-ppc-types.c --- a/clang/test/AST/ast-dump-ppc-mma-types.c +++ b/clang/test/AST/ast-dump-ppc-types.c @@ -3,6 +3,9 @@ // RUN: %clang_cc1 -triple powerpc64le-unknown-unknown -target-cpu future \ // RUN: -target-feature -mma -ast-dump %s | FileCheck %s \ // RUN: --check-prefix=CHECK-NO-MMA +// RUN: %clang_cc1 -triple powerpc64le-unknown-unknown -target-cpu future \ +// RUN: -target-feature -paired-vector-memops -ast-dump %s | FileCheck %s \ +// RUN: --check-prefix=CHECK-NO-PAIRED // RUN: %clang_cc1 -triple powerpc64le-unknown-unknown -target-cpu pwr9 \ // RUN: -ast-dump %s | FileCheck %s --check-prefix=CHECK-PWR9 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -ast-dump %s | FileCheck %s \ @@ -13,9 +16,8 @@ // RUN: --check-prefix=CHECK-RISCV64 // This test case checks that the PowerPC __vector_pair and __vector_quad types -// are correctly defined. These types should only be defined on PowerPC targets -// supporting the mma feature. We also added checks on a couple of other targets -// to ensure the types are target-dependent. +// are correctly defined. We also added checks on a couple of other targets to +// ensure the types are target-dependent. // CHECK: TypedefDecl {{.*}} implicit __vector_quad '__vector_quad' // CHECK-NEXT: -BuiltinType {{.*}} '__vector_quad' @@ -23,7 +25,10 @@ // CHECK-NEXT: -BuiltinType {{.*}} '__vector_pair' // CHECK-NO-MMA-NOT: __vector_quad -// CHECK-NO-MMA-NOT: __vector_pair +// CHECK-NO-MMA: __vector_pair + +// CHECK-NO-PAIRED-NOT: __vector_quad +// CHECK-NO-PAIRED-NOT: __vector_pair // CHECK-PWR9-NOT: __vector_quad // CHECK-PWR9-NOT: __vector_pair diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/tools/libclang/CIndex.cpp @@ -1546,7 +1546,7 @@ case BuiltinType::OCLReserveID: #define SVE_TYPE(Name, Id, SingletonId) case BuiltinType::Id: #include "clang/Basic/AArch64SVEACLETypes.def" -#define PPC_MMA_VECTOR_TYPE(Name, Id, Size) case BuiltinType::Id: +#define PPC_VECTOR_TYPE(Name, Id, Size) case BuiltinType::Id: #include "clang/Basic/PPCTypes.def" #define BUILTIN_TYPE(Id, SingletonId) #define SIGNED_TYPE(Id, SingletonId) case BuiltinType::Id: diff --git a/llvm/lib/Target/PowerPC/PPCInstrPrefix.td b/llvm/lib/Target/PowerPC/PPCInstrPrefix.td --- a/llvm/lib/Target/PowerPC/PPCInstrPrefix.td +++ b/llvm/lib/Target/PowerPC/PPCInstrPrefix.td @@ -1600,13 +1600,9 @@ let Predicates = [MMA] in { def : Pat<(v512i1 (PPCAccBuild v4i32:$vs1, v4i32:$vs0, v4i32:$vs3, v4i32:$vs2)), (XXMTACC Concats.VecsToVecQuad)>; - def : Pat<(v256i1 (PPCPairBuild v4i32:$vs1, v4i32:$vs0)), - Concats.VecsToVecPair0>; def : Pat<(v512i1 (int_ppc_mma_assemble_acc v16i8:$vs1, v16i8:$vs0, v16i8:$vs3, v16i8:$vs2)), (XXMTACC Concats.VecsToVecQuad)>; - def : Pat<(v256i1 (int_ppc_mma_assemble_pair v16i8:$vs1, v16i8:$vs0)), - Concats.VecsToVecPair0>; def : Pat<(v512i1 (PPCxxmfacc v512i1:$AS)), (XXMFACC acc:$AS)>; def : Pat<(v4i32 (PPCAccExtractVsx acc:$v, (i64 0))), Extracts.Vec0>; @@ -1616,6 +1612,13 @@ Extracts.Vec2>; def : Pat<(v4i32 (PPCAccExtractVsx acc:$v, (i64 3))), Extracts.Vec3>; +} + +let Predicates = [PairedVectorMemops] in { + def : Pat<(v256i1 (PPCPairBuild v4i32:$vs1, v4i32:$vs0)), + Concats.VecsToVecPair0>; + def : Pat<(v256i1 (int_ppc_mma_assemble_pair v16i8:$vs1, v16i8:$vs0)), + Concats.VecsToVecPair0>; def : Pat<(v4i32 (PPCPairExtractVsx vsrpevenrc:$v, (i64 0))), (v4i32 (EXTRACT_SUBREG $v, sub_vsx0))>; def : Pat<(v4i32 (PPCPairExtractVsx vsrpevenrc:$v, (i64 1))), diff --git a/llvm/test/CodeGen/PowerPC/paired-vector-intrinsics-without-mma.ll b/llvm/test/CodeGen/PowerPC/paired-vector-intrinsics-without-mma.ll new file mode 100644 --- /dev/null +++ b/llvm/test/CodeGen/PowerPC/paired-vector-intrinsics-without-mma.ll @@ -0,0 +1,59 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -O3 \ +; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr -mattr=-mma \ +; RUN: < %s | FileCheck %s + +; This test is to check that the paired vector intrinsics are available even +; when MMA is disabled. + +define <16 x i8> @test1(<256 x i1>* %ptr) { +; CHECK-LABEL: test1: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: lxv v3, 0(r3) +; CHECK-NEXT: lxv v2, 16(r3) +; CHECK-NEXT: vaddubm v2, v3, v2 +; CHECK-NEXT: blr +entry: + %0 = load <256 x i1>, <256 x i1>* %ptr, align 32 + %1 = tail call { <16 x i8>, <16 x i8> } @llvm.ppc.mma.disassemble.pair(<256 x i1> %0) + %2 = extractvalue { <16 x i8>, <16 x i8> } %1, 0 + %3 = extractvalue { <16 x i8>, <16 x i8> } %1, 1 + %add = add <16 x i8> %2, %3 + ret <16 x i8> %add +} + +declare { <16 x i8>, <16 x i8> } @llvm.ppc.mma.disassemble.pair(<256 x i1>) + +define void @test2(<16 x i8> %v1, <16 x i8> %v2, <256 x i1>* %ptr) { +; CHECK-LABEL: test2: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vmr v4, v3 +; CHECK-NEXT: vmr v5, v2 +; CHECK-NEXT: stxv v4, 16(r7) +; CHECK-NEXT: stxv v5, 0(r7) +; CHECK-NEXT: blr +entry: + %0 = tail call <256 x i1> @llvm.ppc.mma.assemble.pair(<16 x i8> %v2, <16 x i8> %v1) + store <256 x i1> %0, <256 x i1>* %ptr, align 32 + ret void +} + +declare <256 x i1> @llvm.ppc.mma.assemble.pair(<16 x i8>, <16 x i8>) + +define void @test3(<256 x i1>* %ptr) { +; CHECK-LABEL: test3: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: lxvp vsp0, 0(r3) +; CHECK-NEXT: stxvp vsp0, 32(r3) +; CHECK-NEXT: blr +entry: + %0 = bitcast <256 x i1>* %ptr to i8* + %1 = tail call <256 x i1> @llvm.ppc.mma.lxvp(i8* %0) + %add.ptr1 = getelementptr inbounds <256 x i1>, <256 x i1>* %ptr, i64 1 + %2 = bitcast <256 x i1>* %add.ptr1 to i8* + tail call void @llvm.ppc.mma.stxvp(<256 x i1> %1, i8* %2) + ret void +} + +declare <256 x i1> @llvm.ppc.mma.lxvp(i8*) +declare void @llvm.ppc.mma.stxvp(<256 x i1>, i8*)