xref: /llvm-project/llvm/test/Transforms/LoopVectorize/SystemZ/load-scalarization-cost-1.ll (revision 7d7577256b76e4293f455b8093504d5f7044ab4b)
1; RUN: opt -mtriple=s390x-unknown-linux -mcpu=z13 -passes=loop-vectorize \
2; RUN:   -force-vector-width=4 -debug-only=loop-vectorize \
3; RUN:   -enable-interleaved-mem-accesses=false -disable-output < %s 2>&1 \
4; RUN:   | FileCheck %s
5; REQUIRES: asserts
6;
7; Check that a scalarized load does not get a zero cost in a vectorized
8; loop. It can only be folded into the add operand in the scalar loop.
9
10define i32 @fun(ptr %data, i64 %n, i64 %s, ptr %Src) {
11entry:
12  br label %for.body
13
14for.body:
15  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
16  %acc = phi i32 [ 0, %entry ], [ %acc_next, %for.body ]
17  %gep = getelementptr inbounds i32, ptr %Src, i64 %iv
18  %ld = load i32, ptr %gep
19  %acc_next = add i32 %acc, %ld
20  %iv.next = add nuw nsw i64 %iv, 2
21  %cmp110.us = icmp slt i64 %iv.next, %n
22  br i1 %cmp110.us, label %for.body, label %for.end
23
24for.end:
25  ret i32 %acc_next
26
27; CHECK: Found an estimated cost of 4 for VF 4 For instruction:   %ld = load i32, ptr %gep
28}
29