1; RUN: opt -mcpu=cyclone -mtriple=arm64-apple-ios -loop-data-prefetch -max-prefetch-iters-ahead=100 -S < %s | FileCheck %s --check-prefix=LARGE_PREFETCH --check-prefix=ALL 2; RUN: opt -mcpu=cyclone -mtriple=arm64-apple-ios -loop-data-prefetch -S < %s | FileCheck %s --check-prefix=NO_LARGE_PREFETCH --check-prefix=ALL 3; RUN: opt -mcpu=generic -mtriple=arm64-apple-ios -loop-data-prefetch -S < %s | FileCheck %s --check-prefix=NO_LARGE_PREFETCH --check-prefix=ALL 4; RUN: opt -mcpu=cyclone -mtriple=arm64-apple-ios -passes=loop-data-prefetch -max-prefetch-iters-ahead=100 -S < %s | FileCheck %s --check-prefix=LARGE_PREFETCH --check-prefix=ALL 5; RUN: opt -mcpu=cyclone -mtriple=arm64-apple-ios -passes=loop-data-prefetch -S < %s | FileCheck %s --check-prefix=NO_LARGE_PREFETCH --check-prefix=ALL 6; RUN: opt -mcpu=generic -mtriple=arm64-apple-ios -passes=loop-data-prefetch -S < %s | FileCheck %s --check-prefix=NO_LARGE_PREFETCH --check-prefix=ALL 7 8target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-n32:64-S128" 9 10; ALL-LABEL: @small_stride( 11define void @small_stride(double* nocapture %a, double* nocapture readonly %b) { 12entry: 13 br label %for.body 14 15; ALL: for.body: 16for.body: ; preds = %for.body, %entry 17 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] 18 %arrayidx = getelementptr inbounds double, double* %b, i64 %indvars.iv 19; ALL-NOT: call void @llvm.prefetch 20 %0 = load double, double* %arrayidx, align 8 21 %add = fadd double %0, 1.000000e+00 22 %arrayidx2 = getelementptr inbounds double, double* %a, i64 %indvars.iv 23 store double %add, double* %arrayidx2, align 8 24 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 25 %exitcond = icmp eq i64 %indvars.iv.next, 1600 26 br i1 %exitcond, label %for.end, label %for.body 27 28; ALL: for.end: 29for.end: ; preds = %for.body 30 ret void 31} 32 33; ALL-LABEL: @large_stride( 34define void @large_stride(double* nocapture %a, double* nocapture readonly %b) { 35entry: 36 br label %for.body 37 38; ALL: for.body: 39for.body: ; preds = %for.body, %entry 40 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] 41 %arrayidx = getelementptr inbounds double, double* %b, i64 %indvars.iv 42; LARGE_PREFETCH: call void @llvm.prefetch 43; NO_LARGE_PREFETCH-NOT: call void @llvm.prefetch 44 %0 = load double, double* %arrayidx, align 8 45 %add = fadd double %0, 1.000000e+00 46 %arrayidx2 = getelementptr inbounds double, double* %a, i64 %indvars.iv 47 store double %add, double* %arrayidx2, align 8 48 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 300 49 %exitcond = icmp eq i64 %indvars.iv.next, 160000 50 br i1 %exitcond, label %for.end, label %for.body 51 52; ALL: for.end: 53for.end: ; preds = %for.body 54 ret void 55} 56