2 ; RUN: opt -mtriple=s390x-unknown-linux -mcpu=z13 -loop-vectorize \
3 ; RUN: -force-vector-width=4 -debug-only=loop-vectorize,vectorutils \
4 ; RUN: -disable-output < %s 2>&1 | FileCheck %s
6 ; Check that the loop vectorizer performs memory interleaving with accurate
10 ; Simple case where just the load is interleaved, because the store group
12 define void @fun0(i32* %data, i64 %n) {
17 %i = phi i64 [ 0, %entry ], [ %i.next, %for.body ]
18 %tmp0 = getelementptr inbounds i32, i32* %data, i64 %i
19 %tmp1 = load i32, i32* %tmp0, align 4
20 %tmp2 = add i32 %tmp1, 1
21 store i32 %tmp2, i32* %tmp0, align 4
22 %i.next = add nuw nsw i64 %i, 2
23 %cond = icmp slt i64 %i.next, %n
24 br i1 %cond, label %for.body, label %for.end
29 ; CHECK: LV: Creating an interleave group with: %tmp1 = load i32, i32* %tmp0, align 4
30 ; CHECK: LV: Found an estimated cost of 3 for VF 4 For instruction: %tmp1 = load i32, i32* %tmp0, align 4
34 ; Interleaving of both load and stores.
35 define void @fun1(i32* %data, i64 %n) {
40 %i = phi i64 [ 0, %entry ], [ %i.next, %for.body ]
41 %tmp0 = getelementptr inbounds i32, i32* %data, i64 %i
42 %tmp1 = load i32, i32* %tmp0, align 4
44 %tmp2 = getelementptr inbounds i32, i32* %data, i64 %i_1
45 %tmp3 = load i32, i32* %tmp2, align 4
46 store i32 %tmp1, i32* %tmp2, align 4
47 store i32 %tmp3, i32* %tmp0, align 4
48 %i.next = add nuw nsw i64 %i, 2
49 %cond = icmp slt i64 %i.next, %n
50 br i1 %cond, label %for.body, label %for.end
55 ; CHECK: LV: Creating an interleave group with: store i32 %tmp3, i32* %tmp0, align 4
56 ; CHECK: LV: Inserted: store i32 %tmp1, i32* %tmp2, align 4
57 ; CHECK: into the interleave group with store i32 %tmp3, i32* %tmp0, align 4
58 ; CHECK: LV: Creating an interleave group with: %tmp3 = load i32, i32* %tmp2, align 4
59 ; CHECK: LV: Inserted: %tmp1 = load i32, i32* %tmp0, align 4
60 ; CHECK: into the interleave group with %tmp3 = load i32, i32* %tmp2, align 4
62 ; CHECK: LV: Found an estimated cost of 4 for VF 4 For instruction: %tmp1 = load i32, i32* %tmp0, align 4
63 ; CHECK: LV: Found an estimated cost of 0 for VF 4 For instruction: %tmp3 = load i32, i32* %tmp2, align 4
64 ; (vl; vl; vperm, vpkg)
66 ; CHECK: LV: Found an estimated cost of 0 for VF 4 For instruction: store i32 %tmp1, i32* %tmp2, align 4
67 ; CHECK: LV: Found an estimated cost of 4 for VF 4 For instruction: store i32 %tmp3, i32* %tmp0, align 4
68 ; (vmrlf; vmrhf; vst; vst)