1; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -O1 < %s | FileCheck -check-prefix=OPT %s
2; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -passes='default<O1>' < %s | FileCheck -check-prefix=OPT %s
3; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck -check-prefix=LLC %s
4; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1100 -verify-machineinstrs < %s | FileCheck -check-prefix=LLC %s
5
6; OPT: declare void @foo4() local_unnamed_addr #0
7; OPT: define void @foo3() local_unnamed_addr #1
8; OPT: define void @foo2() local_unnamed_addr #1
9; OPT: define void @foo1() local_unnamed_addr #1
10; OPT: define amdgpu_kernel void @kernel1() local_unnamed_addr #2
11; OPT: define amdgpu_kernel void @kernel2() local_unnamed_addr #2
12; OPT: attributes #0 = { {{.*}} "target-features"="+wavefrontsize64" }
13; OPT: attributes #1 = { {{.*}} "target-features"="{{.*}},-wavefrontsize16,+wavefrontsize32,-wavefrontsize64
14; OPT: attributes #2 = { {{.*}} "target-features"="+wavefrontsize32
15; OPT: attributes #3 = { nounwind }
16
17; LLC: foo3:
18; LLC: sample asm
19; LLC: foo2:
20; LLC: sample asm
21; LLC: foo1:
22; LLC: foo4@gotpcrel32@lo+4
23; LLC: foo4@gotpcrel32@hi+12
24; LLC: foo3@gotpcrel32@lo+4
25; LLC: foo3@gotpcrel32@hi+12
26; LLC: foo2@gotpcrel32@lo+4
27; LLC: foo2@gotpcrel32@hi+12
28; LLC: foo1@gotpcrel32@lo+4
29; LLC: foo1@gotpcrel32@hi+12
30; LLC: kernel1:
31; LLC: foo1@gotpcrel32@lo+4
32; LLC: foo1@gotpcrel32@hi+12
33; LLC: kernel2:
34; LLC: foo2@gotpcrel32@lo+4
35; LLC: foo2@gotpcrel32@hi+12
36
37declare void @foo4() #1
38
39define void @foo3() #1 {
40entry:
41  call void asm sideeffect "; sample asm", ""()
42  ret void
43}
44
45define void @foo2() #1 {
46entry:
47  call void asm sideeffect "; sample asm", ""()
48  ret void
49}
50
51define void @foo1() #1 {
52entry:
53  tail call void @foo4()
54  tail call void @foo3()
55  tail call void @foo2()
56  tail call void @foo2()
57  tail call void @foo1()
58  ret void
59}
60
61define amdgpu_kernel void @kernel1() #0 {
62entry:
63  tail call void @foo1()
64  ret void
65}
66
67define amdgpu_kernel void @kernel2() #0 {
68entry:
69  tail call void @foo2()
70  ret void
71}
72
73attributes #0 = { nounwind "target-features"="+wavefrontsize32" }
74attributes #1 = { noinline nounwind "target-features"="+wavefrontsize64" }
75