[ARM] Better OR's for MVE compares
[llvm-core.git] / test / MC / AMDGPU / sopp.s
blob4be9323741157f714708b9392e97dbebc31dec50
1 // RUN: not llvm-mc -arch=amdgcn -show-encoding %s | FileCheck --check-prefix=GCN --check-prefix=SICI %s
2 // RUN: not llvm-mc -arch=amdgcn -show-encoding %s 2>&1 | FileCheck %s --check-prefix=NOSICI
3 // RUN: llvm-mc -arch=amdgcn -mcpu=fiji -show-encoding %s | FileCheck --check-prefix=GCN --check-prefix=VI %s
5 //===----------------------------------------------------------------------===//
6 // Edge Cases
7 //===----------------------------------------------------------------------===//
9 s_nop 0
10 // GCN: s_nop 0 ; encoding: [0x00,0x00,0x80,0xbf]
12 s_nop 0xffff
13 // GCN: s_nop 0xffff ; encoding: [0xff,0xff,0x80,0xbf]
15 //===----------------------------------------------------------------------===//
16 // Instructions
17 //===----------------------------------------------------------------------===//
19 s_nop 1
20 // GCN: s_nop 1 ; encoding: [0x01,0x00,0x80,0xbf]
22 s_endpgm
23 // GCN: s_endpgm ; encoding: [0x00,0x00,0x81,0xbf]
25 s_branch 2
26 // GCN: s_branch 2 ; encoding: [0x02,0x00,0x82,0xbf]
28 s_cbranch_scc0 3
29 // GCN: s_cbranch_scc0 3 ; encoding: [0x03,0x00,0x84,0xbf]
31 s_cbranch_scc1 4
32 // GCN: s_cbranch_scc1 4 ; encoding: [0x04,0x00,0x85,0xbf]
34 s_cbranch_vccz 5
35 // GCN: s_cbranch_vccz 5 ; encoding: [0x05,0x00,0x86,0xbf]
37 s_cbranch_vccnz 6
38 // GCN: s_cbranch_vccnz 6 ; encoding: [0x06,0x00,0x87,0xbf]
40 s_cbranch_execz 7
41 // GCN: s_cbranch_execz 7 ; encoding: [0x07,0x00,0x88,0xbf]
43 s_cbranch_execnz 8
44 // GCN: s_cbranch_execnz 8 ; encoding: [0x08,0x00,0x89,0xbf]
46 s_cbranch_cdbgsys 9
47 // GCN: s_cbranch_cdbgsys 9 ; encoding: [0x09,0x00,0x97,0xbf]
49 s_cbranch_cdbgsys_and_user 10
50 // GCN: s_cbranch_cdbgsys_and_user 10 ; encoding: [0x0a,0x00,0x9a,0xbf]
52 s_cbranch_cdbgsys_or_user 11
53 // GCN: s_cbranch_cdbgsys_or_user 11 ; encoding: [0x0b,0x00,0x99,0xbf]
55 s_cbranch_cdbguser 12
56 // GCN: s_cbranch_cdbguser 12 ; encoding: [0x0c,0x00,0x98,0xbf]
58 s_barrier
59 // GCN: s_barrier ; encoding: [0x00,0x00,0x8a,0xbf]
61 //===----------------------------------------------------------------------===//
62 // s_waitcnt
63 //===----------------------------------------------------------------------===//
65 s_waitcnt 0
66 // GCN: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) ; encoding: [0x00,0x00,0x8c,0xbf]
68 s_waitcnt vmcnt(0) & expcnt(0) & lgkmcnt(0)
69 // GCN: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) ; encoding: [0x00,0x00,0x8c,0xbf]
71 s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
72 // GCN: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) ; encoding: [0x00,0x00,0x8c,0xbf]
74 s_waitcnt vmcnt(0), expcnt(0), lgkmcnt(0)
75 // GCN: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) ; encoding: [0x00,0x00,0x8c,0xbf]
77 s_waitcnt vmcnt(1)
78 // GCN: s_waitcnt vmcnt(1) ; encoding: [0x71,0x0f,0x8c,0xbf]
80 s_waitcnt vmcnt(9)
81 // GCN: s_waitcnt vmcnt(9) ; encoding: [0x79,0x0f,0x8c,0xbf]
83 s_waitcnt vmcnt(15)
84 // GCN: s_waitcnt ; encoding: [0x7f,0x0f,0x8c,0xbf]
86 s_waitcnt vmcnt_sat(9)
87 // GCN: s_waitcnt vmcnt(9) ; encoding: [0x79,0x0f,0x8c,0xbf]
89 s_waitcnt vmcnt_sat(15)
90 // GCN: s_waitcnt ; encoding: [0x7f,0x0f,0x8c,0xbf]
92 s_waitcnt vmcnt_sat(16)
93 // GCN: s_waitcnt ; encoding: [0x7f,0x0f,0x8c,0xbf]
95 s_waitcnt expcnt(2)
96 // GCN: s_waitcnt expcnt(2) ; encoding: [0x2f,0x0f,0x8c,0xbf]
98 s_waitcnt expcnt(7)
99 // GCN: s_waitcnt ; encoding: [0x7f,0x0f,0x8c,0xbf]
101 s_waitcnt expcnt_sat(2)
102 // GCN: s_waitcnt expcnt(2) ; encoding: [0x2f,0x0f,0x8c,0xbf]
104 s_waitcnt expcnt_sat(7)
105 // GCN: s_waitcnt ; encoding: [0x7f,0x0f,0x8c,0xbf]
107 s_waitcnt expcnt_sat(0xFFFF0000)
108 // GCN: s_waitcnt ; encoding: [0x7f,0x0f,0x8c,0xbf]
110 s_waitcnt lgkmcnt(3)
111 // GCN: s_waitcnt lgkmcnt(3) ; encoding: [0x7f,0x03,0x8c,0xbf]
113 s_waitcnt lgkmcnt(9)
114 // GCN: s_waitcnt lgkmcnt(9) ; encoding: [0x7f,0x09,0x8c,0xbf]
116 s_waitcnt lgkmcnt(15)
117 // GCN: s_waitcnt ; encoding: [0x7f,0x0f,0x8c,0xbf]
119 s_waitcnt vmcnt(0), expcnt(0)
120 // GCN: s_waitcnt vmcnt(0) expcnt(0) ; encoding: [0x00,0x0f,0x8c,0xbf]
122 s_waitcnt lgkmcnt_sat(3)
123 // GCN: s_waitcnt lgkmcnt(3) ; encoding: [0x7f,0x03,0x8c,0xbf]
125 s_waitcnt lgkmcnt_sat(9)
126 // GCN: s_waitcnt lgkmcnt(9) ; encoding: [0x7f,0x09,0x8c,0xbf]
128 s_waitcnt lgkmcnt_sat(15)
129 // GCN: s_waitcnt ; encoding: [0x7f,0x0f,0x8c,0xbf]
131 s_waitcnt lgkmcnt_sat(16)
132 // GCN: s_waitcnt ; encoding: [0x7f,0x0f,0x8c,0xbf]
135 s_waitcnt lgkmcnt_sat(x+1)
136 // GCN: s_waitcnt lgkmcnt(2) ; encoding: [0x7f,0x02,0x8c,0xbf]
138 s_waitcnt lgkmcnt_sat(1+x)
139 // GCN: s_waitcnt lgkmcnt(2) ; encoding: [0x7f,0x02,0x8c,0xbf]
141 s_waitcnt x+1
142 // GCN: s_waitcnt vmcnt(2) expcnt(0) lgkmcnt(0) ; encoding: [0x02,0x00,0x8c,0xbf]
144 s_waitcnt 1+x
145 // GCN: s_waitcnt vmcnt(2) expcnt(0) lgkmcnt(0) ; encoding: [0x02,0x00,0x8c,0xbf]
147 lgkmcnt_sat=1
148 s_waitcnt lgkmcnt_sat
149 // GCN: s_waitcnt vmcnt(1) expcnt(0) lgkmcnt(0) ; encoding: [0x01,0x00,0x8c,0xbf]
151 s_waitcnt lgkmcnt_sat+1
152 // GCN: s_waitcnt vmcnt(2) expcnt(0) lgkmcnt(0) ; encoding: [0x02,0x00,0x8c,0xbf]
154 //===----------------------------------------------------------------------===//
155 // misc sopp instructions
156 //===----------------------------------------------------------------------===//
158 s_sethalt 9
159 // GCN: s_sethalt 9 ; encoding: [0x09,0x00,0x8d,0xbf]
161 s_setkill 7
162 // GCN: s_setkill 7 ; encoding: [0x07,0x00,0x8b,0xbf]
164 s_sleep 10
165 // GCN: s_sleep 10 ; encoding: [0x0a,0x00,0x8e,0xbf]
167 s_setprio 1
168 // GCN: s_setprio 1 ; encoding: [0x01,0x00,0x8f,0xbf]
170 //===----------------------------------------------------------------------===//
171 // s_sendmsg
172 //===----------------------------------------------------------------------===//
174 s_sendmsg 0x1
175 // GCN: s_sendmsg sendmsg(MSG_INTERRUPT) ; encoding: [0x01,0x00,0x90,0xbf]
177 s_sendmsg sendmsg(1)
178 // GCN: s_sendmsg sendmsg(MSG_INTERRUPT) ; encoding: [0x01,0x00,0x90,0xbf]
180 s_sendmsg sendmsg(MSG_INTERRUPT)
181 // GCN: s_sendmsg sendmsg(MSG_INTERRUPT) ; encoding: [0x01,0x00,0x90,0xbf]
183 s_sendmsg 0x12
184 // GCN: s_sendmsg sendmsg(MSG_GS, GS_OP_CUT, 0) ; encoding: [0x12,0x00,0x90,0xbf]
186 s_sendmsg sendmsg(2, 1)
187 // GCN: s_sendmsg sendmsg(MSG_GS, GS_OP_CUT, 0) ; encoding: [0x12,0x00,0x90,0xbf]
189 s_sendmsg sendmsg(2, GS_OP_CUT)
190 // GCN: s_sendmsg sendmsg(MSG_GS, GS_OP_CUT, 0) ; encoding: [0x12,0x00,0x90,0xbf]
192 s_sendmsg sendmsg(MSG_GS, GS_OP_CUT)
193 // GCN: s_sendmsg sendmsg(MSG_GS, GS_OP_CUT, 0) ; encoding: [0x12,0x00,0x90,0xbf]
195 s_sendmsg sendmsg(MSG_GS, GS_OP_CUT, 0)
196 // GCN: s_sendmsg sendmsg(MSG_GS, GS_OP_CUT, 0) ; encoding: [0x12,0x00,0x90,0xbf]
198 s_sendmsg sendmsg(MSG_GS, 1)
199 // GCN: s_sendmsg sendmsg(MSG_GS, GS_OP_CUT, 0) ; encoding: [0x12,0x00,0x90,0xbf]
201 s_sendmsg sendmsg(MSG_GS, 1, 1)
202 // GCN: s_sendmsg sendmsg(MSG_GS, GS_OP_CUT, 1) ; encoding: [0x12,0x01,0x90,0xbf]
204 s_sendmsg 0x122
205 // GCN: s_sendmsg sendmsg(MSG_GS, GS_OP_EMIT, 1) ; encoding: [0x22,0x01,0x90,0xbf]
207 s_sendmsg sendmsg(2, 2, 1)
208 // GCN: s_sendmsg sendmsg(MSG_GS, GS_OP_EMIT, 1) ; encoding: [0x22,0x01,0x90,0xbf]
210 s_sendmsg sendmsg(MSG_GS, GS_OP_EMIT, 1)
211 // GCN: s_sendmsg sendmsg(MSG_GS, GS_OP_EMIT, 1) ; encoding: [0x22,0x01,0x90,0xbf]
213 s_sendmsg 0x232
214 // GCN: s_sendmsg sendmsg(MSG_GS, GS_OP_EMIT_CUT, 2) ; encoding: [0x32,0x02,0x90,0xbf]
216 s_sendmsg sendmsg(2, 3, 2)
217 // GCN: s_sendmsg sendmsg(MSG_GS, GS_OP_EMIT_CUT, 2) ; encoding: [0x32,0x02,0x90,0xbf]
219 s_sendmsg sendmsg(MSG_GS, GS_OP_EMIT_CUT, 2)
220 // GCN: s_sendmsg sendmsg(MSG_GS, GS_OP_EMIT_CUT, 2) ; encoding: [0x32,0x02,0x90,0xbf]
222 s_sendmsg 0x3
223 // GCN: s_sendmsg sendmsg(MSG_GS_DONE, GS_OP_NOP) ; encoding: [0x03,0x00,0x90,0xbf]
225 s_sendmsg sendmsg(3, 0)
226 // GCN: s_sendmsg sendmsg(MSG_GS_DONE, GS_OP_NOP) ; encoding: [0x03,0x00,0x90,0xbf]
228 s_sendmsg sendmsg(MSG_GS_DONE, GS_OP_NOP)
229 // GCN: s_sendmsg sendmsg(MSG_GS_DONE, GS_OP_NOP) ; encoding: [0x03,0x00,0x90,0xbf]
231 s_sendmsg 0x1f
232 // GCN: s_sendmsg sendmsg(MSG_SYSMSG, SYSMSG_OP_ECC_ERR_INTERRUPT) ; encoding: [0x1f,0x00,0x90,0xbf]
234 s_sendmsg sendmsg(15, 1)
235 // GCN: s_sendmsg sendmsg(MSG_SYSMSG, SYSMSG_OP_ECC_ERR_INTERRUPT) ; encoding: [0x1f,0x00,0x90,0xbf]
237 s_sendmsg sendmsg(MSG_SYSMSG, SYSMSG_OP_ECC_ERR_INTERRUPT)
238 // GCN: s_sendmsg sendmsg(MSG_SYSMSG, SYSMSG_OP_ECC_ERR_INTERRUPT) ; encoding: [0x1f,0x00,0x90,0xbf]
240 s_sendmsghalt 3
241 // GCN: s_sendmsghalt sendmsg(MSG_GS_DONE, GS_OP_NOP) ; encoding: [0x03,0x00,0x91,0xbf]
243 s_sendmsghalt sendmsg(MSG_GS, GS_OP_EMIT, 1)
244 // GCN: s_sendmsghalt sendmsg(MSG_GS, GS_OP_EMIT, 1) ; encoding: [0x22,0x01,0x91,0xbf]
246 //===----------------------------------------------------------------------===//
247 // s_sendmsg with a numeric message id (no validation)
248 //===----------------------------------------------------------------------===//
250 s_sendmsg 2
251 // GCN: s_sendmsg sendmsg(2, 0, 0) ; encoding: [0x02,0x00,0x90,0xbf]
253 s_sendmsg 0x4
254 // GCN: s_sendmsg sendmsg(4, 0, 0) ; encoding: [0x04,0x00,0x90,0xbf]
256 s_sendmsg 9
257 // GCN: s_sendmsg sendmsg(9, 0, 0) ; encoding: [0x09,0x00,0x90,0xbf]
259 s_sendmsg 11
260 // GCN: s_sendmsg sendmsg(11, 0, 0) ; encoding: [0x0b,0x00,0x90,0xbf]
262 s_sendmsg 0x6f
263 // GCN: s_sendmsg sendmsg(15, 6, 0) ; encoding: [0x6f,0x00,0x90,0xbf]
265 s_sendmsg sendmsg(1, 3)
266 // GCN: s_sendmsg sendmsg(1, 3, 0) ; encoding: [0x31,0x00,0x90,0xbf]
268 s_sendmsg sendmsg(1, 3, 2)
269 // GCN: s_sendmsg sendmsg(1, 3, 2) ; encoding: [0x31,0x02,0x90,0xbf]
271 s_sendmsg sendmsg(2, 0, 1)
272 // GCN: s_sendmsg sendmsg(2, 0, 1) ; encoding: [0x02,0x01,0x90,0xbf]
274 s_sendmsg sendmsg(15, 7, 3)
275 // GCN: s_sendmsg sendmsg(15, 7, 3) ; encoding: [0x7f,0x03,0x90,0xbf]
277 s_sendmsg 4567
278 // GCN: s_sendmsg 4567 ; encoding: [0xd7,0x11,0x90,0xbf]
280 //===----------------------------------------------------------------------===//
281 // s_sendmsg with expressions
282 //===----------------------------------------------------------------------===//
284 sendmsg=2
285 s_sendmsg sendmsg
286 // GCN: s_sendmsg sendmsg(2, 0, 0) ; encoding: [0x02,0x00,0x90,0xbf]
288 sendmsg=1
289 s_sendmsg sendmsg+1
290 // GCN: s_sendmsg sendmsg(2, 0, 0) ; encoding: [0x02,0x00,0x90,0xbf]
292 s_sendmsg 1+sendmsg
293 // GCN: s_sendmsg sendmsg(2, 0, 0) ; encoding: [0x02,0x00,0x90,0xbf]
295 msg=1
296 s_sendmsg sendmsg(msg)
297 // GCN: s_sendmsg sendmsg(MSG_INTERRUPT) ; encoding: [0x01,0x00,0x90,0xbf]
299 msg=0
300 s_sendmsg sendmsg(msg+1)
301 // GCN: s_sendmsg sendmsg(MSG_INTERRUPT) ; encoding: [0x01,0x00,0x90,0xbf]
303 msg=0
304 s_sendmsg sendmsg(1+msg)
305 // GCN: s_sendmsg sendmsg(MSG_INTERRUPT) ; encoding: [0x01,0x00,0x90,0xbf]
307 msg=2
308 op=1
309 s_sendmsg sendmsg(msg, op)
310 // GCN: s_sendmsg sendmsg(MSG_GS, GS_OP_CUT, 0) ; encoding: [0x12,0x00,0x90,0xbf]
312 msg=1
313 op=0
314 s_sendmsg sendmsg(msg+1, op+1)
315 // GCN: s_sendmsg sendmsg(MSG_GS, GS_OP_CUT, 0) ; encoding: [0x12,0x00,0x90,0xbf]
317 msg=1
318 op=0
319 s_sendmsg sendmsg(1+msg, 1+op)
320 // GCN: s_sendmsg sendmsg(MSG_GS, GS_OP_CUT, 0) ; encoding: [0x12,0x00,0x90,0xbf]
322 msg=1
323 op=2
324 stream=1
325 s_sendmsg sendmsg(msg+1, op+1, stream+1)
326 // GCN: s_sendmsg sendmsg(MSG_GS, GS_OP_EMIT_CUT, 2) ; encoding: [0x32,0x02,0x90,0xbf]
328 msg=1
329 op=2
330 stream=1
331 s_sendmsg sendmsg(1+msg, 1+op, 1+stream)
332 // GCN: s_sendmsg sendmsg(MSG_GS, GS_OP_EMIT_CUT, 2) ; encoding: [0x32,0x02,0x90,0xbf]
334 MSG_GS=-1
335 GS_OP_EMIT=-1
336 s_sendmsghalt sendmsg(MSG_GS, GS_OP_EMIT, 1)
337 // GCN: s_sendmsghalt sendmsg(MSG_GS, GS_OP_EMIT, 1) ; encoding: [0x22,0x01,0x91,0xbf]
339 //===----------------------------------------------------------------------===//
340 // misc sopp instructions
341 //===----------------------------------------------------------------------===//
343 s_trap 4
344 // GCN: s_trap 4 ; encoding: [0x04,0x00,0x92,0xbf]
346 s_icache_inv
347 // GCN: s_icache_inv ; encoding: [0x00,0x00,0x93,0xbf]
349 s_incperflevel 5
350 // GCN: s_incperflevel 5 ; encoding: [0x05,0x00,0x94,0xbf]
352 s_decperflevel 6
353 // GCN: s_decperflevel 6 ; encoding: [0x06,0x00,0x95,0xbf]
355 s_ttracedata
356 // GCN: s_ttracedata ; encoding: [0x00,0x00,0x96,0xbf]
358 s_set_gpr_idx_off
359 // VI: s_set_gpr_idx_off ; encoding: [0x00,0x00,0x9c,0xbf]
360 // NOSICI: error:
362 s_set_gpr_idx_mode 0
363 // VI: s_set_gpr_idx_mode gpr_idx() ; encoding: [0x00,0x00,0x9d,0xbf]
364 // NOSICI: error:
366 s_set_gpr_idx_mode gpr_idx()
367 // VI: s_set_gpr_idx_mode gpr_idx() ; encoding: [0x00,0x00,0x9d,0xbf]
368 // NOSICI: error:
370 s_set_gpr_idx_mode 15
371 // VI: s_set_gpr_idx_mode gpr_idx(SRC0,SRC1,SRC2,DST) ; encoding: [0x0f,0x00,0x9d,0xbf]
372 // NOSICI: error:
374 s_set_gpr_idx_mode gpr_idx(SRC2,SRC1,SRC0,DST)
375 // VI: s_set_gpr_idx_mode gpr_idx(SRC0,SRC1,SRC2,DST) ; encoding: [0x0f,0x00,0x9d,0xbf]
376 // NOSICI: error:
378 s_endpgm_saved
379 // VI: s_endpgm_saved ; encoding: [0x00,0x00,0x9b,0xbf]
380 // NOSICI: error: instruction not supported on this GPU
382 s_wakeup
383 // VI: s_wakeup ; encoding: [0x00,0x00,0x83,0xbf]
384 // NOSICI: error: instruction not supported on this GPU
386 //===----------------------------------------------------------------------===//
387 // absolute expressions as branch offsets
388 //===----------------------------------------------------------------------===//
390 offset = 3
391 s_branch 1+offset
392 // GCN: s_branch 4 ; encoding: [0x04,0x00,0x82,0xbf]
394 offset = 3
395 s_branch offset+1
396 // GCN: s_branch 4 ; encoding: [0x04,0x00,0x82,0xbf]