1 // RUN
: not llvm-mc
-triple
=amdgcn
-show-encoding
%s | FileCheck
--check-prefixes
=GCN
,SI
%s
2 // RUN
: not llvm-mc
-triple
=amdgcn
%s
2>&1 | FileCheck
%s
--check-prefix
=NOSICI
--implicit-check-
not=error
:
3 // RUN
: llvm-mc
-triple
=amdgcn
-mcpu
=fiji
-show-encoding
%s | FileCheck
--check-prefixes
=GCN
,VI
%s
5 //===----------------------------------------------------------------------===//
7 //===----------------------------------------------------------------------===//
10 // GCN
: s_nop
0 ; encoding
: [0x00,0x00,0x80,0xbf]
13 // GCN
: s_nop
0xffff ; encoding
: [0xff,0xff,0x80,0xbf]
15 //===----------------------------------------------------------------------===//
17 //===----------------------------------------------------------------------===//
20 // GCN
: s_nop
1 ; encoding
: [0x01,0x00,0x80,0xbf]
23 // GCN
: s_endpgm ; encoding
: [0x00,0x00,0x81,0xbf]
26 // GCN
: s_endpgm
1 ; encoding
: [0x01,0x00,0x81,0xbf]
29 // GCN
: s_endpgm
65535 ; encoding
: [0xff,0xff,0x81,0xbf]
32 // GCN
: s_branch
2 ; encoding
: [0x02,0x00,0x82,0xbf]
35 // GCN
: s_cbranch_scc0
3 ; encoding
: [0x03,0x00,0x84,0xbf]
38 // GCN
: s_cbranch_scc1
4 ; encoding
: [0x04,0x00,0x85,0xbf]
41 // GCN
: s_cbranch_vccz
5 ; encoding
: [0x05,0x00,0x86,0xbf]
44 // GCN
: s_cbranch_vccnz
6 ; encoding
: [0x06,0x00,0x87,0xbf]
47 // GCN
: s_cbranch_execz
7 ; encoding
: [0x07,0x00,0x88,0xbf]
50 // GCN
: s_cbranch_execnz
8 ; encoding
: [0x08,0x00,0x89,0xbf]
53 // GCN
: s_cbranch_cdbgsys
9 ; encoding
: [0x09,0x00,0x97,0xbf]
55 s_cbranch_cdbgsys_and_user
10
56 // GCN
: s_cbranch_cdbgsys_and_user
10 ; encoding
: [0x0a,0x00,0x9a,0xbf]
58 s_cbranch_cdbgsys_or_user
11
59 // GCN
: s_cbranch_cdbgsys_or_user
11 ; encoding
: [0x0b,0x00,0x99,0xbf]
62 // GCN
: s_cbranch_cdbguser
12 ; encoding
: [0x0c,0x00,0x98,0xbf]
65 // GCN
: s_barrier ; encoding
: [0x00,0x00,0x8a,0xbf]
67 //===----------------------------------------------------------------------===//
69 //===----------------------------------------------------------------------===//
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
(0) expcnt
(0) lgkmcnt
(0)
78 // GCN
: s_waitcnt vmcnt
(0) expcnt
(0) lgkmcnt
(0) ; encoding
: [0x00,0x00,0x8c,0xbf]
80 s_waitcnt vmcnt
(0), expcnt
(0), lgkmcnt
(0)
81 // GCN
: s_waitcnt vmcnt
(0) expcnt
(0) lgkmcnt
(0) ; encoding
: [0x00,0x00,0x8c,0xbf]
84 // GCN
: s_waitcnt vmcnt
(1) ; encoding
: [0x71,0x0f,0x8c,0xbf]
87 // GCN
: s_waitcnt vmcnt
(9) ; encoding
: [0x79,0x0f,0x8c,0xbf]
90 // GCN
: s_waitcnt vmcnt
(15) expcnt
(7) lgkmcnt
(15) ; encoding
: [0x7f,0x0f,0x8c,0xbf]
92 s_waitcnt vmcnt_sat
(9)
93 // GCN
: s_waitcnt vmcnt
(9) ; encoding
: [0x79,0x0f,0x8c,0xbf]
95 s_waitcnt vmcnt_sat
(15)
96 // GCN
: s_waitcnt vmcnt
(15) expcnt
(7) lgkmcnt
(15) ; encoding
: [0x7f,0x0f,0x8c,0xbf]
98 s_waitcnt vmcnt_sat
(16)
99 // GCN
: s_waitcnt vmcnt
(15) expcnt
(7) lgkmcnt
(15) ; encoding
: [0x7f,0x0f,0x8c,0xbf]
102 // GCN
: s_waitcnt expcnt
(2) ; encoding
: [0x2f,0x0f,0x8c,0xbf]
105 // GCN
: s_waitcnt vmcnt
(15) expcnt
(7) lgkmcnt
(15) ; encoding
: [0x7f,0x0f,0x8c,0xbf]
107 s_waitcnt expcnt_sat
(2)
108 // GCN
: s_waitcnt expcnt
(2) ; encoding
: [0x2f,0x0f,0x8c,0xbf]
110 s_waitcnt expcnt_sat
(7)
111 // GCN
: s_waitcnt vmcnt
(15) expcnt
(7) lgkmcnt
(15) ; encoding
: [0x7f,0x0f,0x8c,0xbf]
113 s_waitcnt expcnt_sat
(0xFFFF0000)
114 // GCN
: s_waitcnt vmcnt
(15) expcnt
(7) lgkmcnt
(15) ; encoding
: [0x7f,0x0f,0x8c,0xbf]
117 // GCN
: s_waitcnt lgkmcnt
(3) ; encoding
: [0x7f,0x03,0x8c,0xbf]
120 // GCN
: s_waitcnt lgkmcnt
(9) ; encoding
: [0x7f,0x09,0x8c,0xbf]
122 s_waitcnt lgkmcnt
(15)
123 // GCN
: s_waitcnt vmcnt
(15) expcnt
(7) lgkmcnt
(15) ; encoding
: [0x7f,0x0f,0x8c,0xbf]
125 s_waitcnt vmcnt
(0), expcnt
(0)
126 // GCN
: s_waitcnt vmcnt
(0) expcnt
(0) ; encoding
: [0x00,0x0f,0x8c,0xbf]
128 s_waitcnt lgkmcnt_sat
(3)
129 // GCN
: s_waitcnt lgkmcnt
(3) ; encoding
: [0x7f,0x03,0x8c,0xbf]
131 s_waitcnt lgkmcnt_sat
(9)
132 // GCN
: s_waitcnt lgkmcnt
(9) ; encoding
: [0x7f,0x09,0x8c,0xbf]
134 s_waitcnt lgkmcnt_sat
(15)
135 // GCN
: s_waitcnt vmcnt
(15) expcnt
(7) lgkmcnt
(15) ; encoding
: [0x7f,0x0f,0x8c,0xbf]
137 s_waitcnt lgkmcnt_sat
(16)
138 // GCN
: s_waitcnt vmcnt
(15) expcnt
(7) lgkmcnt
(15) ; encoding
: [0x7f,0x0f,0x8c,0xbf]
141 s_waitcnt lgkmcnt_sat
(x+
1)
142 // GCN
: s_waitcnt lgkmcnt
(2) ; encoding
: [0x7f,0x02,0x8c,0xbf]
144 s_waitcnt lgkmcnt_sat
(1+x
)
145 // GCN
: s_waitcnt lgkmcnt
(2) ; encoding
: [0x7f,0x02,0x8c,0xbf]
148 // GCN
: s_waitcnt vmcnt
(2) expcnt
(0) lgkmcnt
(0) ; encoding
: [0x02,0x00,0x8c,0xbf]
151 // GCN
: s_waitcnt vmcnt
(2) expcnt
(0) lgkmcnt
(0) ; encoding
: [0x02,0x00,0x8c,0xbf]
154 s_waitcnt lgkmcnt_sat
155 // GCN
: s_waitcnt vmcnt
(1) expcnt
(0) lgkmcnt
(0) ; encoding
: [0x01,0x00,0x8c,0xbf]
157 s_waitcnt lgkmcnt_sat+
1
158 // GCN
: s_waitcnt vmcnt
(2) expcnt
(0) lgkmcnt
(0) ; encoding
: [0x02,0x00,0x8c,0xbf]
160 //===----------------------------------------------------------------------===//
161 // misc sopp instructions
162 //===----------------------------------------------------------------------===//
165 // GCN
: s_sethalt
9 ; encoding
: [0x09,0x00,0x8d,0xbf]
168 // GCN
: s_setkill
7 ; encoding
: [0x07,0x00,0x8b,0xbf]
171 // GCN
: s_sleep
10 ; encoding
: [0x0a,0x00,0x8e,0xbf]
174 // GCN
: s_setprio
1 ; encoding
: [0x01,0x00,0x8f,0xbf]
176 //===----------------------------------------------------------------------===//
178 //===----------------------------------------------------------------------===//
181 // GCN
: s_sendmsg sendmsg
(MSG_INTERRUPT
) ; encoding
: [0x01,0x00,0x90,0xbf]
184 // GCN
: s_sendmsg sendmsg
(MSG_INTERRUPT
) ; encoding
: [0x01,0x00,0x90,0xbf]
186 s_sendmsg sendmsg
(MSG_INTERRUPT
)
187 // GCN
: s_sendmsg sendmsg
(MSG_INTERRUPT
) ; encoding
: [0x01,0x00,0x90,0xbf]
190 // GCN
: s_sendmsg sendmsg
(MSG_GS
, GS_OP_CUT
, 0) ; encoding
: [0x12,0x00,0x90,0xbf]
192 s_sendmsg sendmsg
(2, 1)
193 // GCN
: s_sendmsg sendmsg
(MSG_GS
, GS_OP_CUT
, 0) ; encoding
: [0x12,0x00,0x90,0xbf]
195 s_sendmsg sendmsg
(2, GS_OP_CUT
)
196 // GCN
: s_sendmsg sendmsg
(MSG_GS
, GS_OP_CUT
, 0) ; encoding
: [0x12,0x00,0x90,0xbf]
198 s_sendmsg sendmsg
(MSG_GS
, GS_OP_CUT
)
199 // GCN
: s_sendmsg sendmsg
(MSG_GS
, GS_OP_CUT
, 0) ; encoding
: [0x12,0x00,0x90,0xbf]
201 s_sendmsg sendmsg
(MSG_GS
, GS_OP_CUT
, 0)
202 // GCN
: s_sendmsg sendmsg
(MSG_GS
, GS_OP_CUT
, 0) ; encoding
: [0x12,0x00,0x90,0xbf]
204 s_sendmsg sendmsg
(MSG_GS
, 1)
205 // GCN
: s_sendmsg sendmsg
(MSG_GS
, GS_OP_CUT
, 0) ; encoding
: [0x12,0x00,0x90,0xbf]
207 s_sendmsg sendmsg
(MSG_GS
, 1, 1)
208 // GCN
: s_sendmsg sendmsg
(MSG_GS
, GS_OP_CUT
, 1) ; encoding
: [0x12,0x01,0x90,0xbf]
211 // GCN
: s_sendmsg sendmsg
(MSG_GS
, GS_OP_EMIT
, 1) ; encoding
: [0x22,0x01,0x90,0xbf]
213 s_sendmsg sendmsg
(2, 2, 1)
214 // GCN
: s_sendmsg sendmsg
(MSG_GS
, GS_OP_EMIT
, 1) ; encoding
: [0x22,0x01,0x90,0xbf]
216 s_sendmsg sendmsg
(MSG_GS
, GS_OP_EMIT
, 1)
217 // GCN
: s_sendmsg sendmsg
(MSG_GS
, GS_OP_EMIT
, 1) ; encoding
: [0x22,0x01,0x90,0xbf]
220 // GCN
: s_sendmsg sendmsg
(MSG_GS
, GS_OP_EMIT_CUT
, 2) ; encoding
: [0x32,0x02,0x90,0xbf]
222 s_sendmsg sendmsg
(2, 3, 2)
223 // GCN
: s_sendmsg sendmsg
(MSG_GS
, GS_OP_EMIT_CUT
, 2) ; encoding
: [0x32,0x02,0x90,0xbf]
225 s_sendmsg sendmsg
(MSG_GS
, GS_OP_EMIT_CUT
, 2)
226 // GCN
: s_sendmsg sendmsg
(MSG_GS
, GS_OP_EMIT_CUT
, 2) ; encoding
: [0x32,0x02,0x90,0xbf]
229 // GCN
: s_sendmsg sendmsg
(MSG_GS_DONE
, GS_OP_NOP
) ; encoding
: [0x03,0x00,0x90,0xbf]
231 s_sendmsg sendmsg
(3, 0)
232 // GCN
: s_sendmsg sendmsg
(MSG_GS_DONE
, GS_OP_NOP
) ; encoding
: [0x03,0x00,0x90,0xbf]
234 s_sendmsg sendmsg
(MSG_GS_DONE
, GS_OP_NOP
)
235 // GCN
: s_sendmsg sendmsg
(MSG_GS_DONE
, GS_OP_NOP
) ; encoding
: [0x03,0x00,0x90,0xbf]
238 // SI
: s_sendmsg sendmsg
(4, 0, 0) ; encoding
: [0x04,0x00,0x90,0xbf]
239 // VI
: s_sendmsg sendmsg
(MSG_SAVEWAVE
) ; encoding
: [0x04,0x00,0x90,0xbf]
242 // SI
: s_sendmsg sendmsg
(4, 0, 0) ; encoding
: [0x04,0x00,0x90,0xbf]
243 // VI
: s_sendmsg sendmsg
(MSG_SAVEWAVE
) ; encoding
: [0x04,0x00,0x90,0xbf]
245 s_sendmsg sendmsg
(MSG_SAVEWAVE
)
246 // NOSICI
: :[[@LINE-
1]]:{{[0-9]+}}: error
: specified message id is
not supported on this GPU
247 // VI
: s_sendmsg sendmsg
(MSG_SAVEWAVE
) ; encoding
: [0x04,0x00,0x90,0xbf]
250 // GCN
: s_sendmsg sendmsg
(MSG_SYSMSG
, SYSMSG_OP_ECC_ERR_INTERRUPT
) ; encoding
: [0x1f,0x00,0x90,0xbf]
252 s_sendmsg sendmsg
(15, 1)
253 // GCN
: s_sendmsg sendmsg
(MSG_SYSMSG
, SYSMSG_OP_ECC_ERR_INTERRUPT
) ; encoding
: [0x1f,0x00,0x90,0xbf]
255 s_sendmsg sendmsg
(MSG_SYSMSG
, SYSMSG_OP_ECC_ERR_INTERRUPT
)
256 // GCN
: s_sendmsg sendmsg
(MSG_SYSMSG
, SYSMSG_OP_ECC_ERR_INTERRUPT
) ; encoding
: [0x1f,0x00,0x90,0xbf]
259 // GCN
: s_sendmsghalt sendmsg
(MSG_GS_DONE
, GS_OP_NOP
) ; encoding
: [0x03,0x00,0x91,0xbf]
261 s_sendmsghalt sendmsg
(MSG_GS
, GS_OP_EMIT
, 1)
262 // GCN
: s_sendmsghalt sendmsg
(MSG_GS
, GS_OP_EMIT
, 1) ; encoding
: [0x22,0x01,0x91,0xbf]
264 //===----------------------------------------------------------------------===//
265 // s_sendmsg with
a numeric message id
(no validation
)
266 //===----------------------------------------------------------------------===//
269 // GCN
: s_sendmsg sendmsg
(2, 0, 0) ; encoding
: [0x02,0x00,0x90,0xbf]
272 // GCN
: s_sendmsg sendmsg
(9, 0, 0) ; encoding
: [0x09,0x00,0x90,0xbf]
275 // GCN
: s_sendmsg sendmsg
(11, 0, 0) ; encoding
: [0x0b,0x00,0x90,0xbf]
278 // GCN
: s_sendmsg sendmsg
(15, 6, 0) ; encoding
: [0x6f,0x00,0x90,0xbf]
280 s_sendmsg sendmsg
(1, 3)
281 // GCN
: s_sendmsg sendmsg
(1, 3, 0) ; encoding
: [0x31,0x00,0x90,0xbf]
283 s_sendmsg sendmsg
(1, 3, 2)
284 // GCN
: s_sendmsg sendmsg
(1, 3, 2) ; encoding
: [0x31,0x02,0x90,0xbf]
286 s_sendmsg sendmsg
(2, 0, 1)
287 // GCN
: s_sendmsg sendmsg
(2, 0, 1) ; encoding
: [0x02,0x01,0x90,0xbf]
289 s_sendmsg sendmsg
(15, 7, 3)
290 // GCN
: s_sendmsg sendmsg
(15, 7, 3) ; encoding
: [0x7f,0x03,0x90,0xbf]
293 // GCN
: s_sendmsg
4567 ; encoding
: [0xd7,0x11,0x90,0xbf]
295 //===----------------------------------------------------------------------===//
296 // s_sendmsg with expressions
297 //===----------------------------------------------------------------------===//
301 // GCN
: s_sendmsg sendmsg
(2, 0, 0) ; encoding
: [0x02,0x00,0x90,0xbf]
305 // GCN
: s_sendmsg sendmsg
(2, 0, 0) ; encoding
: [0x02,0x00,0x90,0xbf]
308 // GCN
: s_sendmsg sendmsg
(2, 0, 0) ; encoding
: [0x02,0x00,0x90,0xbf]
311 s_sendmsg sendmsg
(msg
)
312 // GCN
: s_sendmsg sendmsg
(MSG_INTERRUPT
) ; encoding
: [0x01,0x00,0x90,0xbf]
315 s_sendmsg sendmsg
(msg+
1)
316 // GCN
: s_sendmsg sendmsg
(MSG_INTERRUPT
) ; encoding
: [0x01,0x00,0x90,0xbf]
319 s_sendmsg sendmsg
(1+msg
)
320 // GCN
: s_sendmsg sendmsg
(MSG_INTERRUPT
) ; encoding
: [0x01,0x00,0x90,0xbf]
324 s_sendmsg sendmsg
(msg
, op
)
325 // GCN
: s_sendmsg sendmsg
(MSG_GS
, GS_OP_CUT
, 0) ; encoding
: [0x12,0x00,0x90,0xbf]
329 s_sendmsg sendmsg
(msg+
1, op+
1)
330 // GCN
: s_sendmsg sendmsg
(MSG_GS
, GS_OP_CUT
, 0) ; encoding
: [0x12,0x00,0x90,0xbf]
334 s_sendmsg sendmsg
(1+msg
, 1+op
)
335 // GCN
: s_sendmsg sendmsg
(MSG_GS
, GS_OP_CUT
, 0) ; encoding
: [0x12,0x00,0x90,0xbf]
340 s_sendmsg sendmsg
(msg+
1, op+
1, stream+
1)
341 // GCN
: s_sendmsg sendmsg
(MSG_GS
, GS_OP_EMIT_CUT
, 2) ; encoding
: [0x32,0x02,0x90,0xbf]
346 s_sendmsg sendmsg
(1+msg
, 1+op
, 1+stream
)
347 // GCN
: s_sendmsg sendmsg
(MSG_GS
, GS_OP_EMIT_CUT
, 2) ; encoding
: [0x32,0x02,0x90,0xbf]
351 s_sendmsghalt sendmsg
(MSG_GS
, GS_OP_EMIT
, 1)
352 // GCN
: s_sendmsghalt sendmsg
(MSG_GS
, GS_OP_EMIT
, 1) ; encoding
: [0x22,0x01,0x91,0xbf]
354 //===----------------------------------------------------------------------===//
355 // misc sopp instructions
356 //===----------------------------------------------------------------------===//
359 // GCN
: s_trap
4 ; encoding
: [0x04,0x00,0x92,0xbf]
362 // GCN
: s_icache_inv ; encoding
: [0x00,0x00,0x93,0xbf]
365 // GCN
: s_incperflevel
5 ; encoding
: [0x05,0x00,0x94,0xbf]
368 // GCN
: s_decperflevel
6 ; encoding
: [0x06,0x00,0x95,0xbf]
371 // GCN
: s_ttracedata ; encoding
: [0x00,0x00,0x96,0xbf]
374 // VI
: s_set_gpr_idx_off ; encoding
: [0x00,0x00,0x9c,0xbf]
375 // NOSICI
: :[[@LINE-
2]]:{{[0-9]+}}: error
: instruction
not supported on this GPU
378 // VI
: s_set_gpr_idx_mode gpr_idx
() ; encoding
: [0x00,0x00,0x9d,0xbf]
379 // NOSICI
: :[[@LINE-
2]]:{{[0-9]+}}: error
: instruction
not supported on this GPU
381 s_set_gpr_idx_mode gpr_idx
()
382 // VI
: s_set_gpr_idx_mode gpr_idx
() ; encoding
: [0x00,0x00,0x9d,0xbf]
383 // NOSICI
: :[[@LINE-
2]]:{{[0-9]+}}: error
: instruction
not supported on this GPU
385 s_set_gpr_idx_mode
15
386 // VI
: s_set_gpr_idx_mode gpr_idx
(SRC0
,SRC1
,SRC2
,DST) ; encoding
: [0x0f,0x00,0x9d,0xbf]
387 // NOSICI
: :[[@LINE-
2]]:{{[0-9]+}}: error
: instruction
not supported on this GPU
389 s_set_gpr_idx_mode gpr_idx
(SRC2
,SRC1
,SRC0
,DST)
390 // VI
: s_set_gpr_idx_mode gpr_idx
(SRC0
,SRC1
,SRC2
,DST) ; encoding
: [0x0f,0x00,0x9d,0xbf]
391 // NOSICI
: :[[@LINE-
2]]:{{[0-9]+}}: error
: instruction
not supported on this GPU
394 // VI
: s_endpgm_saved ; encoding
: [0x00,0x00,0x9b,0xbf]
395 // NOSICI
: :[[@LINE-
2]]:{{[0-9]+}}: error
: instruction
not supported on this GPU
398 // VI
: s_wakeup ; encoding
: [0x00,0x00,0x83,0xbf]
399 // NOSICI
: :[[@LINE-
2]]:{{[0-9]+}}: error
: instruction
not supported on this GPU
401 //===----------------------------------------------------------------------===//
402 // absolute expressions as branch offsets
403 //===----------------------------------------------------------------------===//
407 // GCN
: s_branch
4 ; encoding
: [0x04,0x00,0x82,0xbf]
411 // GCN
: s_branch
4 ; encoding
: [0x04,0x00,0x82,0xbf]