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