/// Matches InsertElementInst.
template <typename Val_t, typename Elt_t, typename Idx_t>
inline ThreeOps_match<Val_t, Elt_t, Idx_t, Instruction::InsertElement>
-m_InsertElement(const Val_t &Val, const Elt_t &Elt, const Idx_t &Idx) {
+m_InsertElt(const Val_t &Val, const Elt_t &Elt, const Idx_t &Idx) {
return ThreeOps_match<Val_t, Elt_t, Idx_t, Instruction::InsertElement>(
Val, Elt, Idx);
}
/// Matches ExtractElementInst.
template <typename Val_t, typename Idx_t>
inline TwoOps_match<Val_t, Idx_t, Instruction::ExtractElement>
-m_ExtractElement(const Val_t &Val, const Idx_t &Idx) {
+m_ExtractElt(const Val_t &Val, const Idx_t &Idx) {
return TwoOps_match<Val_t, Idx_t, Instruction::ExtractElement>(Val, Idx);
}
/// Matches ShuffleVectorInst independently of mask value.
template <typename V1_t, typename V2_t>
inline TwoOps_match<V1_t, V2_t, Instruction::ShuffleVector>
-m_ShuffleVector(const V1_t &v1, const V2_t &v2) {
+m_Shuffle(const V1_t &v1, const V2_t &v2) {
return TwoOps_match<V1_t, V2_t, Instruction::ShuffleVector>(v1, v2);
}
template <typename V1_t, typename V2_t, typename Mask_t>
inline Shuffle_match<V1_t, V2_t, Mask_t>
-m_ShuffleVector(const V1_t &v1, const V2_t &v2, const Mask_t &mask) {
+m_Shuffle(const V1_t &v1, const V2_t &v2, const Mask_t &mask) {
return Shuffle_match<V1_t, V2_t, Mask_t>(v1, v2, mask);
}
// If we are extracting a value from a vector, then inserting it into the same
// place, that's the input vector:
// insertelt Vec, (extractelt Vec, Idx), Idx --> Vec
- if (match(Val, m_ExtractElement(m_Specific(Vec), m_Specific(Idx))))
+ if (match(Val, m_ExtractElt(m_Specific(Vec), m_Specific(Idx))))
return Vec;
return nullptr;
// known at compile time for scalable vectors
Constant *C;
ConstantInt *IndexC;
- if (!Scalable && match(Op0, m_InsertElement(m_Value(), m_Constant(C),
- m_ConstantInt(IndexC)))) {
+ if (!Scalable && match(Op0, m_InsertElt(m_Value(), m_Constant(C),
+ m_ConstantInt(IndexC)))) {
// Match a splat shuffle mask of the insert index allowing undef elements.
int InsertIndex = IndexC->getZExtValue();
if (all_of(Indices, [InsertIndex](int MaskElt) {
// shuf (inselt ?, Splat, 0), ?, <0, undef, 0, ...>
Value *Splat;
- if (match(V, m_ShuffleVector(
- m_InsertElement(m_Value(), m_Value(Splat), m_ZeroInt()),
- m_Value(), m_ZeroMask())))
+ if (match(V,
+ m_Shuffle(m_InsertElt(m_Value(), m_Value(Splat), m_ZeroInt()),
+ m_Value(), m_ZeroMask())))
return Splat;
return nullptr;
/// in MVE takes a GPR (integer) register, and the instruction that incorporate
/// a VDUP (such as a VADD qd, qm, rm) also require a gpr register.
bool CodeGenPrepare::optimizeShuffleVectorInst(ShuffleVectorInst *SVI) {
- if (!match(SVI,
- m_ShuffleVector(m_InsertElement(m_Undef(), m_Value(), m_ZeroInt()),
- m_Undef(), m_ZeroMask())))
+ if (!match(SVI, m_Shuffle(m_InsertElt(m_Undef(), m_Value(), m_ZeroInt()),
+ m_Undef(), m_ZeroMask())))
return false;
Type *NewType = TLI->shouldConvertSplatType(SVI);
if (!NewType)
ArrayRef<int> M1, M2;
Value *S1Op1, *S2Op1;
- if (!match(Op1, m_ShuffleVector(m_Value(S1Op1), m_Undef(), m_Mask(M1))) ||
- !match(Op2, m_ShuffleVector(m_Value(S2Op1), m_Undef(), m_Mask(M2))))
+ if (!match(Op1, m_Shuffle(m_Value(S1Op1), m_Undef(), m_Mask(M1))) ||
+ !match(Op2, m_Shuffle(m_Value(S2Op1), m_Undef(), m_Mask(M2))))
return false;
// Check that the operands are half as wide as the result and we extract
static bool isOperandOfVmullHighP64(Value *Op) {
Value *VectorOperand = nullptr;
ConstantInt *ElementIndex = nullptr;
- return match(Op, m_ExtractElement(m_Value(VectorOperand),
- m_ConstantInt(ElementIndex))) &&
+ return match(Op, m_ExtractElt(m_Value(VectorOperand),
+ m_ConstantInt(ElementIndex))) &&
ElementIndex->getValue() == 1 &&
isa<FixedVectorType>(VectorOperand->getType()) &&
cast<FixedVectorType>(VectorOperand->getType())->getNumElements() == 2;
Shuffle = dyn_cast<Instruction>(Shuffle->getOperand(0));
// We are looking for a splat that can be sunk.
if (!Shuffle ||
- !match(Shuffle, m_ShuffleVector(
- m_InsertElement(m_Undef(), m_Value(), m_ZeroInt()),
+ !match(Shuffle, m_Shuffle(
+ m_InsertElt(m_Undef(), m_Value(), m_ZeroInt()),
m_Undef(), m_ZeroMask())))
continue;
if (!IsSinker(I, OpIdx.index()))
Instruction *Insert = nullptr;
// The shuffle which broadcasts the index iv into a vector.
if (!match(BroadcastSplat,
- m_ShuffleVector(m_Instruction(Insert), m_Undef(), m_ZeroMask())))
+ m_Shuffle(m_Instruction(Insert), m_Undef(), m_ZeroMask())))
return false;
// The insert element which initialises a vector with the index iv.
Instruction *IV = nullptr;
- if (!match(Insert, m_InsertElement(m_Undef(), m_Instruction(IV), m_Zero())))
+ if (!match(Insert, m_InsertElt(m_Undef(), m_Instruction(IV), m_Zero())))
return false;
// The index iv.
Instruction *Insert = nullptr;
if (!match(Shuffle,
- m_ShuffleVector(m_Instruction(Insert), m_Undef(), m_ZeroMask())))
+ m_Shuffle(m_Instruction(Insert), m_Undef(), m_ZeroMask())))
return false;
// Insert the limit into a vector.
Instruction *BECount = nullptr;
if (!match(Insert,
- m_InsertElement(m_Undef(), m_Instruction(BECount), m_Zero())))
+ m_InsertElt(m_Undef(), m_Instruction(BECount), m_Zero())))
return false;
// The limit calculation, backedge count.
// --->
// extractelement <8 x i32> (bitcast <4 x i64> %X to <8 x i32>), i32 0
Value *VecOp;
- if (match(Src,
- m_OneUse(m_ExtractElement(m_Value(VecOp), m_ConstantInt(Cst))))) {
+ if (match(Src, m_OneUse(m_ExtractElt(m_Value(VecOp), m_ConstantInt(Cst))))) {
auto *VecOpTy = cast<VectorType>(VecOp->getType());
unsigned DestScalarSize = DestTy->getScalarSizeInBits();
unsigned VecOpScalarSize = VecOpTy->getScalarSizeInBits();
Value *Vec;
ArrayRef<int> Mask;
- if (match(BCSrcOp, m_ShuffleVector(m_Value(Vec), m_Undef(), m_Mask(Mask)))) {
+ if (match(BCSrcOp, m_Shuffle(m_Value(Vec), m_Undef(), m_Mask(Mask)))) {
// Check whether every element of Mask is the same constant
if (is_splat(Mask)) {
auto *VecTy = cast<VectorType>(BCSrcOp->getType());
Value *V1, *V2;
ArrayRef<int> M;
- if (!match(LHS, m_ShuffleVector(m_Value(V1), m_Undef(), m_Mask(M))))
+ if (!match(LHS, m_Shuffle(m_Value(V1), m_Undef(), m_Mask(M))))
return nullptr;
// If both arguments of the cmp are shuffles that use the same mask and
// shuffle within a single vector, move the shuffle after the cmp:
// cmp (shuffle V1, M), (shuffle V2, M) --> shuffle (cmp V1, V2), M
Type *V1Ty = V1->getType();
- if (match(RHS, m_ShuffleVector(m_Value(V2), m_Undef(), m_SpecificMask(M))) &&
+ if (match(RHS, m_Shuffle(m_Value(V2), m_Undef(), m_SpecificMask(M))) &&
V1Ty == V2->getType() && (LHS->hasOneUse() || RHS->hasOneUse())) {
Value *NewCmp = IsFP ? Builder.CreateFCmp(Pred, V1, V2)
: Builder.CreateICmp(Pred, V1, V2);
// We can replace a single-use extract with constant index.
Value *Cond = Sel.getCondition();
- if (!match(Cond, m_OneUse(m_ExtractElement(m_Value(), m_ConstantInt()))))
+ if (!match(Cond, m_OneUse(m_ExtractElt(m_Value(), m_ConstantInt()))))
return nullptr;
// select (extelt V, Index), T, F --> select (splat V, Index), T, F
// An insertelement to the same constant index as our extract will simplify
// to the scalar inserted element. An insertelement to a different constant
// index is irrelevant to our extract.
- if (match(V, m_InsertElement(m_Value(), m_Value(), m_ConstantInt())))
+ if (match(V, m_InsertElt(m_Value(), m_Value(), m_ConstantInt())))
return IsConstantExtractIndex;
if (match(V, m_OneUse(m_Load(m_Value()))))
if (NumSrcElts < NumElts) {
Value *Scalar;
uint64_t InsIndexC;
- if (!match(X, m_InsertElement(m_Value(), m_Value(Scalar),
- m_ConstantInt(InsIndexC))))
+ if (!match(X, m_InsertElt(m_Value(), m_Value(Scalar),
+ m_ConstantInt(InsIndexC))))
return nullptr;
// The extract must be from the subset of vector elements that we inserted
// Check if the splat shuffle's input is the same as this insert's scalar op.
Value *X = InsElt.getOperand(1);
Value *Op0 = Shuf->getOperand(0);
- if (!match(Op0, m_InsertElement(m_Undef(), m_Specific(X), m_ZeroInt())))
+ if (!match(Op0, m_InsertElt(m_Undef(), m_Specific(X), m_ZeroInt())))
return nullptr;
// Replace the shuffle mask element at the index of this insert with a zero.
// input vector.
Value *Scalar = InsElt.getOperand(1);
Value *X = Shuf->getOperand(0);
- if (!match(Scalar, m_ExtractElement(m_Specific(X), m_SpecificInt(IdxC))))
+ if (!match(Scalar, m_ExtractElt(m_Specific(X), m_SpecificInt(IdxC))))
return nullptr;
// Replace the shuffle mask element at the index of this extract+insert with
if (isa<FixedVectorType>(IE.getType()) &&
match(IdxOp, m_ConstantInt(InsertedIdx)) &&
match(ScalarOp,
- m_ExtractElement(m_Value(ExtVecOp), m_ConstantInt(ExtractedIdx))) &&
+ m_ExtractElt(m_Value(ExtVecOp), m_ConstantInt(ExtractedIdx))) &&
isa<FixedVectorType>(ExtVecOp->getType()) &&
ExtractedIdx <
cast<FixedVectorType>(ExtVecOp->getType())->getNumElements()) {
uint64_t IndexC;
// Match a shuffle that is a splat to a non-zero element.
- if (!match(Op0, m_OneUse(m_InsertElement(m_Undef(), m_Value(X),
- m_ConstantInt(IndexC)))) ||
+ if (!match(Op0, m_OneUse(m_InsertElt(m_Undef(), m_Value(X),
+ m_ConstantInt(IndexC)))) ||
!match(Op1, m_Undef()) || match(Mask, m_ZeroMask()) || IndexC == 0)
return nullptr;
// and have the same number of elements as this shuffle.
unsigned NarrowNumElts = Shuf.getType()->getNumElements();
Value *NarrowCond;
- if (!match(Cond, m_OneUse(m_ShuffleVector(m_Value(NarrowCond), m_Undef()))) ||
+ if (!match(Cond, m_OneUse(m_Shuffle(m_Value(NarrowCond), m_Undef()))) ||
cast<VectorType>(NarrowCond->getType())->getNumElements() !=
NarrowNumElts ||
!cast<ShuffleVectorInst>(Cond)->isIdentityWithPadding())
Value *X, *Y;
ArrayRef<int> Mask;
- if (!match(Op0, m_ShuffleVector(m_Value(X), m_Value(Y), m_Mask(Mask))))
+ if (!match(Op0, m_Shuffle(m_Value(X), m_Value(Y), m_Mask(Mask))))
return nullptr;
// Be conservative with shuffle transforms. If we can't kill the 1st shuffle,
// operand with the source vector of the insertelement.
Value *X;
uint64_t IdxC;
- if (match(V0, m_InsertElement(m_Value(X), m_Value(), m_ConstantInt(IdxC)))) {
+ if (match(V0, m_InsertElt(m_Value(X), m_Value(), m_ConstantInt(IdxC)))) {
// shuf (inselt X, ?, IdxC), ?, Mask --> shuf X, ?, Mask
if (none_of(Mask, [IdxC](int MaskElt) { return MaskElt == (int)IdxC; }))
return IC.replaceOperand(Shuf, 0, X);
}
- if (match(V1, m_InsertElement(m_Value(X), m_Value(), m_ConstantInt(IdxC)))) {
+ if (match(V1, m_InsertElt(m_Value(X), m_Value(), m_ConstantInt(IdxC)))) {
// Offset the index constant by the vector width because we are checking for
// accesses to the 2nd vector input of the shuffle.
IdxC += NumElts;
// shuffle (insert ?, Scalar, IndexC), V1, Mask --> insert V1, Scalar, IndexC'
auto isShufflingScalarIntoOp1 = [&](Value *&Scalar, ConstantInt *&IndexC) {
// We need an insertelement with a constant index.
- if (!match(V0, m_InsertElement(m_Value(), m_Value(Scalar),
- m_ConstantInt(IndexC))))
+ if (!match(V0, m_InsertElt(m_Value(), m_Value(Scalar),
+ m_ConstantInt(IndexC))))
return false;
// Test the shuffle mask to see if it splices the inserted scalar into the
// of the results.
Value *L0, *L1, *R0, *R1;
ArrayRef<int> Mask;
- if (match(LHS, m_ShuffleVector(m_Value(L0), m_Value(L1), m_Mask(Mask))) &&
- match(RHS,
- m_ShuffleVector(m_Value(R0), m_Value(R1), m_SpecificMask(Mask))) &&
+ if (match(LHS, m_Shuffle(m_Value(L0), m_Value(L1), m_Mask(Mask))) &&
+ match(RHS, m_Shuffle(m_Value(R0), m_Value(R1), m_SpecificMask(Mask))) &&
LHS->hasOneUse() && RHS->hasOneUse() &&
cast<ShuffleVectorInst>(LHS)->isConcat() &&
cast<ShuffleVectorInst>(RHS)->isConcat()) {
// If both arguments of the binary operation are shuffles that use the same
// mask and shuffle within a single vector, move the shuffle after the binop.
Value *V1, *V2;
- if (match(LHS, m_ShuffleVector(m_Value(V1), m_Undef(), m_Mask(Mask))) &&
- match(RHS,
- m_ShuffleVector(m_Value(V2), m_Undef(), m_SpecificMask(Mask))) &&
+ if (match(LHS, m_Shuffle(m_Value(V1), m_Undef(), m_Mask(Mask))) &&
+ match(RHS, m_Shuffle(m_Value(V2), m_Undef(), m_SpecificMask(Mask))) &&
V1->getType() == V2->getType() &&
(LHS->hasOneUse() || RHS->hasOneUse() || LHS == RHS)) {
// Op(shuffle(V1, Mask), shuffle(V2, Mask)) -> shuffle(Op(V1, V2), Mask)
// If both arguments of a commutative binop are select-shuffles that use the
// same mask with commuted operands, the shuffles are unnecessary.
if (Inst.isCommutative() &&
- match(LHS, m_ShuffleVector(m_Value(V1), m_Value(V2), m_Mask(Mask))) &&
- match(RHS, m_ShuffleVector(m_Specific(V2), m_Specific(V1),
- m_SpecificMask(Mask)))) {
+ match(LHS, m_Shuffle(m_Value(V1), m_Value(V2), m_Mask(Mask))) &&
+ match(RHS,
+ m_Shuffle(m_Specific(V2), m_Specific(V1), m_SpecificMask(Mask)))) {
auto *LShuf = cast<ShuffleVectorInst>(LHS);
auto *RShuf = cast<ShuffleVectorInst>(RHS);
// TODO: Allow shuffles that contain undefs in the mask?
// transforms.
unsigned NumElts = cast<FixedVectorType>(Inst.getType())->getNumElements();
Constant *C;
- if (match(&Inst, m_c_BinOp(m_OneUse(m_ShuffleVector(m_Value(V1), m_Undef(),
- m_Mask(Mask))),
- m_Constant(C))) &&
+ if (match(&Inst,
+ m_c_BinOp(m_OneUse(m_Shuffle(m_Value(V1), m_Undef(), m_Mask(Mask))),
+ m_Constant(C))) &&
cast<FixedVectorType>(V1->getType())->getNumElements() <= NumElts) {
assert(Inst.getType()->getScalarType() == V1->getType()->getScalarType() &&
"Shuffle should not change scalar type");
ArrayRef<int> MaskC;
int SplatIndex;
BinaryOperator *BO;
- if (!match(LHS, m_OneUse(m_ShuffleVector(m_Value(X), m_Undef(),
- m_Mask(MaskC)))) ||
+ if (!match(LHS,
+ m_OneUse(m_Shuffle(m_Value(X), m_Undef(), m_Mask(MaskC)))) ||
!match(MaskC, m_SplatOrUndefMask(SplatIndex)) ||
X->getType() != Inst.getType() || !match(RHS, m_OneUse(m_BinOp(BO))) ||
BO->getOpcode() != Opcode)
// the extracts could be optimized away.
Value *EV;
ConstantInt *Ex1Idx, *Ex2Idx;
- if (match(V1, m_ExtractElement(m_Value(EV), m_ConstantInt(Ex1Idx))) &&
- match(V2, m_ExtractElement(m_Deferred(EV), m_ConstantInt(Ex2Idx))) &&
+ if (match(V1, m_ExtractElt(m_Value(EV), m_ConstantInt(Ex1Idx))) &&
+ match(V2, m_ExtractElt(m_Deferred(EV), m_ConstantInt(Ex2Idx))) &&
Ex1Idx->getZExtValue() + 1 == Ex2Idx->getZExtValue())
return VLOperands::ScoreConsecutiveExtracts;
Value *V0, *V1;
uint64_t C0, C1;
- if (!match(Ext0, m_ExtractElement(m_Value(V0), m_ConstantInt(C0))) ||
- !match(Ext1, m_ExtractElement(m_Value(V1), m_ConstantInt(C1))) ||
+ if (!match(Ext0, m_ExtractElt(m_Value(V0), m_ConstantInt(C0))) ||
+ !match(Ext1, m_ExtractElt(m_Value(V1), m_ConstantInt(C1))) ||
V0->getType() != V1->getType())
return false;
// probably becomes unnecessary.
uint64_t InsertIndex = std::numeric_limits<uint64_t>::max();
if (I.hasOneUse())
- match(I.user_back(), m_InsertElement(m_Value(), m_Value(),
- m_ConstantInt(InsertIndex)));
+ match(I.user_back(),
+ m_InsertElt(m_Value(), m_Value(), m_ConstantInt(InsertIndex)));
Instruction *ConvertToShuffle;
if (isExtractExtractCheap(Ext0, Ext1, I.getOpcode(), TTI, ConvertToShuffle,
static bool foldBitcastShuf(Instruction &I, const TargetTransformInfo &TTI) {
Value *V;
ArrayRef<int> Mask;
- if (!match(&I, m_BitCast(m_OneUse(m_ShuffleVector(m_Value(V), m_Undef(),
- m_Mask(Mask))))))
+ if (!match(&I, m_BitCast(
+ m_OneUse(m_Shuffle(m_Value(V), m_Undef(), m_Mask(Mask))))))
return false;
// Disallow non-vector casts and length-changing shuffles.
// bitcast (shuf V, MaskC) --> shuf (bitcast V), MaskC'
IRBuilder<> Builder(&I);
Value *CastV = Builder.CreateBitCast(V, DestTy);
- Value *Shuf = Builder.CreateShuffleVector(CastV, UndefValue::get(DestTy),
- NewMask);
+ Value *Shuf =
+ Builder.CreateShuffleVector(CastV, UndefValue::get(DestTy), NewMask);
I.replaceAllUsesWith(Shuf);
return true;
}
Constant *VecC0, *VecC1;
Value *V0, *V1;
uint64_t Index;
- if (!match(Ins0, m_InsertElement(m_Constant(VecC0), m_Value(V0),
- m_ConstantInt(Index))) ||
- !match(Ins1, m_InsertElement(m_Constant(VecC1), m_Value(V1),
- m_SpecificInt(Index))))
+ if (!match(Ins0, m_InsertElt(m_Constant(VecC0), m_Value(V0),
+ m_ConstantInt(Index))) ||
+ !match(Ins1, m_InsertElt(m_Constant(VecC1), m_Value(V1),
+ m_SpecificInt(Index))))
return false;
Type *ScalarTy = V0->getType();
Value *A = nullptr, *B = nullptr, *C = nullptr;
// Test matching insertelement
- EXPECT_TRUE(match(VI1, m_InsertElement(m_Value(), m_Value(), m_Value())));
+ EXPECT_TRUE(match(VI1, m_InsertElt(m_Value(), m_Value(), m_Value())));
EXPECT_TRUE(
- match(VI1, m_InsertElement(m_Undef(), m_ConstantInt(), m_ConstantInt())));
+ match(VI1, m_InsertElt(m_Undef(), m_ConstantInt(), m_ConstantInt())));
EXPECT_TRUE(
- match(VI1, m_InsertElement(m_Undef(), m_ConstantInt(), m_Zero())));
+ match(VI1, m_InsertElt(m_Undef(), m_ConstantInt(), m_Zero())));
EXPECT_TRUE(
- match(VI1, m_InsertElement(m_Undef(), m_SpecificInt(1), m_Zero())));
- EXPECT_TRUE(match(VI2, m_InsertElement(m_Value(), m_Value(), m_Value())));
+ match(VI1, m_InsertElt(m_Undef(), m_SpecificInt(1), m_Zero())));
+ EXPECT_TRUE(match(VI2, m_InsertElt(m_Value(), m_Value(), m_Value())));
EXPECT_FALSE(
- match(VI2, m_InsertElement(m_Value(), m_Value(), m_ConstantInt())));
+ match(VI2, m_InsertElt(m_Value(), m_Value(), m_ConstantInt())));
EXPECT_FALSE(
- match(VI2, m_InsertElement(m_Value(), m_ConstantInt(), m_Value())));
- EXPECT_FALSE(match(VI2, m_InsertElement(m_Constant(), m_Value(), m_Value())));
- EXPECT_TRUE(match(VI3, m_InsertElement(m_Value(A), m_Value(B), m_Value(C))));
+ match(VI2, m_InsertElt(m_Value(), m_ConstantInt(), m_Value())));
+ EXPECT_FALSE(match(VI2, m_InsertElt(m_Constant(), m_Value(), m_Value())));
+ EXPECT_TRUE(match(VI3, m_InsertElt(m_Value(A), m_Value(B), m_Value(C))));
EXPECT_TRUE(A == VI1);
EXPECT_TRUE(B == Val2);
EXPECT_TRUE(isa<ConstantInt>(C));
A = B = C = nullptr; // reset
// Test matching extractelement
- EXPECT_TRUE(match(EX1, m_ExtractElement(m_Value(A), m_Value(B))));
+ EXPECT_TRUE(match(EX1, m_ExtractElt(m_Value(A), m_Value(B))));
EXPECT_TRUE(A == VI4);
EXPECT_TRUE(B == Val);
A = B = C = nullptr; // reset
- EXPECT_FALSE(match(EX1, m_ExtractElement(m_Value(), m_ConstantInt())));
- EXPECT_TRUE(match(EX2, m_ExtractElement(m_Value(), m_ConstantInt())));
- EXPECT_TRUE(match(EX3, m_ExtractElement(m_Constant(), m_ConstantInt())));
+ EXPECT_FALSE(match(EX1, m_ExtractElt(m_Value(), m_ConstantInt())));
+ EXPECT_TRUE(match(EX2, m_ExtractElt(m_Value(), m_ConstantInt())));
+ EXPECT_TRUE(match(EX3, m_ExtractElt(m_Constant(), m_ConstantInt())));
// Test matching shufflevector
ArrayRef<int> Mask;
- EXPECT_TRUE(match(SI1, m_ShuffleVector(m_Value(), m_Undef(), m_ZeroMask())));
- EXPECT_TRUE(
- match(SI2, m_ShuffleVector(m_Value(A), m_Value(B), m_Mask(Mask))));
+ EXPECT_TRUE(match(SI1, m_Shuffle(m_Value(), m_Undef(), m_ZeroMask())));
+ EXPECT_TRUE(match(SI2, m_Shuffle(m_Value(A), m_Value(B), m_Mask(Mask))));
EXPECT_TRUE(A == VI3);
EXPECT_TRUE(B == VI4);
A = B = C = nullptr; // reset
// Test matching the vector splat pattern
EXPECT_TRUE(match(
SI1,
- m_ShuffleVector(m_InsertElement(m_Undef(), m_SpecificInt(1), m_Zero()),
- m_Undef(), m_ZeroMask())));
+ m_Shuffle(m_InsertElt(m_Undef(), m_SpecificInt(1), m_Zero()),
+ m_Undef(), m_ZeroMask())));
EXPECT_FALSE(match(
- SI3, m_ShuffleVector(m_InsertElement(m_Undef(), m_Value(), m_Zero()),
- m_Undef(), m_ZeroMask())));
+ SI3, m_Shuffle(m_InsertElt(m_Undef(), m_Value(), m_Zero()),
+ m_Undef(), m_ZeroMask())));
EXPECT_FALSE(match(
- SI4, m_ShuffleVector(m_InsertElement(m_Undef(), m_Value(), m_Zero()),
- m_Undef(), m_ZeroMask())));
+ SI4, m_Shuffle(m_InsertElt(m_Undef(), m_Value(), m_Zero()),
+ m_Undef(), m_ZeroMask())));
EXPECT_TRUE(match(
SP1,
- m_ShuffleVector(m_InsertElement(m_Undef(), m_SpecificInt(2), m_Zero()),
- m_Undef(), m_ZeroMask())));
+ m_Shuffle(m_InsertElt(m_Undef(), m_SpecificInt(2), m_Zero()),
+ m_Undef(), m_ZeroMask())));
EXPECT_TRUE(match(
- SP2, m_ShuffleVector(m_InsertElement(m_Undef(), m_Value(A), m_Zero()),
- m_Undef(), m_ZeroMask())));
+ SP2, m_Shuffle(m_InsertElt(m_Undef(), m_Value(A), m_Zero()),
+ m_Undef(), m_ZeroMask())));
EXPECT_TRUE(A == Val);
}