1*cee313d2SEric Christopher; RUN: opt -mcpu=a2 -loop-data-prefetch -S < %s | FileCheck %s
2*cee313d2SEric Christopher; RUN: opt -mcpu=a2 -passes=loop-data-prefetch -S < %s | FileCheck %s
3*cee313d2SEric Christophertarget datalayout = "E-m:e-i64:64-n32:64"
4*cee313d2SEric Christophertarget triple = "powerpc64-bgq-linux"
5*cee313d2SEric Christopher
6*cee313d2SEric Christopherdefine void @foo(double* nocapture %a, double* nocapture readonly %b) {
7*cee313d2SEric Christopherentry:
8*cee313d2SEric Christopher  br label %for.body
9*cee313d2SEric Christopher
10*cee313d2SEric Christopher; CHECK: for.body:
11*cee313d2SEric Christopherfor.body:                                         ; preds = %for.body, %entry
12*cee313d2SEric Christopher  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
13*cee313d2SEric Christopher  %arrayidx = getelementptr inbounds double, double* %b, i64 %indvars.iv
14*cee313d2SEric Christopher; CHECK: call void @llvm.prefetch
15*cee313d2SEric Christopher  %0 = load double, double* %arrayidx, align 8
16*cee313d2SEric Christopher  %add = fadd double %0, 1.000000e+00
17*cee313d2SEric Christopher  %arrayidx2 = getelementptr inbounds double, double* %a, i64 %indvars.iv
18*cee313d2SEric Christopher  store double %add, double* %arrayidx2, align 8
19*cee313d2SEric Christopher  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
20*cee313d2SEric Christopher  %exitcond = icmp eq i64 %indvars.iv.next, 1600
21*cee313d2SEric Christopher  br i1 %exitcond, label %for.end, label %for.body
22*cee313d2SEric Christopher
23*cee313d2SEric Christopher; CHECK: for.end:
24*cee313d2SEric Christopherfor.end:                                          ; preds = %for.body
25*cee313d2SEric Christopher  ret void
26*cee313d2SEric Christopher}
27