1 ; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -O1 < %s | FileCheck -check-prefixes=OPT,OPT-EXT %s
2 ; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -passes='default<O1>' < %s | FileCheck -check-prefixes=OPT,OPT-EXT %s
3 ; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -O1 --amdgpu-internalize-symbols < %s | FileCheck -check-prefixes=OPT,OPT-INT %s
4 ; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -passes='default<O1>' --amdgpu-internalize-symbols < %s | FileCheck -check-prefixes=OPT,OPT-INT %s
5 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck -check-prefix=LLC %s
7 ; OPT: declare void @foo4() local_unnamed_addr #0
8 ; OPT: define internal fastcc void @0() unnamed_addr #1
9 ; OPT-EXT: define void @foo3() local_unnamed_addr #1
10 ; OPT-INT: define internal fastcc void @foo3.2() unnamed_addr #1
11 ; OPT-EXT: define void @foo2() local_unnamed_addr #1
12 ; OPT-INT: define internal fastcc void @foo2.3() unnamed_addr #1
13 ; OPT-EXT: define void @foo1() local_unnamed_addr #1
14 ; OPT-EXT: tail call void @foo4()
15 ; OPT-EXT: tail call void @foo3()
16 ; OPT-EXT: tail call void @foo2()
17 ; OPT-EXT: tail call void @foo2()
18 ; OPT-EXT: tail call void @foo1()
19 ; OPT-EXT: tail call fastcc void @0()
20 ; OPT-INT: define internal fastcc void @foo1.1() unnamed_addr #1
21 ; OPT-INT: tail call void @foo4()
22 ; OPT-INT: tail call fastcc void @foo3.2()
23 ; OPT-INT: tail call fastcc void @foo2.3()
24 ; OPT-INT: tail call fastcc void @foo2.3()
25 ; OPT-INT: tail call fastcc void @foo1.1()
26 ; OPT-INT: tail call fastcc void @0()
28 ; OPT: define amdgpu_kernel void @kernel1() local_unnamed_addr #2
29 ; OPT-EXT: tail call fastcc void @foo1.1()
30 ; OPT-INT: tail call fastcc void @foo1()
32 ; OPT: define amdgpu_kernel void @kernel2() local_unnamed_addr #3
33 ; OPT-EXT: tail call void @foo2()
34 ; OPT-INT: tail call fastcc void @foo2.3()
36 ; OPT: define amdgpu_kernel void @kernel3() local_unnamed_addr #3
37 ; OPT-EXT: tail call void @foo1()
38 ; OPT-INT: tail call fastcc void @foo1.1()
40 ; OPT-EXT: define internal fastcc void @foo1.1() unnamed_addr #4
41 ; OPT-EXT: tail call void @foo4()
42 ; OPT-EXT: tail call fastcc void @foo3.2()
43 ; OPT-EXT: tail call fastcc void @foo2.3()
44 ; OPT-EXT: tail call fastcc void @foo2.3()
45 ; OPT-EXT: tail call fastcc void @foo1.1()
46 ; OPT-EXT: tail call fastcc void @1()
47 ; OPT-INT: define internal fastcc void @foo1() unnamed_addr #4
48 ; OPT-INT: tail call void @foo4()
49 ; OPT-INT: tail call fastcc void @foo3()
50 ; OPT-INT: tail call fastcc void @foo2()
51 ; OPT-INT: tail call fastcc void @foo2()
52 ; OPT-INT: tail call fastcc void @foo1()
53 ; OPT-INT: tail call fastcc void @1()
55 ; OPT: define internal fastcc void @1() unnamed_addr #4
56 ; OPT-EXT: define internal fastcc void @foo3.2() unnamed_addr #4
57 ; OPT-INT: define internal fastcc void @foo3() unnamed_addr #4
58 ; OPT-EXT: define internal fastcc void @foo2.3() unnamed_addr #4
59 ; OPT-INT: define internal fastcc void @foo2() unnamed_addr #4
60 ; OPT: attributes #0 = { {{.*}} "amdgpu-waves-per-eu"="1,1" "target-features"="+wavefrontsize64" }
61 ; OPT: attributes #1 = { {{.*}} "target-features"="{{.*}},-wavefrontsize16,-wavefrontsize32,+wavefrontsize64{{.*}}" }
62 ; OPT: attributes #2 = { {{.*}} "amdgpu-waves-per-eu"="2,4" "target-features"="+wavefrontsize32" }
63 ; OPT: attributes #3 = { {{.*}} "target-features"="+wavefrontsize64" }
64 ; OPT: attributes #4 = { {{.*}} "amdgpu-waves-per-eu"="2,4" "target-features"="{{.*}},-wavefrontsize16,+wavefrontsize32,-wavefrontsize64{{.*}}" }
71 ; LLC: foo4@gotpcrel32@lo+4
72 ; LLC: foo4@gotpcrel32@hi+12
73 ; LLC: foo3@gotpcrel32@lo+4
74 ; LLC: foo3@gotpcrel32@hi+12
75 ; LLC: foo2@gotpcrel32@lo+4
76 ; LLC: foo2@gotpcrel32@hi+12
77 ; LLC: foo1@gotpcrel32@lo+4
78 ; LLC: foo1@gotpcrel32@hi+12
79 ; LLC: __unnamed_1@gotpcrel32@lo+4
80 ; LLC: __unnamed_1@gotpcrel32@hi+12
82 ; LLC: foo1@gotpcrel32@lo+4
83 ; LLC: foo1@gotpcrel32@hi+12
85 ; LLC: foo2@gotpcrel32@lo+4
86 ; LLC: foo2@gotpcrel32@hi+12
88 ; LLC: foo1@gotpcrel32@lo+4
89 ; LLC: foo1@gotpcrel32@hi+12
91 declare void @foo4() #1
95 call void asm sideeffect "; sample asm", ""()
99 define void @foo3() #4 {
101 call void asm sideeffect "; sample asm", ""()
105 define void @foo2() #1 {
107 call void asm sideeffect "; sample asm", ""()
111 define void @foo1() #1 {
113 tail call void @foo4()
114 tail call void @foo3()
115 tail call void @foo2()
116 tail call void @foo2()
117 tail call void @foo1()
122 define amdgpu_kernel void @kernel1() #0 {
124 tail call void @foo1()
128 define amdgpu_kernel void @kernel2() #2 {
130 tail call void @foo2()
134 define amdgpu_kernel void @kernel3() #3 {
136 tail call void @foo1()
140 attributes #0 = { nounwind "target-features"="+wavefrontsize32" "amdgpu-waves-per-eu"="2,4" }
141 attributes #1 = { noinline nounwind "target-features"="+wavefrontsize64" "amdgpu-waves-per-eu"="1,1" }
142 attributes #2 = { nounwind "target-features"="+wavefrontsize64" }
143 attributes #3 = { nounwind "target-features"="+wavefrontsize64" }
144 attributes #4 = { noinline nounwind "target-features"="+wavefrontsize64" "amdgpu-waves-per-eu"="2,4" }