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 -mcpu=fiji -show-encoding %s 2>&1 | FileCheck --check-prefix=GCN --check-prefix=VI --check-prefix=GFX89 %s
3// RUN: not llvm-mc -arch=amdgcn -mcpu=gfx900 -show-encoding %s 2>&1 | FileCheck --check-prefix=GCN --check-prefix=GFX89 --check-prefix=GFX9 %s
4// RUN: not llvm-mc -arch=amdgcn -mcpu=gfx1010 -show-encoding %s 2>&1 | FileCheck --check-prefix=GCN --check-prefix=GFX10 %s
5
6// RUN: not llvm-mc -arch=amdgcn -show-encoding %s 2>&1 | FileCheck --check-prefix=NOSICI --check-prefix=NOSICIVI %s
7// RUN: not llvm-mc -arch=amdgcn -mcpu=fiji -show-encoding %s 2>&1 | FileCheck --check-prefix=NOVI --check-prefix=NOSICIVI --check-prefix=NOGFX89 %s
8// RUN: not llvm-mc -arch=amdgcn -mcpu=gfx900 -show-encoding %s 2>&1 | FileCheck --check-prefix=NOGFX89 %s
9
10// RUN: not llvm-mc -arch=amdgcn -mcpu=gfx1010 -show-encoding 2>&1 %s | FileCheck --check-prefix=GFX10-ERR %s
11
12s_mov_b32 s1, s2
13// SICI: s_mov_b32 s1, s2 ; encoding: [0x02,0x03,0x81,0xbe]
14// GFX89: s_mov_b32 s1, s2 ; encoding: [0x02,0x00,0x81,0xbe]
15
16s_mov_b32 s1, 1
17// SICI: s_mov_b32 s1, 1 ; encoding: [0x81,0x03,0x81,0xbe]
18// GFX89: s_mov_b32 s1, 1 ; encoding: [0x81,0x00,0x81,0xbe]
19
20s_mov_b32 s1, 100
21// SICI: s_mov_b32 s1, 0x64 ; encoding: [0xff,0x03,0x81,0xbe,0x64,0x00,0x00,0x00]
22// GFX89: s_mov_b32 s1, 0x64 ; encoding: [0xff,0x00,0x81,0xbe,0x64,0x00,0x00,0x00]
23
24// Literal constant sign bit
25s_mov_b32 s1, 0x80000000
26// SICI: s_mov_b32 s1, 0x80000000 ; encoding: [0xff,0x03,0x81,0xbe,0x00,0x00,0x00,0x80]
27// GFX89: s_mov_b32 s1, 0x80000000 ; encoding: [0xff,0x00,0x81,0xbe,0x00,0x00,0x00,0x80]
28
29// Negative 32-bit constant
30s_mov_b32 s0, 0xfe5163ab
31// SICI: s_mov_b32 s0, 0xfe5163ab ; encoding: [0xff,0x03,0x80,0xbe,0xab,0x63,0x51,0xfe]
32// GFX89: s_mov_b32 s0, 0xfe5163ab ; encoding: [0xff,0x00,0x80,0xbe,0xab,0x63,0x51,0xfe]
33
34s_mov_b64 s[2:3], s[4:5]
35// SICI: s_mov_b64 s[2:3], s[4:5] ; encoding: [0x04,0x04,0x82,0xbe]
36// GFX89: s_mov_b64 s[2:3], s[4:5] ; encoding: [0x04,0x01,0x82,0xbe]
37
38s_mov_b64 null, s[4:5]
39// GFX10: s_mov_b64 null, s[4:5] ; encoding: [0x04,0x04,0xfd,0xbe]
40// NOSICIVI: error: not a valid operand.
41
42s_mov_b64 s[2:3], 0xffffffffffffffff
43// SICI: s_mov_b64 s[2:3], -1 ; encoding: [0xc1,0x04,0x82,0xbe]
44// GFX89: s_mov_b64 s[2:3], -1 ; encoding: [0xc1,0x01,0x82,0xbe]
45
46s_mov_b64 s[2:3], 0xffffffff
47// SICI: s_mov_b64 s[2:3], 0xffffffff ; encoding: [0xff,0x04,0x82,0xbe,0xff,0xff,0xff,0xff]
48// GFX89: s_mov_b64 s[2:3], 0xffffffff ; encoding: [0xff,0x01,0x82,0xbe,0xff,0xff,0xff,0xff]
49
50s_mov_b64 s[0:1], 0x80000000
51// SICI: s_mov_b64 s[0:1], 0x80000000 ; encoding: [0xff,0x04,0x80,0xbe,0x00,0x00,0x00,0x80]
52// GFX89: s_mov_b64 s[0:1], 0x80000000 ; encoding: [0xff,0x01,0x80,0xbe,0x00,0x00,0x00,0x80]
53
54s_mov_b64 s[102:103], -1
55// SICI: s_mov_b64 s[102:103], -1 ; encoding: [0xc1,0x04,0xe6,0xbe]
56// NOGFX89: error: not a valid operand
57
58s_cmov_b32 s1, 200
59// SICI: s_cmov_b32 s1, 0xc8 ; encoding: [0xff,0x05,0x81,0xbe,0xc8,0x00,0x00,0x00]
60// GFX89: s_cmov_b32 s1, 0xc8 ; encoding: [0xff,0x02,0x81,0xbe,0xc8,0x00,0x00,0x00]
61
62s_cmov_b32 s1, 1.0
63// SICI: s_cmov_b32 s1, 1.0 ; encoding: [0xf2,0x05,0x81,0xbe]
64// GFX89: s_cmov_b32 s1, 1.0 ; encoding: [0xf2,0x02,0x81,0xbe]
65
66s_cmov_b32 s1, s2
67// SICI: s_cmov_b32 s1, s2 ; encoding: [0x02,0x05,0x81,0xbe]
68// GFX89: s_cmov_b32 s1, s2 ; encoding: [0x02,0x02,0x81,0xbe]
69
70//s_cmov_b64 s[2:3], 1.0
71//GCN-FIXME: s_cmov_b64 s[2:3], 1.0 ; encoding: [0xf2,0x05,0x82,0xb3]
72
73s_cmov_b64 s[2:3], s[4:5]
74// SICI: s_cmov_b64 s[2:3], s[4:5] ; encoding: [0x04,0x06,0x82,0xbe]
75// GFX89: s_cmov_b64 s[2:3], s[4:5] ; encoding: [0x04,0x03,0x82,0xbe]
76
77s_not_b32 s1, s2
78// SICI: s_not_b32 s1, s2 ; encoding: [0x02,0x07,0x81,0xbe]
79// GFX89: s_not_b32 s1, s2 ; encoding: [0x02,0x04,0x81,0xbe]
80
81s_not_b64 s[2:3], s[4:5]
82// SICI: s_not_b64 s[2:3], s[4:5] ; encoding: [0x04,0x08,0x82,0xbe]
83// GFX89: s_not_b64 s[2:3], s[4:5] ; encoding: [0x04,0x05,0x82,0xbe]
84
85s_wqm_b32 s1, s2
86// SICI: s_wqm_b32 s1, s2 ; encoding: [0x02,0x09,0x81,0xbe]
87// GFX89: s_wqm_b32 s1, s2 ; encoding: [0x02,0x06,0x81,0xbe]
88
89s_wqm_b64 s[2:3], s[4:5]
90// SICI: s_wqm_b64 s[2:3], s[4:5] ; encoding: [0x04,0x0a,0x82,0xbe]
91// GFX89: s_wqm_b64 s[2:3], s[4:5] ; encoding: [0x04,0x07,0x82,0xbe]
92
93s_brev_b32 s1, s2
94// SICI: s_brev_b32 s1, s2 ; encoding: [0x02,0x0b,0x81,0xbe]
95// GFX89: s_brev_b32 s1, s2 ; encoding: [0x02,0x08,0x81,0xbe]
96
97s_brev_b64 s[2:3], s[4:5]
98// SICI: s_brev_b64 s[2:3], s[4:5] ; encoding: [0x04,0x0c,0x82,0xbe]
99// GFX89: s_brev_b64 s[2:3], s[4:5] ; encoding: [0x04,0x09,0x82,0xbe]
100
101s_bcnt0_i32_b32 s1, s2
102// SICI: s_bcnt0_i32_b32 s1, s2 ; encoding: [0x02,0x0d,0x81,0xbe]
103// GFX89: s_bcnt0_i32_b32 s1, s2 ; encoding: [0x02,0x0a,0x81,0xbe]
104
105s_bcnt0_i32_b64 s1, s[2:3]
106// SICI: s_bcnt0_i32_b64 s1, s[2:3] ; encoding: [0x02,0x0e,0x81,0xbe]
107// GFX89: s_bcnt0_i32_b64 s1, s[2:3] ; encoding: [0x02,0x0b,0x81,0xbe]
108
109s_bcnt1_i32_b32 s1, s2
110// SICI: s_bcnt1_i32_b32 s1, s2 ; encoding: [0x02,0x0f,0x81,0xbe]
111// GFX89: s_bcnt1_i32_b32 s1, s2 ; encoding: [0x02,0x0c,0x81,0xbe]
112
113s_bcnt1_i32_b64 s1, s[2:3]
114// SICI: s_bcnt1_i32_b64 s1, s[2:3] ; encoding: [0x02,0x10,0x81,0xbe]
115// GFX89: s_bcnt1_i32_b64 s1, s[2:3] ; encoding: [0x02,0x0d,0x81,0xbe]
116
117s_ff0_i32_b32 s1, s2
118// SICI: s_ff0_i32_b32 s1, s2 ; encoding: [0x02,0x11,0x81,0xbe]
119// GFX89: s_ff0_i32_b32 s1, s2 ; encoding: [0x02,0x0e,0x81,0xbe]
120
121s_ff0_i32_b64 s1, s[2:3]
122// SICI: s_ff0_i32_b64 s1, s[2:3] ; encoding: [0x02,0x12,0x81,0xbe]
123// GFX89: s_ff0_i32_b64 s1, s[2:3] ; encoding: [0x02,0x0f,0x81,0xbe]
124
125s_ff1_i32_b32 s1, s2
126// SICI: s_ff1_i32_b32 s1, s2 ; encoding: [0x02,0x13,0x81,0xbe]
127// GFX89: s_ff1_i32_b32 s1, s2 ; encoding: [0x02,0x10,0x81,0xbe]
128
129s_ff1_i32_b64 s1, s[2:3]
130// SICI: s_ff1_i32_b64 s1, s[2:3] ; encoding: [0x02,0x14,0x81,0xbe]
131// GFX89: s_ff1_i32_b64 s1, s[2:3] ; encoding: [0x02,0x11,0x81,0xbe]
132
133s_flbit_i32_b32 s1, s2
134// SICI: s_flbit_i32_b32 s1, s2 ; encoding: [0x02,0x15,0x81,0xbe]
135// GFX89: s_flbit_i32_b32 s1, s2 ; encoding: [0x02,0x12,0x81,0xbe]
136
137s_flbit_i32_b64 s1, s[2:3]
138// SICI: s_flbit_i32_b64 s1, s[2:3] ; encoding: [0x02,0x16,0x81,0xbe]
139// GFX89: s_flbit_i32_b64 s1, s[2:3] ; encoding: [0x02,0x13,0x81,0xbe]
140
141s_flbit_i32 s1, s2
142// SICI: s_flbit_i32 s1, s2 ; encoding: [0x02,0x17,0x81,0xbe]
143// GFX89: s_flbit_i32 s1, s2 ; encoding: [0x02,0x14,0x81,0xbe]
144
145s_flbit_i32_i64 s1, s[2:3]
146// SICI: s_flbit_i32_i64 s1, s[2:3] ; encoding: [0x02,0x18,0x81,0xbe]
147// GFX89: s_flbit_i32_i64 s1, s[2:3] ; encoding: [0x02,0x15,0x81,0xbe]
148
149s_sext_i32_i8 s1, s2
150// SICI: s_sext_i32_i8 s1, s2 ; encoding: [0x02,0x19,0x81,0xbe]
151// GFX89: s_sext_i32_i8 s1, s2 ; encoding: [0x02,0x16,0x81,0xbe]
152
153s_sext_i32_i16 s1, s2
154// SICI: s_sext_i32_i16 s1, s2 ; encoding: [0x02,0x1a,0x81,0xbe]
155// GFX89: s_sext_i32_i16 s1, s2 ; encoding: [0x02,0x17,0x81,0xbe]
156
157s_bitset0_b32 s1, s2
158// SICI: s_bitset0_b32 s1, s2 ; encoding: [0x02,0x1b,0x81,0xbe]
159// GFX89: s_bitset0_b32 s1, s2 ; encoding: [0x02,0x18,0x81,0xbe]
160
161s_bitset0_b64 s[2:3], s4
162// SICI: s_bitset0_b64 s[2:3], s4 ; encoding: [0x04,0x1c,0x82,0xbe]
163// GFX89: s_bitset0_b64 s[2:3], s4 ; encoding: [0x04,0x19,0x82,0xbe]
164
165s_bitset1_b32 s1, s2
166// SICI: s_bitset1_b32 s1, s2 ; encoding: [0x02,0x1d,0x81,0xbe]
167// GFX89: s_bitset1_b32 s1, s2 ; encoding: [0x02,0x1a,0x81,0xbe]
168
169s_bitset1_b64 s[2:3], s4
170// SICI: s_bitset1_b64 s[2:3], s4 ; encoding: [0x04,0x1e,0x82,0xbe]
171// GFX89: s_bitset1_b64 s[2:3], s4 ; encoding: [0x04,0x1b,0x82,0xbe]
172
173s_getpc_b64 s[2:3]
174// SICI: s_getpc_b64 s[2:3] ; encoding: [0x00,0x1f,0x82,0xbe]
175// GFX89: s_getpc_b64 s[2:3] ; encoding: [0x00,0x1c,0x82,0xbe]
176
177s_setpc_b64 s[4:5]
178// SICI: s_setpc_b64 s[4:5] ; encoding: [0x04,0x20,0x80,0xbe]
179// GFX89: s_setpc_b64 s[4:5] ; encoding: [0x04,0x1d,0x80,0xbe]
180
181s_swappc_b64 s[2:3], s[4:5]
182// SICI: s_swappc_b64 s[2:3], s[4:5] ; encoding: [0x04,0x21,0x82,0xbe]
183// GFX89: s_swappc_b64 s[2:3], s[4:5] ; encoding: [0x04,0x1e,0x82,0xbe]
184
185s_rfe_b64 s[4:5]
186// SICI: s_rfe_b64 s[4:5] ; encoding: [0x04,0x22,0x80,0xbe]
187// GFX89: s_rfe_b64 s[4:5] ; encoding: [0x04,0x1f,0x80,0xbe]
188
189s_and_saveexec_b64 s[2:3], s[4:5]
190// SICI: s_and_saveexec_b64 s[2:3], s[4:5] ; encoding: [0x04,0x24,0x82,0xbe]
191// GFX89: s_and_saveexec_b64 s[2:3], s[4:5] ; encoding: [0x04,0x20,0x82,0xbe]
192
193s_or_saveexec_b64 s[2:3], s[4:5]
194// SICI: s_or_saveexec_b64 s[2:3], s[4:5] ; encoding: [0x04,0x25,0x82,0xbe]
195// GFX89: s_or_saveexec_b64 s[2:3], s[4:5] ; encoding: [0x04,0x21,0x82,0xbe]
196
197s_xor_saveexec_b64 s[2:3], s[4:5]
198// SICI: s_xor_saveexec_b64 s[2:3], s[4:5] ; encoding: [0x04,0x26,0x82,0xbe]
199// GFX89: s_xor_saveexec_b64 s[2:3], s[4:5] ; encoding: [0x04,0x22,0x82,0xbe]
200
201s_andn2_saveexec_b64 s[2:3], s[4:5]
202// SICI: s_andn2_saveexec_b64 s[2:3], s[4:5] ; encoding: [0x04,0x27,0x82,0xbe]
203// GFX89: s_andn2_saveexec_b64 s[2:3], s[4:5] ; encoding: [0x04,0x23,0x82,0xbe]
204
205s_orn2_saveexec_b64 s[2:3], s[4:5]
206// SICI: s_orn2_saveexec_b64 s[2:3], s[4:5] ; encoding: [0x04,0x28,0x82,0xbe]
207// GFX89: s_orn2_saveexec_b64 s[2:3], s[4:5] ; encoding: [0x04,0x24,0x82,0xbe]
208
209s_nand_saveexec_b64 s[2:3], s[4:5]
210// SICI: s_nand_saveexec_b64 s[2:3], s[4:5] ; encoding: [0x04,0x29,0x82,0xbe]
211// GFX89: s_nand_saveexec_b64 s[2:3], s[4:5] ; encoding: [0x04,0x25,0x82,0xbe]
212
213s_nor_saveexec_b64 s[2:3], s[4:5]
214// SICI: s_nor_saveexec_b64 s[2:3], s[4:5] ; encoding: [0x04,0x2a,0x82,0xbe]
215// GFX89: s_nor_saveexec_b64 s[2:3], s[4:5] ; encoding: [0x04,0x26,0x82,0xbe]
216
217s_xnor_saveexec_b64 s[2:3], s[4:5]
218// SICI: s_xnor_saveexec_b64 s[2:3], s[4:5] ; encoding: [0x04,0x2b,0x82,0xbe]
219// GFX89: s_xnor_saveexec_b64 s[2:3], s[4:5] ; encoding: [0x04,0x27,0x82,0xbe]
220
221s_quadmask_b32 s1, s2
222// SICI: s_quadmask_b32 s1, s2 ; encoding: [0x02,0x2c,0x81,0xbe]
223// GFX89: s_quadmask_b32 s1, s2 ; encoding: [0x02,0x28,0x81,0xbe]
224
225s_quadmask_b64 s[2:3], s[4:5]
226// SICI: s_quadmask_b64 s[2:3], s[4:5] ; encoding: [0x04,0x2d,0x82,0xbe]
227// GFX89: s_quadmask_b64 s[2:3], s[4:5] ; encoding: [0x04,0x29,0x82,0xbe]
228
229s_movrels_b32 s1, s2
230// SICI: s_movrels_b32 s1, s2 ; encoding: [0x02,0x2e,0x81,0xbe]
231// GFX89: s_movrels_b32 s1, s2 ; encoding: [0x02,0x2a,0x81,0xbe]
232
233s_movrels_b64 s[2:3], s[4:5]
234// SICI: s_movrels_b64 s[2:3], s[4:5] ; encoding: [0x04,0x2f,0x82,0xbe]
235// GFX89: s_movrels_b64 s[2:3], s[4:5] ; encoding: [0x04,0x2b,0x82,0xbe]
236
237s_movreld_b32 s1, s2
238// SICI: s_movreld_b32 s1, s2 ; encoding: [0x02,0x30,0x81,0xbe]
239// GFX89: s_movreld_b32 s1, s2 ; encoding: [0x02,0x2c,0x81,0xbe]
240
241s_movreld_b64 s[2:3], s[4:5]
242// SICI: s_movreld_b64 s[2:3], s[4:5] ; encoding: [0x04,0x31,0x82,0xbe]
243// GFX89: s_movreld_b64 s[2:3], s[4:5] ; encoding: [0x04,0x2d,0x82,0xbe]
244
245s_cbranch_join s4
246// SICI: s_cbranch_join s4 ; encoding: [0x04,0x32,0x80,0xbe]
247// GFX89: s_cbranch_join s4 ; encoding: [0x04,0x2e,0x80,0xbe]
248// GFX10-ERR: error: instruction not supported on this GPU
249
250s_cbranch_join 1
251// NOSICI: error: invalid operand for instruction
252// NOGFX89: error: invalid operand for instruction
253
254s_cbranch_join 100
255// NOSICI: error: invalid operand for instruction
256// NOGFX89: error: invalid operand for instruction
257
258s_abs_i32 s1, s2
259// SICI: s_abs_i32 s1, s2 ; encoding: [0x02,0x34,0x81,0xbe]
260// GFX89: s_abs_i32 s1, s2 ; encoding: [0x02,0x30,0x81,0xbe]
261
262s_mov_fed_b32 s1, s2
263// SICI: s_mov_fed_b32 s1, s2 ; encoding: [0x02,0x35,0x81,0xbe]
264
265s_set_gpr_idx_idx s0
266// GFX89: s_set_gpr_idx_idx s0 ; encoding: [0x00,0x32,0x80,0xbe]
267// NOSICI: error: instruction not supported on this GPU
268
269s_andn1_saveexec_b64 s[100:101], s[2:3]
270// GFX9:     s_andn1_saveexec_b64 s[100:101], s[2:3] ; encoding: [0x02,0x33,0xe4,0xbe]
271// NOSICIVI: error: instruction not supported on this GPU
272
273s_andn1_saveexec_b64 s[10:11], s[4:5]
274// GFX9:     s_andn1_saveexec_b64 s[10:11], s[4:5] ; encoding: [0x04,0x33,0x8a,0xbe]
275// NOSICIVI: error: instruction not supported on this GPU
276
277s_andn1_saveexec_b64 s[10:11], -1
278// GFX9:     s_andn1_saveexec_b64 s[10:11], -1 ; encoding: [0xc1,0x33,0x8a,0xbe]
279// NOSICIVI: error: instruction not supported on this GPU
280
281s_andn1_saveexec_b64 s[10:11], 0xaf123456
282// GFX9:     s_andn1_saveexec_b64 s[10:11], 0xaf123456 ; encoding: [0xff,0x33,0x8a,0xbe,0x56,0x34,0x12,0xaf]
283// NOSICIVI: error: instruction not supported on this GPU
284
285s_andn1_wrexec_b64 s[10:11], s[2:3]
286// GFX9:     s_andn1_wrexec_b64 s[10:11], s[2:3] ; encoding: [0x02,0x35,0x8a,0xbe]
287// NOSICIVI: error: instruction not supported on this GPU
288
289s_andn2_wrexec_b64 s[12:13], s[2:3]
290// GFX9:     s_andn2_wrexec_b64 s[12:13], s[2:3] ; encoding: [0x02,0x36,0x8c,0xbe]
291// NOSICIVI: error: instruction not supported on this GPU
292
293s_orn1_saveexec_b64 s[10:11], 0
294// GFX9:     s_orn1_saveexec_b64 s[10:11], 0 ; encoding: [0x80,0x34,0x8a,0xbe]
295// NOSICIVI: error: instruction not supported on this GPU
296
297s_bitreplicate_b64_b32 s[10:11], s101
298// GFX9:     s_bitreplicate_b64_b32 s[10:11], s101 ; encoding: [0x65,0x37,0x8a,0xbe]
299// NOSICIVI: error: instruction not supported on this GPU
300
301s_bitreplicate_b64_b32 s[10:11], -1
302// GFX9:     s_bitreplicate_b64_b32 s[10:11], -1 ; encoding: [0xc1,0x37,0x8a,0xbe]
303// NOSICIVI: error: instruction not supported on this GPU
304
305s_bitreplicate_b64_b32 s[10:11], 0x3f717273
306// GFX9:     s_bitreplicate_b64_b32 s[10:11], 0x3f717273 ; encoding: [0xff,0x37,0x8a,0xbe,0x73,0x72,0x71,0x3f]
307// NOSICIVI: error: instruction not supported on this GPU
308