1// RUN: not llvm-mc -arch=amdgcn -show-encoding %s | FileCheck --check-prefix=SICI %s
2// RUN: not llvm-mc -arch=amdgcn -mcpu=tahiti -show-encoding %s | FileCheck --check-prefix=SICI %s
3// RUN: not llvm-mc -arch=amdgcn -mcpu=tonga -show-encoding %s | FileCheck --check-prefix=VI %s
4// RUN: not llvm-mc -arch=amdgcn -mcpu=gfx900 -show-encoding %s | FileCheck -check-prefix=GFX9 %s
5// RUN: not llvm-mc -arch=amdgcn -mcpu=gfx1010 -show-encoding %s | FileCheck -check-prefix=GFX10 %s
6// RUN: not llvm-mc -arch=amdgcn -mcpu=gfx1100 -show-encoding %s | FileCheck -check-prefix=GFX11 %s
7
8// RUN: not llvm-mc -arch=amdgcn %s 2>&1 | FileCheck -check-prefixes=GCN,SICIVI-ERR --implicit-check-not=error: %s
9// RUN: not llvm-mc -arch=amdgcn -mcpu=tahiti %s 2>&1 | FileCheck -check-prefixes=GCN,SICIVI-ERR --implicit-check-not=error: %s
10// RUN: not llvm-mc -arch=amdgcn -mcpu=tonga %s 2>&1 | FileCheck -check-prefixes=GCN,SICIVI-ERR --implicit-check-not=error: %s
11// RUN: not llvm-mc -arch=amdgcn -mcpu=gfx900 %s 2>&1 | FileCheck -check-prefixes=GCN,GFX9-ERR --implicit-check-not=error: %s
12// RUN: not llvm-mc -arch=amdgcn -mcpu=gfx1010 %s 2>&1 | FileCheck -check-prefixes=GCN,GFX10-ERR --implicit-check-not=error: %s
13// RUN: not llvm-mc -arch=amdgcn -mcpu=gfx1100 %s 2>&1 | FileCheck -check-prefixes=GCN,GFX11-ERR --implicit-check-not=error: %s
14
15s_setreg_b32  0x1f803, s2
16// GCN: error: invalid immediate: only 16-bit values are legal
17
18s_setreg_b32  typo(0x40), s2
19// GCN: error: expected a hwreg macro or an absolute expression
20
21s_setreg_b32  hwreg(0x40), s2
22// GCN: error: invalid code of hardware register: only 6-bit values are legal
23
24s_setreg_b32  hwreg(HW_REG_WRONG), s2
25// GCN: error: expected a register name or an absolute expression
26
27s_setreg_b32  hwreg(1 2,3), s2
28// GCN: error: expected a comma or a closing parenthesis
29
30s_setreg_b32  hwreg(1,2 3), s2
31// GCN: error: expected a comma
32
33s_setreg_b32  hwreg(1,2,3, s2
34// GCN: error: expected a closing parenthesis
35
36s_setreg_b32  hwreg(3,32,32), s2
37// GCN: error: invalid bit offset: only 5-bit values are legal
38
39s_setreg_b32  hwreg(3,0,33), s2
40// GCN: error: invalid bitfield width: only values from 1 to 32 are legal
41
42s_setreg_imm32_b32  0x1f803, 0xff
43// GCN: error: invalid immediate: only 16-bit values are legal
44
45s_setreg_imm32_b32  hwreg(3,0,33), 0xff
46// GCN: error: invalid bitfield width: only values from 1 to 32 are legal
47
48s_getreg_b32  s2, hwreg(3,32,32)
49// GCN: error: invalid bit offset: only 5-bit values are legal
50
51s_cbranch_i_fork s[2:3], 0x6
52// SICI: s_cbranch_i_fork s[2:3], 6 ; encoding: [0x06,0x00,0x82,0xb8]
53// GFX10-ERR: error: instruction not supported on this GPU
54// GFX9: s_cbranch_i_fork s[2:3], 6 ; encoding: [0x06,0x00,0x02,0xb8]
55// VI: s_cbranch_i_fork s[2:3], 6 ; encoding: [0x06,0x00,0x02,0xb8]
56// GFX11-ERR: error: instruction not supported on this GPU
57
58s_getreg_b32 s2, hwreg(HW_REG_SH_MEM_BASES)
59// GFX10:  s_getreg_b32 s2, hwreg(HW_REG_SH_MEM_BASES) ; encoding: [0x0f,0xf8,0x02,0xb9]
60// SICIVI-ERR: error: specified hardware register is not supported on this GPU
61// GFX9: s_getreg_b32 s2, hwreg(HW_REG_SH_MEM_BASES) ; encoding: [0x0f,0xf8,0x82,0xb8]
62// GFX11: s_getreg_b32 s2, hwreg(HW_REG_SH_MEM_BASES) ; encoding: [0x0f,0xf8,0x82,0xb8]
63
64s_getreg_b32 s2, hwreg(HW_REG_TBA_LO)
65// GFX10:    s_getreg_b32 s2, hwreg(HW_REG_TBA_LO) ; encoding: [0x10,0xf8,0x02,0xb9]
66// SICIVI-ERR: error: specified hardware register is not supported on this GPU
67// GFX11-ERR: error: specified hardware register is not supported on this GPU
68// GFX9:     s_getreg_b32 s2, hwreg(HW_REG_TBA_LO)   ; encoding: [0x10,0xf8,0x82,0xb8]
69
70s_getreg_b32 s2, hwreg(HW_REG_TBA_HI)
71// GFX10:    s_getreg_b32 s2, hwreg(HW_REG_TBA_HI) ; encoding: [0x11,0xf8,0x02,0xb9]
72// SICIVI-ERR: error: specified hardware register is not supported on this GPU
73// GFX11-ERR: error: specified hardware register is not supported on this GPU
74// GFX9:     s_getreg_b32 s2, hwreg(HW_REG_TBA_HI)   ; encoding: [0x11,0xf8,0x82,0xb8]
75
76s_getreg_b32 s2, hwreg(HW_REG_TMA_LO)
77// GFX10:    s_getreg_b32 s2, hwreg(HW_REG_TMA_LO) ; encoding: [0x12,0xf8,0x02,0xb9]
78// SICIVI-ERR: error: specified hardware register is not supported on this GPU
79// GFX11-ERR: error: specified hardware register is not supported on this GPU
80// GFX9:     s_getreg_b32 s2, hwreg(HW_REG_TMA_LO)   ; encoding: [0x12,0xf8,0x82,0xb8]
81
82s_getreg_b32 s2, hwreg(HW_REG_TMA_HI)
83// GFX10:    s_getreg_b32 s2, hwreg(HW_REG_TMA_HI) ; encoding: [0x13,0xf8,0x02,0xb9]
84// SICIVI-ERR: error: specified hardware register is not supported on this GPU
85// GFX11-ERR: error: specified hardware register is not supported on this GPU
86// GFX9:     s_getreg_b32 s2, hwreg(HW_REG_TMA_HI)   ; encoding: [0x13,0xf8,0x82,0xb8]
87
88s_getreg_b32 s2, hwreg(HW_REG_FLAT_SCR_LO)
89// GFX10:    s_getreg_b32 s2, hwreg(HW_REG_FLAT_SCR_LO) ; encoding: [0x14,0xf8,0x02,0xb9]
90// SICIVI-ERR: error: specified hardware register is not supported on this GPU
91// GFX9-ERR: error: specified hardware register is not supported on this GPU
92// GFX11: s_getreg_b32 s2, hwreg(HW_REG_FLAT_SCR_LO) ; encoding: [0x14,0xf8,0x82,0xb8]
93
94s_getreg_b32 s2, hwreg(HW_REG_FLAT_SCR_HI)
95// GFX10:    s_getreg_b32 s2, hwreg(HW_REG_FLAT_SCR_HI) ; encoding: [0x15,0xf8,0x02,0xb9]
96// SICIVI-ERR: error: specified hardware register is not supported on this GPU
97// GFX9-ERR: error: specified hardware register is not supported on this GPU
98// GFX11: s_getreg_b32 s2, hwreg(HW_REG_FLAT_SCR_HI) ; encoding: [0x15,0xf8,0x82,0xb8]
99
100s_getreg_b32 s2, hwreg(HW_REG_XNACK_MASK)
101// GFX10:    s_getreg_b32 s2, hwreg(HW_REG_XNACK_MASK) ; encoding: [0x16,0xf8,0x02,0xb9]
102// SICIVI-ERR: error: specified hardware register is not supported on this GPU
103// GFX9-ERR: error: specified hardware register is not supported on this GPU
104// GFX11-ERR: error: specified hardware register is not supported on this GPU
105
106s_getreg_b32 s2, hwreg(HW_REG_POPS_PACKER)
107// GFX10:    s_getreg_b32 s2, hwreg(HW_REG_POPS_PACKER) ; encoding: [0x19,0xf8,0x02,0xb9]
108// SICIVI-ERR: error: specified hardware register is not supported on this GPU
109// GFX9-ERR: error: specified hardware register is not supported on this GPU
110// GFX11-ERR: error: specified hardware register is not supported on this GPU
111
112s_cmpk_le_u32 s2, -1
113// GCN: error: invalid operand for instruction
114
115s_cmpk_le_u32 s2, 0x1ffff
116// GCN: error: invalid operand for instruction
117
118s_cmpk_le_u32 s2, 0x10000
119// GCN: error: invalid operand for instruction
120
121s_mulk_i32 s2, 0xFFFFFFFFFFFF0000
122// GCN: error: invalid operand for instruction
123
124s_mulk_i32 s2, 0x10000
125// GCN: error: invalid operand for instruction
126