xref: /llvm-project/llvm/test/CodeGen/PowerPC/loop-prep-all.ll (revision 427fb35192f1f7bb694a5910b05abc5925a798b2)
1; RUN: llc -verify-machineinstrs < %s | FileCheck %s
2target datalayout = "E-m:e-i64:64-n32:64"
3target triple = "powerpc64-unknown-linux-gnu"
4
5; Function Attrs: nounwind
6define void @foo(ptr nocapture %x, ptr nocapture readonly %y) #0 {
7entry:
8  br label %for.body
9
10for.body:                                         ; preds = %for.body, %entry
11  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
12  %arrayidx = getelementptr inbounds double, ptr %y, i64 %indvars.iv
13  %0 = load double, ptr %arrayidx, align 8
14  %add = fadd double %0, 1.000000e+00
15  %arrayidx2 = getelementptr inbounds double, ptr %x, i64 %indvars.iv
16  store double %add, ptr %arrayidx2, align 8
17  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
18  %exitcond19 = icmp eq i64 %indvars.iv.next, 1600
19  br i1 %exitcond19, label %for.body7, label %for.body
20
21; CHECK-LABEL: @foo
22
23; CHECK-DAG: lfdu [[REG1:[0-9]+]], 8({{[0-9]+}})
24; CHECK-DAG: fadd [[REG2:[0-9]+]], [[REG1]], 0
25; CHECK-DAG: stfdu [[REG2]], 8({{[0-9]+}})
26; CHECK: bdnz
27
28; CHECK: blr
29
30for.cond.cleanup6:                                ; preds = %for.body7
31  ret void
32
33for.body7:                                        ; preds = %for.body, %for.body7
34  %i3.017 = phi i32 [ %inc9, %for.body7 ], [ 0, %for.body ]
35  tail call void @bar() #0
36  %inc9 = add nuw nsw i32 %i3.017, 1
37  %exitcond = icmp eq i32 %inc9, 1024
38  br i1 %exitcond, label %for.cond.cleanup6, label %for.body7
39}
40
41declare void @bar(...)
42
43attributes #0 = { nounwind }
44
45