1 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z14 -prefetch-distance=100 \
2 ; RUN: -stop-after=loop-data-prefetch | FileCheck %s -check-prefix=FAR-PREFETCH
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z14 -prefetch-distance=20 \
4 ; RUN: -stop-after=loop-data-prefetch | FileCheck %s -check-prefix=NEAR-PREFETCH
6 ; Check that prefetches are not emitted when the known constant trip count of
7 ; the loop is smaller than the estimated "iterations ahead" of the prefetch.
9 ; FAR-PREFETCH-LABEL: fun
10 ; FAR-PREFETCH-NOT: call void @llvm.prefetch
12 ; NEAR-PREFETCH-LABEL: fun
13 ; NEAR-PREFETCH: call void @llvm.prefetch
16 define void @fun(ptr nocapture %Src, ptr nocapture readonly %Dst) {
20 for.cond.cleanup: ; preds = %for.body
23 for.body: ; preds = %for.body, %entry
24 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.9, %for.body ]
25 %arrayidx = getelementptr inbounds i32, ptr %Dst, i64 %indvars.iv
26 %0 = load i32, ptr %arrayidx, align 4
27 %arrayidx2 = getelementptr inbounds i32, ptr %Src, i64 %indvars.iv
28 store i32 %0, ptr %arrayidx2, align 4
29 %indvars.iv.next.9 = add nuw nsw i64 %indvars.iv, 1600
30 %cmp.9 = icmp ult i64 %indvars.iv.next.9, 11200
31 br i1 %cmp.9, label %for.body, label %for.cond.cleanup