Skip to content

Commit f3f7679

Browse files
committed
[LV] Add test for cost of select VPInstruction.
1 parent 9605666 commit f3f7679

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,26 @@ exit:
7373
%1 = select i1 %all.off, i32 1, i32 %0
7474
ret i32 %1
7575
}
76+
77+
define i32 @select_vpinst_for_tail_folding(i8 %n) {
78+
; CHECK: LV: Checking a loop in 'select_vpinst_for_tail_folding'
79+
; CHECK: Cost of 6 for VF 2: EMIT vp<{{.+}}> = select vp<{{.+}}>, ir<%red.next>, ir<%red>
80+
; CHECK: Cost of 12 for VF 4: EMIT vp<{{.+}}> = select vp<{{.+}}>, ir<%red.next>, ir<%red>
81+
; CHECK: LV: Selecting VF: 1
82+
83+
entry:
84+
%c = icmp ne i8 %n, 0
85+
%ext = zext i1 %c to i32
86+
br label %loop
87+
88+
loop:
89+
%iv = phi i32 [ %ext, %entry ], [ %iv.next, %loop ]
90+
%red = phi i32 [ 0, %entry ], [ %red.next, %loop ]
91+
%iv.next = add i32 %iv, 1
92+
%red.next = mul i32 %red, %iv
93+
%ec = icmp eq i32 %iv, 12
94+
br i1 %ec, label %exit, label %loop
95+
96+
exit:
97+
ret i32 %red.next
98+
}

0 commit comments

Comments
 (0)