Skip to content

Commit da91908

Browse files
committed
!fixup add missing ternary VPInstruction matcher, update test.
1 parent f26703c commit da91908

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,16 @@ using BinaryVPInstruction_match =
216216
BinaryRecipe_match<Op0_t, Op1_t, Opcode, /*Commutative*/ false,
217217
VPInstruction>;
218218

219+
template <typename Op0_t, typename Op1_t, typename Op2_t, unsigned Opcode,
220+
bool Commutative, typename... RecipeTys>
221+
using TernaryRecipe_match = Recipe_match<std::tuple<Op0_t, Op1_t, Op2_t>,
222+
Opcode, Commutative, RecipeTys...>;
223+
224+
template <typename Op0_t, typename Op1_t, typename Op2_t, unsigned Opcode>
225+
using TernaryVPInstruction_match =
226+
TernaryRecipe_match<Op0_t, Op1_t, Op2_t, Opcode, /*Commutative*/ false,
227+
VPInstruction>;
228+
219229
template <typename Op0_t, typename Op1_t, unsigned Opcode,
220230
bool Commutative = false>
221231
using AllBinaryRecipe_match =
@@ -234,6 +244,13 @@ m_VPInstruction(const Op0_t &Op0, const Op1_t &Op1) {
234244
return BinaryVPInstruction_match<Op0_t, Op1_t, Opcode>(Op0, Op1);
235245
}
236246

247+
template <unsigned Opcode, typename Op0_t, typename Op1_t, typename Op2_t>
248+
inline TernaryVPInstruction_match<Op0_t, Op1_t, Op2_t, Opcode>
249+
m_VPInstruction(const Op0_t &Op0, const Op1_t &Op1, const Op2_t &Op2) {
250+
return TernaryVPInstruction_match<Op0_t, Op1_t, Op2_t, Opcode>(
251+
{Op0, Op1, Op2});
252+
}
253+
237254
template <typename Op0_t>
238255
inline UnaryVPInstruction_match<Op0_t, VPInstruction::Not>
239256
m_Not(const Op0_t &Op0) {

llvm/test/Transforms/LoopVectorize/vplan-printing-reductions.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ define i64 @find_last_iv(ptr %a, i64 %n, i64 %start) {
234234
; CHECK-NEXT: Successor(s): middle.block
235235
; CHECK-EMPTY:
236236
; CHECK-NEXT: middle.block:
237-
; CHECK-NEXT: EMIT vp<[[RDX_RES:%.+]]> = compute-find-last-iv-result ir<%rdx>, ir<%cond>
237+
; CHECK-NEXT: EMIT vp<[[RDX_RES:%.+]]> = compute-find-last-iv-result ir<%rdx>, ir<%start>, ir<%cond>
238238
; CHECK-NEXT: EMIT vp<[[EXT:%.+]]> = extract-from-end vp<[[RDX_RES]]>, ir<1>
239239
; CHECK-NEXT: EMIT vp<%cmp.n> = icmp eq ir<%n>, vp<{{.+}}>
240240
; CHECK-NEXT: EMIT branch-on-cond vp<%cmp.n>

0 commit comments

Comments
 (0)