xref: /llvm-project/llvm/test/CodeGen/PowerPC/ppc64-func-desc-hoist.ll (revision 5403c59c608c08c8ecd4303763f08eb046eb5e4d)
1; RUN: llc -verify-machineinstrs -mcpu=a2 < %s | FileCheck %s -check-prefix=INVFUNCDESC
2; RUN: llc -verify-machineinstrs -mcpu=a2 -mattr=-invariant-function-descriptors < %s | FileCheck %s -check-prefix=NONINVFUNCDESC
3target datalayout = "E-m:e-i64:64-n32:64"
4target triple = "powerpc64-unknown-linux-gnu"
5
6; Function Attrs: nounwind
7define void @bar(ptr nocapture %x) #0 {
8entry:
9  br label %for.body
10
11; INVFUNCDESC-LABEL: @bar
12; INVFUNCDESC-DAG: ld [[REG1:[0-9]+]], 8(3)
13; INVFUNCDESC-DAG: ld [[REG2:[0-9]+]], 16(3)
14; INVFUNCDESC-DAG: ld [[REG3:[0-9]+]], 0(3)
15
16; INVFUNCDESC: %for.body
17; INVFUNCDESC-DAG: mtctr [[REG3]]
18; INVFUNCDESC-DAG: mr 11, [[REG2]]
19; INVFUNCDESC-DAG: mr 2, [[REG1]]
20; INVFUNCDESC: bctrl
21; INVFUNCDESC-NEXT: ld 2, 40(1)
22
23; NONINVFUNCDESC-LABEL: @bar
24; NONINVFUNCDESC: %for.body
25; NONINVFUNCDESC-DAG: ld 3, 0(30)
26; NONINVFUNCDESC-DAG: ld 11, 16(30)
27; NONINVFUNCDESC-DAG: ld 2, 8(30)
28; NONINVFUNCDESC: mtctr 3
29; NONINVFUNCDESC: bctrl
30; NONINVFUNCDESC-NEXT: ld 2, 40(1)
31
32for.body:                                         ; preds = %for.body, %entry
33  %i.02 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
34  tail call void %x() #0
35  %inc = add nuw nsw i32 %i.02, 1
36  %exitcond = icmp eq i32 %inc, 1600000000
37  br i1 %exitcond, label %for.end, label %for.body
38
39for.end:                                          ; preds = %for.body
40  ret void
41}
42
43attributes #0 = { nounwind }
44
45