xref: /llvm-project/llvm/test/CodeGen/PowerPC/ppc64-pre-inc-no-extra-phi.ll (revision 5403c59c608c08c8ecd4303763f08eb046eb5e4d)
1; RUN: llc < %s -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr9 -verify-machineinstrs | FileCheck %s
2; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr9 -verify-machineinstrs | FileCheck %s
3; RUN: llc < %s -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr8 -verify-machineinstrs | FileCheck %s
4; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr8 -verify-machineinstrs | FileCheck %s
5
6@perm = local_unnamed_addr global [100 x i64] zeroinitializer, align 8
7
8define void @sort_basket() local_unnamed_addr {
9entry:
10  br label %while.cond
11
12while.cond:
13  %l.0 = phi i64 [ 0, %entry ], [ %inc, %while.cond ]
14  %arrayidx = getelementptr inbounds [100 x i64], ptr @perm, i64 0, i64 %l.0
15  %0 = load i64, ptr %arrayidx, align 8
16  %cmp = icmp sgt i64 %0, 0
17  %inc = add nuw nsw i64 %l.0, 1
18  br i1 %cmp, label %while.cond, label %while.end
19
20while.end:
21  store i64 0, ptr %arrayidx, align 8
22  ret void
23; CHECK-LABEL: sort_basket
24; CHECK: addi {{[0-9]+}}, {{[0-9]+}}, -8
25; CHECK-NOT: addi {{[0-9]+}}, {{[0-9]+}}, 8
26; CHECK: ldu {{[0-9]+}}, 8({{[0-9]+}})
27; CHECK-NOT: addi {{[0-9]+}}, {{[0-9]+}}, 8
28; CHECK: blr
29}
30
31