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