1// RUN: not llvm-mc -arch=amdgcn -mcpu=gfx900 -show-encoding %s | FileCheck -check-prefix=GFX9 -check-prefix=GCN %s
2// RUN: not llvm-mc -arch=amdgcn -mcpu=gfx900 -show-encoding 2>&1 %s | FileCheck -check-prefix=GFX9-ERR -check-prefix=GCNERR %s
3// RUN: not llvm-mc -arch=amdgcn -mcpu=tonga -show-encoding 2>&1 %s | FileCheck -check-prefix=VI-ERR -check-prefix=GCNERR %s
4
5scratch_load_ubyte v1, v2, off
6// GFX9: scratch_load_ubyte v1, v2, off      ; encoding: [0x00,0x40,0x40,0xdc,0x02,0x00,0x7f,0x01]
7// VI-ERR: instruction not supported on this GPU
8
9scratch_load_sbyte v1, v2, off
10// GFX9: scratch_load_sbyte v1, v2, off      ; encoding: [0x00,0x40,0x44,0xdc,0x02,0x00,0x7f,0x01]
11// VI-ERR: instruction not supported on this GPU
12
13scratch_load_ushort v1, v2, off
14// GFX9: scratch_load_ushort v1, v2, off      ; encoding: [0x00,0x40,0x48,0xdc,0x02,0x00,0x7f,0x01]
15// VI-ERR: instruction not supported on this GPU
16
17scratch_load_sshort v1, v2, off
18// GFX9: scratch_load_sshort v1, v2, off      ; encoding: [0x00,0x40,0x4c,0xdc,0x02,0x00,0x7f,0x01]
19// VI-ERR: instruction not supported on this GPU
20
21scratch_load_dword v1, v2, off
22// GFX9: scratch_load_dword v1, v2, off ; encoding: [0x00,0x40,0x50,0xdc,0x02,0x00,0x7f,0x01]
23// VI-ERR: instruction not supported on this GPU
24
25scratch_load_dwordx2 v[1:2], v3, off
26// GFX9: scratch_load_dwordx2 v[1:2], v3, off      ; encoding: [0x00,0x40,0x54,0xdc,0x03,0x00,0x7f,0x01]
27// VI-ERR: instruction not supported on this GPU
28
29scratch_load_dwordx3 v[1:3], v4, off
30// GFX9: scratch_load_dwordx3 v[1:3], v4, off      ; encoding: [0x00,0x40,0x58,0xdc,0x04,0x00,0x7f,0x01]
31// VI-ERR: instruction not supported on this GPU
32
33scratch_load_dwordx4 v[1:4], v5, off
34// GFX9: scratch_load_dwordx4 v[1:4], v5, off      ; encoding: [0x00,0x40,0x5c,0xdc,0x05,0x00,0x7f,0x01]
35// VI-ERR: instruction not supported on this GPU
36// FIXME: VI error should be instruction nto supported
37
38scratch_load_dword v1, v2, off offset:0
39// GFX9: scratch_load_dword v1, v2, off      ; encoding: [0x00,0x40,0x50,0xdc,0x02,0x00,0x7f,0x01]
40// VI-ERR: error: not a valid operand.
41
42scratch_load_dword v1, v2, off offset:4095
43// GFX9: scratch_load_dword v1, v2, off offset:4095 ; encoding: [0xff,0x4f,0x50,0xdc,0x02,0x00,0x7f,0x01]
44// VI-ERR: error: not a valid operand.
45
46scratch_load_dword v1, v2, off offset:-1
47// GFX9: scratch_load_dword v1, v2, off offset:-1 ; encoding: [0xff,0x5f,0x50,0xdc,0x02,0x00,0x7f,0x01]
48// VI-ERR: error: not a valid operand.
49
50scratch_load_dword v1, v2, off offset:-4096
51// GFX9: scratch_load_dword v1, v2, off offset:-4096 ; encoding: [0x00,0x50,0x50,0xdc,0x02,0x00,0x7f,0x01]
52// VI-ERR: error: not a valid operand.
53
54scratch_load_dword v1, v2, off offset:4096
55// GFX9-ERR: error: invalid operand for instruction
56// VI-ERR: error: not a valid operand.
57
58scratch_load_dword v1, v2, off offset:-4097
59// GFX9-ERR: error: invalid operand for instruction
60// VI-ERR: error: not a valid operand.
61
62scratch_store_byte v1, v2, off
63// GFX9: scratch_store_byte v1, v2, off ; encoding: [0x00,0x40,0x60,0xdc,0x01,0x02,0x7f,0x00]
64// VI-ERR: instruction not supported on this GPU
65
66scratch_store_short v1, v2, off
67// GFX9: scratch_store_short v1, v2, off ; encoding: [0x00,0x40,0x68,0xdc,0x01,0x02,0x7f,0x00]
68// VI-ERR: instruction not supported on this GPU
69
70scratch_store_dword v1, v2, off
71// GFX9: scratch_store_dword v1, v2, off ; encoding: [0x00,0x40,0x70,0xdc,0x01,0x02,0x7f,0x00]
72// VI-ERR: instruction not supported on this GPU
73
74scratch_store_dwordx2 v1, v[2:3], off
75// GFX9: scratch_store_dwordx2 v1, v[2:3], off ; encoding: [0x00,0x40,0x74,0xdc,0x01,0x02,0x7f,0x00]
76// VI-ERR: instruction not supported on this GPU
77
78scratch_store_dwordx3 v1, v[2:4], off
79// GFX9: scratch_store_dwordx3 v1, v[2:4], off ; encoding: [0x00,0x40,0x78,0xdc,0x01,0x02,0x7f,0x00]
80// VI-ERR: instruction not supported on this GPU
81
82scratch_store_dwordx4 v1, v[2:5], off
83// GFX9: scratch_store_dwordx4 v1, v[2:5], off ; encoding: [0x00,0x40,0x7c,0xdc,0x01,0x02,0x7f,0x00]
84// VI-ERR: instruction not supported on this GPU
85
86scratch_store_dword v1, v2, off offset:12
87// GFX9: scratch_store_dword v1, v2, off offset:12 ; encoding: [0x0c,0x40,0x70,0xdc,0x01,0x02,0x7f,0x00]
88// VI-ERR: error: not a valid operand
89
90scratch_load_dword v1, off, s1
91// GFX9: scratch_load_dword v1, off, s1 ; encoding: [0x00,0x40,0x50,0xdc,0x00,0x00,0x01,0x01]
92// VI-ERR: instruction not supported on this GPU
93
94scratch_load_dword v1, off, s1 offset:32
95// GFX9: scratch_load_dword v1, off, s1 offset:32 ; encoding: [0x20,0x40,0x50,0xdc,0x00,0x00,0x01,0x01]
96// VI-ERR: error: not a valid operand
97
98scratch_store_dword off, v2, s1
99// GFX9: scratch_store_dword off, v2, s1 ; encoding: [0x00,0x40,0x70,0xdc,0x00,0x02,0x01,0x00]
100// VI-ERR: instruction not supported on this GPU
101
102scratch_store_dword off, v2, s1 offset:12
103// GFX9: scratch_store_dword off, v2, s1 offset:12 ; encoding: [0x0c,0x40,0x70,0xdc,0x00,0x02,0x01,0x00]
104// VI-ERR: error: not a valid operand
105
106// FIXME: Should error about multiple offsets
107scratch_load_dword v1, v2, s1
108// GFX9-ERR: error: invalid operand for instruction
109// VI-ERR: error: invalid operand for instruction
110
111scratch_load_dword v1, v2, s1 offset:32
112// GFX9-ERR: error: invalid operand for instruction
113// VI-ERR: error: not a valid operand
114
115scratch_store_dword v1, v2, s1
116// GFX9-ERR: error: invalid operand for instruction
117// VI-ERR: error: invalid operand for instruction
118
119scratch_store_dword v1, v2, s1 offset:32
120// GFX9-ERR: error: invalid operand for instruction
121// VI-ERR: error: not a valid operand
122
123scratch_load_dword v1, off, exec_hi
124// GFX9-ERR: error: invalid operand for instruction
125// VI-ERR: error: invalid operand for instruction
126
127scratch_store_dword off, v2, exec_hi
128// GFX9-ERR: error: invalid operand for instruction
129// VI-ERR: error: invalid operand for instruction
130
131scratch_load_dword v1, off, exec_lo
132// GFX9: scratch_load_dword v1, off, exec_lo ; encoding: [0x00,0x40,0x50,0xdc,0x00,0x00,0x7e,0x01]
133// VI-ERR: instruction not supported on this GPU
134
135scratch_store_dword off, v2, exec_lo
136// GFX9: scratch_store_dword off, v2, exec_lo ; encoding: [0x00,0x40,0x70,0xdc,0x00,0x02,0x7e,0x00]
137// VI-ERR: instruction not supported on this GPU
138
139scratch_load_dword v1, off, m0
140// GFX9: scratch_load_dword v1, off, m0  ; encoding: [0x00,0x40,0x50,0xdc,0x00,0x00,0x7c,0x01]
141// VI-ERR: instruction not supported on this GPU
142
143scratch_store_dword off, v2, m0
144// GFX9: scratch_store_dword off, v2, m0 ; encoding: [0x00,0x40,0x70,0xdc,0x00,0x02,0x7c,0x00]
145// VI-ERR: instruction not supported on this GPU
146
147scratch_load_ubyte_d16 v1, v2, off
148// GFX9: scratch_load_ubyte_d16 v1, v2, off ; encoding: [0x00,0x40,0x80,0xdc,0x02,0x00,0x7f,0x01]
149// VI-ERR: instruction not supported on this GPU
150
151scratch_load_ubyte_d16_hi v1, v2, off
152// GFX9: scratch_load_ubyte_d16_hi v1, v2, off ; encoding: [0x00,0x40,0x84,0xdc,0x02,0x00,0x7f,0x01]
153// VI-ERR: instruction not supported on this GPU
154
155scratch_load_sbyte_d16 v1, v2, off
156// GFX9: scratch_load_sbyte_d16 v1, v2, off ; encoding: [0x00,0x40,0x88,0xdc,0x02,0x00,0x7f,0x01]
157// VI-ERR: instruction not supported on this GPU
158
159scratch_load_sbyte_d16_hi v1, v2, off
160// GFX9: scratch_load_sbyte_d16_hi v1, v2, off ; encoding: [0x00,0x40,0x8c,0xdc,0x02,0x00,0x7f,0x01]
161// VI-ERR: instruction not supported on this GPU
162
163scratch_load_short_d16 v1, v2, off
164// GFX9: scratch_load_short_d16 v1, v2, off ; encoding: [0x00,0x40,0x90,0xdc,0x02,0x00,0x7f,0x01]
165// VI-ERR: instruction not supported on this GPU
166
167scratch_load_short_d16_hi v1, v2, off
168// GFX9: scratch_load_short_d16_hi v1, v2, off ; encoding: [0x00,0x40,0x94,0xdc,0x02,0x00,0x7f,0x01]
169// VI-ERR: instruction not supported on this GPU
170
171scratch_store_byte_d16_hi off, v2, s1
172// GFX9: scratch_store_byte_d16_hi off, v2, s1 ; encoding: [0x00,0x40,0x64,0xdc,0x00,0x02,0x01,0x00]
173// VI-ERR: instruction not supported on this GPU
174
175scratch_store_short_d16_hi off, v2, s1
176// GFX9: scratch_store_short_d16_hi off, v2, s1 ; encoding: [0x00,0x40,0x6c,0xdc,0x00,0x02,0x01,0x00]
177// VI-ERR: instruction not supported on this GPU
178