xref: /llvm-project/llvm/test/Transforms/SLPVectorizer/SystemZ/SLP-cmp-cost-query.ll (revision 2a05971de2a59a99ef759a6f45828064c2dbeacf)
1; REQUIRES: asserts
2; RUN: opt -mtriple=systemz-unknown -mcpu=z13 -passes=slp-vectorizer -debug-only=SLP \
3; RUN:   -S -disable-output < %s 2>&1 | FileCheck %s
4;
5; Check that SLP vectorizer gets the right cost difference for a compare
6; node.
7
8; Function Attrs: norecurse nounwind readonly
9define void @fun(ptr nocapture, i32 zeroext) local_unnamed_addr #0 {
10.lr.ph.preheader:
11  br label %.lr.ph
12
13.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
14  %2 = phi i32 [ %., %.lr.ph ], [ undef, %.lr.ph.preheader ]
15  %3 = phi i32 [ %.9, %.lr.ph ], [ undef, %.lr.ph.preheader ]
16  %4 = icmp ult i32 %2, %1
17  %5 = select i1 %4, i32 0, i32 %1
18  %. = sub i32 %2, %5
19  %6 = icmp ult i32 %3, %1
20  %7 = select i1 %6, i32 0, i32 %1
21  %.9 = sub i32 %3, %7
22  %8 = zext i32 %. to i64
23  %9 = getelementptr inbounds i8, ptr %0, i64 %8
24  %10 = load i8, ptr %9, align 1
25  %11 = zext i32 %.9 to i64
26  %12 = getelementptr inbounds i8, ptr %0, i64 %11
27  %13 = load i8, ptr %12, align 1
28  %14 = icmp eq i8 %10, %13
29  br i1 %14, label %.lr.ph, label %._crit_edge
30
31._crit_edge:                                      ; preds = %.lr.ph
32  ret void
33
34; CHECK: SLP: Adding cost -1 for bundle Idx: 3, n=2 [  %4 = icmp ult i32 %2, %1, ..]
35}
36
37