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=tonga -show-encoding %s | FileCheck -check-prefix=VI -check-prefix=GCN %s
3
4// RUN: not llvm-mc -arch=amdgcn -mcpu=gfx900 2>&1 %s | FileCheck -check-prefix=GFX9-ERR -check-prefix=GCNERR --implicit-check-not=error: %s
5// RUN: not llvm-mc -arch=amdgcn -mcpu=tonga 2>&1 %s | FileCheck -check-prefix=VI-ERR -check-prefix=GCNERR --implicit-check-not=error: %s
6
7
8flat_load_dword v1, v[3:4] offset:0
9// GCN: flat_load_dword v1, v[3:4]      ; encoding: [0x00,0x00,0x50,0xdc,0x03,0x00,0x00,0x01]
10
11flat_load_dword v1, v[3:4] offset:-1
12// VI-ERR: :28: error: flat offset modifier is not supported on this GPU
13// GFX9-ERR: :28: error: expected a 12-bit unsigned offset
14
15flat_load_dword v1, v[3:4] offset:4095
16// GFX9: flat_load_dword v1, v[3:4] offset:4095 ; encoding: [0xff,0x0f,0x50,0xdc,0x03,0x00,0x00,0x01]
17// VI-ERR: :28: error: flat offset modifier is not supported on this GPU
18
19flat_load_dword v1, v[3:4] offset:4096
20// VI-ERR: :28: error: flat offset modifier is not supported on this GPU
21// GFX9-ERR: :28: error: expected a 12-bit unsigned offset
22
23flat_load_dword v1, v[3:4] offset:4 glc
24// GFX9: flat_load_dword v1, v[3:4] offset:4 glc ; encoding: [0x04,0x00,0x51,0xdc,0x03,0x00,0x00,0x01]
25// VI-ERR: :28: error: flat offset modifier is not supported on this GPU
26
27flat_load_dword v1, v[3:4] offset:4 glc slc
28// GFX9: flat_load_dword v1, v[3:4] offset:4 glc slc ; encoding: [0x04,0x00,0x53,0xdc,0x03,0x00,0x00,0x01]
29// VI-ERR: :28: error: flat offset modifier is not supported on this GPU
30
31flat_atomic_add v[3:4], v5 offset:8 slc
32// GFX9: flat_atomic_add v[3:4], v5 offset:8 slc ; encoding: [0x08,0x00,0x0a,0xdd,0x03,0x05,0x00,0x00]
33// VI-ERR: :28: error: flat offset modifier is not supported on this GPU
34
35flat_atomic_add v[3:4], v5 inst_offset:8 slc
36// GFX9: flat_atomic_add v[3:4], v5 offset:8 slc ; encoding: [0x08,0x00,0x0a,0xdd,0x03,0x05,0x00,0x00]
37// VI-ERR: :28: error: flat offset modifier is not supported on this GPU
38
39flat_atomic_cmpswap v[1:2], v[3:4] offset:4095
40// GFX9: flat_atomic_cmpswap v[1:2], v[3:4] offset:4095 ; encoding: [0xff,0x0f,0x04,0xdd,0x01,0x03,0x00,0x00]
41// VI-ERR: :36: error: flat offset modifier is not supported on this GPU
42
43flat_atomic_cmpswap v[1:2], v[3:4] offset:4095 slc
44// GFX9: flat_atomic_cmpswap v[1:2], v[3:4] offset:4095 slc ; encoding: [0xff,0x0f,0x06,0xdd,0x01,0x03,0x00,0x00]
45// VI-ERR: :36: error: flat offset modifier is not supported on this GPU
46
47flat_atomic_cmpswap v[1:2], v[3:4]
48// GFX9: flat_atomic_cmpswap v[1:2], v[3:4] ; encoding: [0x00,0x00,0x04,0xdd,0x01,0x03,0x00,0x00]
49// VI:   flat_atomic_cmpswap v[1:2], v[3:4] ; encoding: [0x00,0x00,0x04,0xdd,0x01,0x03,0x00,0x00]
50
51flat_atomic_cmpswap v[1:2], v[3:4] slc
52// GFX9: flat_atomic_cmpswap v[1:2], v[3:4] slc ; encoding: [0x00,0x00,0x06,0xdd,0x01,0x03,0x00,0x00]
53// VI:   flat_atomic_cmpswap v[1:2], v[3:4] slc ; encoding: [0x00,0x00,0x06,0xdd,0x01,0x03,0x00,0x00]
54
55flat_atomic_cmpswap v[1:2], v[3:4] offset:4095 glc
56// GCNERR: error: invalid operand for instruction
57
58flat_atomic_cmpswap v[1:2], v[3:4] glc
59// GCNERR: error: invalid operand for instruction
60
61flat_atomic_cmpswap v0, v[1:2], v[3:4] offset:4095 glc
62// GFX9: flat_atomic_cmpswap v0, v[1:2], v[3:4] offset:4095 glc ; encoding: [0xff,0x0f,0x05,0xdd,0x01,0x03,0x00,0x00]
63// VI-ERR: :40: error: flat offset modifier is not supported on this GPU
64
65flat_atomic_cmpswap v0, v[1:2], v[3:4] offset:4095 glc slc
66// GFX9: flat_atomic_cmpswap v0, v[1:2], v[3:4] offset:4095 glc slc ; encoding: [0xff,0x0f,0x07,0xdd,0x01,0x03,0x00,0x00]
67// VI-ERR: :40: error: flat offset modifier is not supported on this GPU
68
69flat_atomic_cmpswap v0, v[1:2], v[3:4] glc
70// GFX9: flat_atomic_cmpswap v0, v[1:2], v[3:4] glc ; encoding: [0x00,0x00,0x05,0xdd,0x01,0x03,0x00,0x00]
71// VI:   flat_atomic_cmpswap v0, v[1:2], v[3:4] glc ; encoding: [0x00,0x00,0x05,0xdd,0x01,0x03,0x00,0x00]
72
73flat_atomic_cmpswap v0, v[1:2], v[3:4] glc slc
74// GFX9: flat_atomic_cmpswap v0, v[1:2], v[3:4] glc slc ; encoding: [0x00,0x00,0x07,0xdd,0x01,0x03,0x00,0x00]
75// VI:   flat_atomic_cmpswap v0, v[1:2], v[3:4] glc slc ; encoding: [0x00,0x00,0x07,0xdd,0x01,0x03,0x00,0x00]
76
77flat_atomic_cmpswap v0, v[1:2], v[3:4]
78// GCNERR: error: instruction must use glc
79
80flat_atomic_cmpswap v0, v[1:2], v[3:4] offset:4095
81// GFX9-ERR: error: instruction must use glc
82// VI-ERR: error: flat offset modifier is not supported on this GPU
83
84flat_atomic_cmpswap v0, v[1:2], v[3:4] slc
85// GCNERR: error: instruction must use glc
86
87flat_atomic_swap v[3:4], v5 offset:16
88// GFX9: flat_atomic_swap v[3:4], v5 offset:16 ; encoding: [0x10,0x00,0x00,0xdd,0x03,0x05,0x00,0x00]
89// VI-ERR: :29: error: flat offset modifier is not supported on this GPU
90
91flat_store_dword v[3:4], v1 offset:16
92// GFX9: flat_store_dword v[3:4], v1 offset:16 ; encoding: [0x10,0x00,0x70,0xdc,0x03,0x01,0x00,0x00]
93// VI-ERR: :29: error: flat offset modifier is not supported on this GPU
94
95flat_store_dword v[3:4], v1, off
96// GCNERR: :30: error: invalid operand for instruction
97
98flat_store_dword v[3:4], v1, s[0:1]
99// GCNERR: :30: error: invalid operand for instruction
100
101flat_store_dword v[3:4], v1, s0
102// GCNERR: :30: error: invalid operand for instruction
103
104flat_load_dword v1, v[3:4], off
105// GCNERR: :29: error: invalid operand for instruction
106
107flat_load_dword v1, v[3:4], s[0:1]
108// GCNERR: :29: error: invalid operand for instruction
109
110flat_load_dword v1, v[3:4], s0
111// GCNERR: :29: error: invalid operand for instruction
112
113flat_load_dword v1, v[3:4], exec_hi
114// GCNERR: :29: error: invalid operand for instruction
115
116flat_store_dword v[3:4], v1, exec_hi
117// GCNERR: :30: error: invalid operand for instruction
118
119flat_load_ubyte_d16 v1, v[3:4]
120// GFX9: flat_load_ubyte_d16 v1, v[3:4]  ; encoding: [0x00,0x00,0x80,0xdc,0x03,0x00,0x00,0x01]
121// VI-ERR: error: instruction not supported on this GPU
122
123flat_load_ubyte_d16_hi v1, v[3:4]
124// GFX9: flat_load_ubyte_d16_hi v1, v[3:4] ; encoding: [0x00,0x00,0x84,0xdc,0x03,0x00,0x00,0x01]
125// VI-ERR: error: instruction not supported on this GPU
126
127flat_load_sbyte_d16 v1, v[3:4]
128// GFX9: flat_load_sbyte_d16 v1, v[3:4]  ; encoding: [0x00,0x00,0x88,0xdc,0x03,0x00,0x00,0x01]
129// VI-ERR: error: instruction not supported on this GPU
130
131flat_load_sbyte_d16_hi v1, v[3:4]
132// GFX9: flat_load_sbyte_d16_hi v1, v[3:4] ; encoding: [0x00,0x00,0x8c,0xdc,0x03,0x00,0x00,0x01]
133// VI-ERR: error: instruction not supported on this GPU
134
135flat_load_short_d16 v1, v[3:4]
136// GFX9: flat_load_short_d16 v1, v[3:4]  ; encoding: [0x00,0x00,0x90,0xdc,0x03,0x00,0x00,0x01]
137// VI-ERR: error: instruction not supported on this GPU
138
139flat_load_short_d16_hi v1, v[3:4]
140// GFX9: flat_load_short_d16_hi v1, v[3:4] ; encoding: [0x00,0x00,0x94,0xdc,0x03,0x00,0x00,0x01]
141// VI-ERR: error: instruction not supported on this GPU
142
143flat_store_byte_d16_hi v[3:4], v1
144// GFX9: flat_store_byte_d16_hi v[3:4], v1 ; encoding: [0x00,0x00,0x64,0xdc,0x03,0x01,0x00,0x00]
145// VI-ERR: error: instruction not supported on this GPU
146
147flat_store_short_d16_hi v[3:4], v1
148// GFX9: flat_store_short_d16_hi v[3:4], v1 ; encoding: [0x00,0x00,0x6c,0xdc,0x03,0x01,0x00,0x00
149// VI-ERR: error: instruction not supported on this GPU
150