xref: /llvm-project/llvm/test/CodeGen/AMDGPU/remove-incompatible-functions.ll (revision 7bf1cb702bdbec4b054a65cb58244596e8cd4138)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -mtriple=amdgcn -mcpu=bonaire -stop-after=amdgpu-remove-incompatible-functions\
3; RUN:   -pass-remarks=amdgpu-remove-incompatible-functions < %s 2>%t | FileCheck -check-prefixes=GFX7,IR %s
4; RUN: FileCheck --check-prefix=WARN-GFX7 %s < %t
5; RUN: llc -mtriple=amdgcn -mcpu=bonaire -verify-machineinstrs < %s
6
7; RUN: llc -enable-new-pm -mtriple=amdgcn -mcpu=bonaire -stop-after=amdgpu-remove-incompatible-functions\
8; RUN:   -pass-remarks=amdgpu-remove-incompatible-functions < %s 2>%t | FileCheck -check-prefixes=GFX7,IR %s
9; RUN: FileCheck --check-prefix=WARN-GFX7 %s < %t
10
11; RUN: llc -mtriple=amdgcn -mcpu=fiji -stop-after=amdgpu-remove-incompatible-functions\
12; RUN:   -pass-remarks=amdgpu-remove-incompatible-functions < %s 2>%t | FileCheck -check-prefixes=GFX8,IR %s
13; RUN: FileCheck --check-prefix=WARN-GFX8 %s < %t
14; RUN: llc -mtriple=amdgcn -mcpu=fiji -verify-machineinstrs < %s
15
16; RUN: llc -enable-new-pm -mtriple=amdgcn -mcpu=fiji -stop-after=amdgpu-remove-incompatible-functions\
17; RUN:   -pass-remarks=amdgpu-remove-incompatible-functions < %s 2>%t | FileCheck -check-prefixes=GFX8,IR %s
18; RUN: FileCheck --check-prefix=WARN-GFX8 %s < %t
19
20; RUN: llc -mtriple=amdgcn -mcpu=gfx906 -stop-after=amdgpu-remove-incompatible-functions\
21; RUN:   -pass-remarks=amdgpu-remove-incompatible-functions < %s 2>%t | FileCheck -check-prefixes=GFX9,GFX906,IR %s
22; RUN: FileCheck --check-prefix=WARN-GFX906 %s < %t
23; RUN: llc -mtriple=amdgcn -mcpu=gfx906 -verify-machineinstrs < %s
24
25; RUN: llc -mtriple=amdgcn -mcpu=gfx90a -stop-after=amdgpu-remove-incompatible-functions\
26; RUN:   -pass-remarks=amdgpu-remove-incompatible-functions < %s 2>%t | FileCheck -check-prefixes=GFX9,GFX90A,IR %s
27; RUN: FileCheck --check-prefix=WARN-GFX90A %s < %t
28; RUN: llc -mtriple=amdgcn -mcpu=gfx90a -verify-machineinstrs < %s
29
30; RUN: llc -mtriple=amdgcn -mcpu=gfx1011 -stop-after=amdgpu-remove-incompatible-functions\
31; RUN:   -pass-remarks=amdgpu-remove-incompatible-functions < %s 2>%t | FileCheck -check-prefixes=GFX10,IR %s
32; RUN: FileCheck --check-prefix=WARN-GFX10 %s < %t
33; RUN: llc -mtriple=amdgcn -mcpu=gfx1011 -verify-machineinstrs < %s
34
35; RUN: llc -mtriple=amdgcn -mcpu=gfx1100 -stop-after=amdgpu-remove-incompatible-functions\
36; RUN:   -pass-remarks=amdgpu-remove-incompatible-functions < %s 2>%t | FileCheck -check-prefixes=GFX11,IR %s
37; RUN: FileCheck --check-prefix=WARN-GFX11 %s < %t
38; RUN: llc -mtriple=amdgcn -mcpu=gfx1100 -verify-machineinstrs < %s
39
40; Note: This test checks the IR, but also has a run line to codegen the file just to check we
41; do not crash when trying to select those functions.
42
43; WARN-GFX7: removing function 'needs_dpp': +dpp is not supported on the current target
44; WARN-GFX7: removing function 'needs_16bit_insts': +16-bit-insts is not supported on the current target
45; WARN-GFX7: removing function 'needs_gfx8_insts': +gfx8-insts is not supported on the current target
46; WARN-GFX7: removing function 'needs_gfx9_insts': +gfx9-insts is not supported on the current target
47; WARN-GFX7: removing function 'needs_gfx10_insts': +gfx10-insts is not supported on the current target
48; WARN-GFX7: removing function 'needs_gfx11_insts': +gfx11-insts is not supported on the current target
49; WARN-GFX7: removing function 'needs_dot1_insts': +dot1-insts is not supported on the current target
50; WARN-GFX7: removing function 'needs_dot2_insts': +dot2-insts is not supported on the current target
51; WARN-GFX7: removing function 'needs_dot3_insts': +dot3-insts is not supported on the current target
52; WARN-GFX7: removing function 'needs_dot4_insts': +dot4-insts is not supported on the current target
53; WARN-GFX7: removing function 'needs_dot5_insts': +dot5-insts is not supported on the current target
54; WARN-GFX7: removing function 'needs_dot6_insts': +dot6-insts is not supported on the current target
55; WARN-GFX7: removing function 'needs_dot7_insts': +dot7-insts is not supported on the current target
56; WARN-GFX7: removing function 'needs_dot8_insts': +dot8-insts is not supported on the current target
57; WARN-GFX7-NOT: not supported
58
59; WARN-GFX8: removing function 'needs_gfx9_insts': +gfx9-insts is not supported on the current target
60; WARN-GFX8: removing function 'needs_gfx10_insts': +gfx10-insts is not supported on the current target
61; WARN-GFX8: removing function 'needs_gfx11_insts': +gfx11-insts is not supported on the current target
62; WARN-GFX8: removing function 'needs_dot1_insts': +dot1-insts is not supported on the current target
63; WARN-GFX8: removing function 'needs_dot2_insts': +dot2-insts is not supported on the current target
64; WARN-GFX8: removing function 'needs_dot3_insts': +dot3-insts is not supported on the current target
65; WARN-GFX8: removing function 'needs_dot4_insts': +dot4-insts is not supported on the current target
66; WARN-GFX8: removing function 'needs_dot5_insts': +dot5-insts is not supported on the current target
67; WARN-GFX8: removing function 'needs_dot6_insts': +dot6-insts is not supported on the current target
68; WARN-GFX8: removing function 'needs_dot7_insts': +dot7-insts is not supported on the current target
69; WARN-GFX8: removing function 'needs_dot8_insts': +dot8-insts is not supported on the current target
70; WARN-GFX8-NOT: not supported
71
72; WARN-GFX906: removing function 'needs_gfx10_insts': +gfx10-insts is not supported on the current target
73; WARN-GFX906: removing function 'needs_gfx11_insts': +gfx11-insts is not supported on the current target
74; WARN-GFX906: removing function 'needs_dot3_insts': +dot3-insts is not supported on the current target
75; WARN-GFX906: removing function 'needs_dot4_insts': +dot4-insts is not supported on the current target
76; WARN-GFX906: removing function 'needs_dot5_insts': +dot5-insts is not supported on the current target
77; WARN-GFX906: removing function 'needs_dot6_insts': +dot6-insts is not supported on the current target
78; WARN-GFX906: removing function 'needs_dot8_insts': +dot8-insts is not supported on the current target
79; WARN-GFX906-NOT: not supported
80
81; WARN-GFX90A: removing function 'needs_gfx10_insts': +gfx10-insts is not supported on the current target
82; WARN-GFX90A: removing function 'needs_gfx11_insts': +gfx11-insts is not supported on the current target
83; WARN-GFX90A: removing function 'needs_dot8_insts': +dot8-insts is not supported on the current target
84; WARN-GFX90A-NOT: not supported
85
86; WARN-GFX10: removing function 'needs_gfx11_insts': +gfx11-insts is not supported on the current target
87; WARN-GFX10: removing function 'needs_dot3_insts': +dot3-insts is not supported on the current target
88; WARN-GFX10: removing function 'needs_dot4_insts': +dot4-insts is not supported on the current target
89; WARN-GFX10: removing function 'needs_dot8_insts': +dot8-insts is not supported on the current target
90; WARN-GFX10-NOT: not supported
91
92; WARN-GFX11: removing function 'needs_dot1_insts': +dot1-insts is not supported on the current target
93; WARN-GFX11: removing function 'needs_dot2_insts': +dot2-insts is not supported on the current target
94; WARN-GFX11: removing function 'needs_dot3_insts': +dot3-insts is not supported on the current target
95; WARN-GFX11: removing function 'needs_dot4_insts': +dot4-insts is not supported on the current target
96; WARN-GFX11: removing function 'needs_dot6_insts': +dot6-insts is not supported on the current target
97; WARN-GFX11-NOT: not supported
98
99; GFX7:   @GVRefs {{.*}} zeroinitializer
100; GFX8:   @GVRefs {{.*}} [ptr @needs_dpp, ptr @needs_16bit_insts, ptr @needs_gfx8_insts, ptr null, ptr null, ptr null, ptr null, ptr null, ptr null, ptr null, ptr null, ptr null, ptr null, ptr null]
101; GFX906: @GVRefs {{.*}} [ptr @needs_dpp, ptr @needs_16bit_insts, ptr @needs_gfx8_insts, ptr @needs_gfx9_insts, ptr null, ptr null, ptr @needs_dot1_insts, ptr @needs_dot2_insts, ptr null, ptr null, ptr null, ptr null, ptr @needs_dot7_insts, ptr null]
102; GFX90A: @GVRefs {{.*}} [ptr @needs_dpp, ptr @needs_16bit_insts, ptr @needs_gfx8_insts, ptr @needs_gfx9_insts, ptr null, ptr null, ptr @needs_dot1_insts, ptr @needs_dot2_insts, ptr @needs_dot3_insts, ptr @needs_dot4_insts, ptr @needs_dot5_insts, ptr @needs_dot6_insts, ptr @needs_dot7_insts, ptr null]
103; GFX10:  @GVRefs {{.*}} [ptr @needs_dpp, ptr @needs_16bit_insts, ptr @needs_gfx8_insts, ptr @needs_gfx9_insts, ptr @needs_gfx10_insts, ptr null, ptr @needs_dot1_insts, ptr @needs_dot2_insts, ptr null, ptr null, ptr @needs_dot5_insts, ptr @needs_dot6_insts, ptr @needs_dot7_insts, ptr null]
104; GFX11:  @GVRefs {{.*}} [ptr @needs_dpp, ptr @needs_16bit_insts, ptr @needs_gfx8_insts, ptr @needs_gfx9_insts, ptr @needs_gfx10_insts, ptr @needs_gfx11_insts, ptr null, ptr null, ptr null, ptr null, ptr @needs_dot5_insts, ptr null, ptr @needs_dot7_insts, ptr @needs_dot8_insts]
105@GVRefs = internal global [14 x ptr] [
106  ptr @needs_dpp,
107  ptr @needs_16bit_insts,
108  ptr @needs_gfx8_insts,
109  ptr @needs_gfx9_insts,
110  ptr @needs_gfx10_insts,
111  ptr @needs_gfx11_insts,
112  ptr @needs_dot1_insts,
113  ptr @needs_dot2_insts,
114  ptr @needs_dot3_insts,
115  ptr @needs_dot4_insts,
116  ptr @needs_dot5_insts,
117  ptr @needs_dot6_insts,
118  ptr @needs_dot7_insts,
119  ptr @needs_dot8_insts
120]
121
122; GFX7: @ConstantExpr = internal global i64 0
123@ConstantExpr = internal global i64 ptrtoint (ptr @needs_dpp to i64)
124
125define void @needs_dpp(ptr %out, ptr %in, i64 %a, i64 %b, i64 %c) #0 {
126entry:
127  %cmp = icmp eq i64 %a, 0
128  br i1 %cmp, label %if, label %else
129
130if:
131  %ld = load i64, ptr %in
132  br label %endif
133
134else:
135  %add = add i64 %a, %b
136  br label %endif
137
138endif:
139  %phi = phi i64 [%ld, %if], [%add, %else]
140  store i64 %phi, ptr %out
141  ret void
142}
143
144define void @needs_16bit_insts(ptr %out, ptr %in, i64 %a, i64 %b, i64 %c) #1 {
145entry:
146  %cmp = icmp eq i64 %a, 0
147  br i1 %cmp, label %if, label %else
148
149if:
150  %ld = load i64, ptr %in
151  br label %endif
152
153else:
154  %add = add i64 %a, %b
155  br label %endif
156
157endif:
158  %phi = phi i64 [%ld, %if], [%add, %else]
159  store i64 %phi, ptr %out
160  ret void
161}
162
163define void @needs_gfx8_insts(ptr %out, ptr %in, i64 %a, i64 %b, i64 %c) #2 {
164entry:
165  %cmp = icmp eq i64 %a, 0
166  br i1 %cmp, label %if, label %else
167
168if:
169  %ld = load i64, ptr %in
170  br label %endif
171
172else:
173  %add = add i64 %a, %b
174  br label %endif
175
176endif:
177  %phi = phi i64 [%ld, %if], [%add, %else]
178  store i64 %phi, ptr %out
179  ret void
180}
181
182define void @needs_gfx9_insts(ptr %out, ptr %in, i64 %a, i64 %b, i64 %c) #3 {
183entry:
184  %cmp = icmp eq i64 %a, 0
185  br i1 %cmp, label %if, label %else
186
187if:
188  %ld = load i64, ptr %in
189  br label %endif
190
191else:
192  %add = add i64 %a, %b
193  br label %endif
194
195endif:
196  %phi = phi i64 [%ld, %if], [%add, %else]
197  store i64 %phi, ptr %out
198  ret void
199}
200
201define void @needs_gfx10_insts(ptr %out, ptr %in, i64 %a, i64 %b, i64 %c) #4 {
202entry:
203  %cmp = icmp eq i64 %a, 0
204  br i1 %cmp, label %if, label %else
205
206if:
207  %ld = load i64, ptr %in
208  br label %endif
209
210else:
211  %add = add i64 %a, %b
212  br label %endif
213
214endif:
215  %phi = phi i64 [%ld, %if], [%add, %else]
216  store i64 %phi, ptr %out
217  ret void
218}
219
220define void @needs_gfx11_insts(ptr %out, ptr %in, i64 %a, i64 %b, i64 %c) #5 {
221entry:
222  %cmp = icmp eq i64 %a, 0
223  br i1 %cmp, label %if, label %else
224
225if:
226  %ld = load i64, ptr %in
227  br label %endif
228
229else:
230  %add = add i64 %a, %b
231  br label %endif
232
233endif:
234  %phi = phi i64 [%ld, %if], [%add, %else]
235  store i64 %phi, ptr %out
236  ret void
237}
238
239define void @needs_dot1_insts(ptr %out, ptr %in, i64 %a, i64 %b, i64 %c) #6 {
240  %add = add i64 %a, %b
241  store i64 %add, ptr %out
242  ret void
243}
244
245define void @needs_dot2_insts(ptr %out, ptr %in, i64 %a, i64 %b, i64 %c) #7 {
246  %add = add i64 %a, %b
247  store i64 %add, ptr %out
248  ret void
249}
250
251define void @needs_dot3_insts(ptr %out, ptr %in, i64 %a, i64 %b, i64 %c) #8 {
252  %add = add i64 %a, %b
253  store i64 %add, ptr %out
254  ret void
255}
256
257
258define void @needs_dot4_insts(ptr %out, ptr %in, i64 %a, i64 %b, i64 %c) #9 {
259  %add = add i64 %a, %b
260  store i64 %add, ptr %out
261  ret void
262}
263
264define void @needs_dot5_insts(ptr %out, ptr %in, i64 %a, i64 %b, i64 %c) #10 {
265  %add = add i64 %a, %b
266  store i64 %add, ptr %out
267  ret void
268}
269
270define void @needs_dot6_insts(ptr %out, ptr %in, i64 %a, i64 %b, i64 %c) #11 {
271  %add = add i64 %a, %b
272  store i64 %add, ptr %out
273  ret void
274}
275
276define void @needs_dot7_insts(ptr %out, ptr %in, i64 %a, i64 %b, i64 %c) #12 {
277  %add = add i64 %a, %b
278  store i64 %add, ptr %out
279  ret void
280}
281
282define void @needs_dot8_insts(ptr %out, ptr %in, i64 %a, i64 %b, i64 %c) #13 {
283  %add = add i64 %a, %b
284  store i64 %add, ptr %out
285  ret void
286}
287
288; IR: define void @caller(
289define void @caller(ptr %out, ptr %in, i64 %a, i64 %b, i64 %c) {
290  call void @needs_dpp(ptr %out, ptr %in, i64 %a, i64 %b, i64 %c)
291  call void @needs_16bit_insts(ptr %out, ptr %in, i64 %a, i64 %b, i64 %c)
292  call void @needs_gfx8_insts(ptr %out, ptr %in, i64 %a, i64 %b, i64 %c)
293  ; GFX111: call void @needs_gfx9_insts(c
294  call void @needs_gfx9_insts(ptr %out, ptr %in, i64 %a, i64 %b, i64 %c)
295  ; GFX111: call void @needs_gfx10_insts(
296  call void @needs_gfx10_insts(ptr %out, ptr %in, i64 %a, i64 %b, i64 %c)
297  call void @needs_gfx11_insts(ptr %out, ptr %in, i64 %a, i64 %b, i64 %c)
298  call void @needs_dot1_insts(ptr %out, ptr %in, i64 %a, i64 %b, i64 %c)
299  call void @needs_dot2_insts(ptr %out, ptr %in, i64 %a, i64 %b, i64 %c)
300  call void @needs_dot3_insts(ptr %out, ptr %in, i64 %a, i64 %b, i64 %c)
301  call void @needs_dot4_insts(ptr %out, ptr %in, i64 %a, i64 %b, i64 %c)
302  call void @needs_dot5_insts(ptr %out, ptr %in, i64 %a, i64 %b, i64 %c)
303  call void @needs_dot6_insts(ptr %out, ptr %in, i64 %a, i64 %b, i64 %c)
304  call void @needs_dot7_insts(ptr %out, ptr %in, i64 %a, i64 %b, i64 %c)
305  call void @needs_dot8_insts(ptr %out, ptr %in, i64 %a, i64 %b, i64 %c)
306  ret void
307}
308
309attributes #0 = { "target-features"="+dpp" }
310attributes #1 = { "target-features"="+16-bit-insts" }
311attributes #2 = { "target-features"="+gfx8-insts" }
312attributes #3 = { "target-features"="+gfx9-insts" }
313attributes #4 = { "target-features"="+gfx10-insts" }
314attributes #5 = { "target-features"="+gfx11-insts" }
315attributes #6 = { "target-features"="+dot1-insts" }
316attributes #7 = { "target-features"="+dot2-insts" }
317attributes #8 = { "target-features"="+dot3-insts" }
318attributes #9 = { "target-features"="+dot4-insts" }
319attributes #10 = { "target-features"="+dot5-insts" }
320attributes #11 = { "target-features"="+dot6-insts" }
321attributes #12 = { "target-features"="+dot7-insts" }
322attributes #13 = { "target-features"="+dot8-insts" }
323;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
324; GFX10: {{.*}}
325; GFX11: {{.*}}
326; GFX7: {{.*}}
327; GFX8: {{.*}}
328; GFX9: {{.*}}
329; GFX906: {{.*}}
330; GFX90A: {{.*}}
331; IR: {{.*}}
332