brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.6 KiB · ee81af2 Raw
71 lines · plain
1; REQUIRES: asserts2; RUN: opt -mtriple=s390x-unknown-linux -mcpu=z13 -passes=loop-vectorize \3; RUN:   -force-vector-width=4 -debug-only=loop-vectorize,vectorutils \4; RUN:   -disable-output < %s 2>&1 | FileCheck %s5;6; Check that the loop vectorizer performs memory interleaving with accurate7; cost estimations.8 9 10; Simple case where just the load is interleaved, because the store group11; would have gaps.12define void @fun0(ptr %data, i64 %n) {13entry:14  br label %for.body15 16for.body:17  %i = phi i64 [ 0, %entry ], [ %i.next, %for.body ]18  %tmp0 = getelementptr inbounds i32, ptr %data, i64 %i19  %tmp1 = load i32, ptr %tmp0, align 420  %tmp2 = add i32 %tmp1, 121  store i32 %tmp2, ptr %tmp0, align 422  %i.next = add nuw nsw i64 %i, 223  %cond = icmp slt i64 %i.next, %n24  br i1 %cond, label %for.body, label %for.end25 26for.end:27  ret void28 29; CHECK: LV: Creating an interleave group with:  %tmp1 = load i32, ptr %tmp0, align 430; CHECK: LV: Found an estimated cost of 3 for VF 4 For instruction:   %tmp1 = load i32, ptr %tmp0, align 431;        (vl; vl; vperm)32}33 34; Interleaving of both load and stores.35define void @fun1(ptr %data, i64 %n) {36entry:37  br label %for.body38 39for.body:40  %i = phi i64 [ 0, %entry ], [ %i.next, %for.body ]41  %tmp0 = getelementptr inbounds i32, ptr %data, i64 %i42  %tmp1 = load i32, ptr %tmp0, align 443  %i_1  = add i64 %i, 144  %tmp2 = getelementptr inbounds i32, ptr %data, i64 %i_145  %tmp3 = load i32, ptr %tmp2, align 446  store i32 %tmp1, ptr %tmp2, align 447  store i32 %tmp3, ptr %tmp0, align 448  %i.next = add nuw nsw i64 %i, 249  %cond = icmp slt i64 %i.next, %n50  br i1 %cond, label %for.body, label %for.end51 52for.end:53  ret void54 55; CHECK: LV: Creating an interleave group with:  store i32 %tmp3, ptr %tmp0, align 456; CHECK: LV: Inserted:  store i32 %tmp1, ptr %tmp2, align 457; CHECK:     into the interleave group with  store i32 %tmp3, ptr %tmp0, align 458; CHECK: LV: Creating an interleave group with:  %tmp3 = load i32, ptr %tmp2, align 459; CHECK: LV: Inserted:  %tmp1 = load i32, ptr %tmp0, align 460; CHECK:     into the interleave group with  %tmp3 = load i32, ptr %tmp2, align 461 62; CHECK: LV: Found an estimated cost of 4 for VF 4 For instruction:   %tmp1 = load i32, ptr %tmp0, align 463; CHECK: LV: Found an estimated cost of 0 for VF 4 For instruction:   %tmp3 = load i32, ptr %tmp2, align 464;            (vl; vl; vperm, vpkg)65 66; CHECK: LV: Found an estimated cost of 0 for VF 4 For instruction:   store i32 %tmp1, ptr %tmp2, align 467; CHECK: LV: Found an estimated cost of 4 for VF 4 For instruction:   store i32 %tmp3, ptr %tmp0, align 468;            (vmrlf; vmrhf; vst; vst)69}70 71