diff options
author | Ricardo Jesus <rjj@nvidia.com> | 2024-11-14 09:00:19 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-14 09:00:19 +0000 |
commit | e52238b59f250aef5dc0925866d0308305a19dbf (patch) | |
tree | 1dc181e1441c43c1fb19568e962d0fea6b708bae /llvm/lib/IR/Verifier.cpp | |
parent | debfd7b0b44d8eb0bfe9f69933251a67f752f0b5 (diff) | |
download | llvm-e52238b59f250aef5dc0925866d0308305a19dbf.zip llvm-e52238b59f250aef5dc0925866d0308305a19dbf.tar.gz llvm-e52238b59f250aef5dc0925866d0308305a19dbf.tar.bz2 |
[AArch64] Add @llvm.experimental.vector.match (#101974)
This patch introduces an experimental intrinsic for matching the
elements of one vector against the elements of another.
For AArch64 targets that support SVE2, the intrinsic lowers to a MATCH
instruction for supported fixed and scalar vector types.
Diffstat (limited to 'llvm/lib/IR/Verifier.cpp')
-rw-r--r-- | llvm/lib/IR/Verifier.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp index 85e6045..24e7b48 100644 --- a/llvm/lib/IR/Verifier.cpp +++ b/llvm/lib/IR/Verifier.cpp @@ -6150,6 +6150,31 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) { &Call); break; } + case Intrinsic::experimental_vector_match: { + Value *Op1 = Call.getArgOperand(0); + Value *Op2 = Call.getArgOperand(1); + Value *Mask = Call.getArgOperand(2); + + VectorType *Op1Ty = dyn_cast<VectorType>(Op1->getType()); + VectorType *Op2Ty = dyn_cast<VectorType>(Op2->getType()); + VectorType *MaskTy = dyn_cast<VectorType>(Mask->getType()); + + Check(Op1Ty && Op2Ty && MaskTy, "Operands must be vectors.", &Call); + Check(isa<FixedVectorType>(Op2Ty), + "Second operand must be a fixed length vector.", &Call); + Check(Op1Ty->getElementType()->isIntegerTy(), + "First operand must be a vector of integers.", &Call); + Check(Op1Ty->getElementType() == Op2Ty->getElementType(), + "First two operands must have the same element type.", &Call); + Check(Op1Ty->getElementCount() == MaskTy->getElementCount(), + "First operand and mask must have the same number of elements.", + &Call); + Check(MaskTy->getElementType()->isIntegerTy(1), + "Mask must be a vector of i1's.", &Call); + Check(Call.getType() == MaskTy, "Return type must match the mask type.", + &Call); + break; + } case Intrinsic::vector_insert: { Value *Vec = Call.getArgOperand(0); Value *SubVec = Call.getArgOperand(1); |