xref: /aosp_15_r20/external/llvm/test/MC/AMDGPU/trap.s (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker// RUN: llvm-mc -arch=amdgcn -show-encoding %s | FileCheck %s --check-prefix=SICI
2*9880d681SAndroid Build Coastguard Worker// RUN: llvm-mc -arch=amdgcn -mcpu=SI -show-encoding %s | FileCheck %s --check-prefix=SICI
3*9880d681SAndroid Build Coastguard Worker// RUN: llvm-mc -arch=amdgcn -mcpu=fiji -show-encoding %s | FileCheck %s --check-prefix=VI
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===//
6*9880d681SAndroid Build Coastguard Worker// Trap Handler related - 32 bit registers
7*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===//
8*9880d681SAndroid Build Coastguard Worker
9*9880d681SAndroid Build Coastguard Workers_add_u32     ttmp0, ttmp0, 4
10*9880d681SAndroid Build Coastguard Worker// SICI: s_add_u32 ttmp0, ttmp0, 4       ; encoding: [0x70,0x84,0x70,0x80]
11*9880d681SAndroid Build Coastguard Worker// VI:   s_add_u32 ttmp0, ttmp0, 4       ; encoding: [0x70,0x84,0x70,0x80]
12*9880d681SAndroid Build Coastguard Worker
13*9880d681SAndroid Build Coastguard Workers_add_u32     ttmp4, 8, ttmp4
14*9880d681SAndroid Build Coastguard Worker// SICI: s_add_u32 ttmp4, 8, ttmp4       ; encoding: [0x88,0x74,0x74,0x80]
15*9880d681SAndroid Build Coastguard Worker// VI:   s_add_u32 ttmp4, 8, ttmp4       ; encoding: [0x88,0x74,0x74,0x80]
16*9880d681SAndroid Build Coastguard Worker
17*9880d681SAndroid Build Coastguard Workers_add_u32     ttmp4, ttmp4, 0x00000100
18*9880d681SAndroid Build Coastguard Worker// SICI: s_add_u32 ttmp4, ttmp4, 0x100   ; encoding: [0x74,0xff,0x74,0x80,0x00,0x01,0x00,0x00]
19*9880d681SAndroid Build Coastguard Worker// VI:   s_add_u32 ttmp4, ttmp4, 0x100   ; encoding: [0x74,0xff,0x74,0x80,0x00,0x01,0x00,0x00]
20*9880d681SAndroid Build Coastguard Worker
21*9880d681SAndroid Build Coastguard Workers_add_u32     ttmp4, ttmp4, 4
22*9880d681SAndroid Build Coastguard Worker// SICI: s_add_u32 ttmp4, ttmp4, 4       ; encoding: [0x74,0x84,0x74,0x80]
23*9880d681SAndroid Build Coastguard Worker// VI:   s_add_u32 ttmp4, ttmp4, 4       ; encoding: [0x74,0x84,0x74,0x80]
24*9880d681SAndroid Build Coastguard Worker
25*9880d681SAndroid Build Coastguard Workers_add_u32     ttmp4, ttmp8, ttmp4
26*9880d681SAndroid Build Coastguard Worker// SICI: s_add_u32 ttmp4, ttmp8, ttmp4   ; encoding: [0x78,0x74,0x74,0x80]
27*9880d681SAndroid Build Coastguard Worker// VI:   s_add_u32 ttmp4, ttmp8, ttmp4   ; encoding: [0x78,0x74,0x74,0x80]
28*9880d681SAndroid Build Coastguard Worker
29*9880d681SAndroid Build Coastguard Workers_and_b32     ttmp10, ttmp8, 0x00000080
30*9880d681SAndroid Build Coastguard Worker// SICI: s_and_b32 ttmp10, ttmp8, 0x80   ; encoding: [0x78,0xff,0x7a,0x87,0x80,0x00,0x00,0x00]
31*9880d681SAndroid Build Coastguard Worker// VI:   s_and_b32 ttmp10, ttmp8, 0x80   ; encoding: [0x78,0xff,0x7a,0x86,0x80,0x00,0x00,0x00]
32*9880d681SAndroid Build Coastguard Worker
33*9880d681SAndroid Build Coastguard Workers_and_b32     ttmp9, tma_hi, 0x0000ffff
34*9880d681SAndroid Build Coastguard Worker// SICI: s_and_b32 ttmp9, tma_hi, 0xffff ; encoding: [0x6f,0xff,0x79,0x87,0xff,0xff,0x00,0x00]
35*9880d681SAndroid Build Coastguard Worker// VI:   s_and_b32 ttmp9, tma_hi, 0xffff ; encoding: [0x6f,0xff,0x79,0x86,0xff,0xff,0x00,0x00]
36*9880d681SAndroid Build Coastguard Worker
37*9880d681SAndroid Build Coastguard Workers_and_b32     ttmp9, ttmp9, 0x000001ff
38*9880d681SAndroid Build Coastguard Worker// SICI: s_and_b32 ttmp9, ttmp9, 0x1ff   ; encoding: [0x79,0xff,0x79,0x87,0xff,0x01,0x00,0x00]
39*9880d681SAndroid Build Coastguard Worker// VI:   s_and_b32 ttmp9, ttmp9, 0x1ff   ; encoding: [0x79,0xff,0x79,0x86,0xff,0x01,0x00,0x00]
40*9880d681SAndroid Build Coastguard Worker
41*9880d681SAndroid Build Coastguard Workers_and_b32     ttmp9, tma_lo, 0xffff0000
42*9880d681SAndroid Build Coastguard Worker// SICI: s_and_b32 ttmp9, tma_lo, 0xffff0000 ; encoding: [0x6e,0xff,0x79,0x87,0x00,0x00,0xff,0xff]
43*9880d681SAndroid Build Coastguard Worker// VI:   s_and_b32 ttmp9, tma_lo, 0xffff0000 ; encoding: [0x6e,0xff,0x79,0x86,0x00,0x00,0xff,0xff]
44*9880d681SAndroid Build Coastguard Worker
45*9880d681SAndroid Build Coastguard Workers_and_b32     ttmp9, ttmp9, ttmp8
46*9880d681SAndroid Build Coastguard Worker// SICI: s_and_b32 ttmp9, ttmp9, ttmp8   ; encoding: [0x79,0x78,0x79,0x87]
47*9880d681SAndroid Build Coastguard Worker// VI:   s_and_b32 ttmp9, ttmp9, ttmp8   ; encoding: [0x79,0x78,0x79,0x86]
48*9880d681SAndroid Build Coastguard Worker
49*9880d681SAndroid Build Coastguard Workers_and_b32   ttmp8, ttmp1, 0x01000000
50*9880d681SAndroid Build Coastguard Worker// SICI: s_and_b32 ttmp8, ttmp1, 0x1000000 ; encoding: [0x71,0xff,0x78,0x87,0x00,0x00,0x00,0x01]
51*9880d681SAndroid Build Coastguard Worker// VI:   s_and_b32 ttmp8, ttmp1, 0x1000000 ; encoding: [0x71,0xff,0x78,0x86,0x00,0x00,0x00,0x01]
52*9880d681SAndroid Build Coastguard Worker
53*9880d681SAndroid Build Coastguard Workers_cmp_eq_i32  ttmp8, 0
54*9880d681SAndroid Build Coastguard Worker// SICI: s_cmp_eq_i32 ttmp8, 0           ; encoding: [0x78,0x80,0x00,0xbf]
55*9880d681SAndroid Build Coastguard Worker// VI:   s_cmp_eq_i32 ttmp8, 0           ; encoding: [0x78,0x80,0x00,0xbf]
56*9880d681SAndroid Build Coastguard Worker
57*9880d681SAndroid Build Coastguard Workers_cmp_eq_i32  ttmp8, 0x000000fe
58*9880d681SAndroid Build Coastguard Worker// SICI: s_cmp_eq_i32 ttmp8, 0xfe        ; encoding: [0x78,0xff,0x00,0xbf,0xfe,0x00,0x00,0x00]
59*9880d681SAndroid Build Coastguard Worker// VI:   s_cmp_eq_i32 ttmp8, 0xfe        ; encoding: [0x78,0xff,0x00,0xbf,0xfe,0x00,0x00,0x00]
60*9880d681SAndroid Build Coastguard Worker
61*9880d681SAndroid Build Coastguard Workers_lshr_b32    ttmp8, ttmp8, 12
62*9880d681SAndroid Build Coastguard Worker// SICI: s_lshr_b32 ttmp8, ttmp8, 12     ; encoding: [0x78,0x8c,0x78,0x90]
63*9880d681SAndroid Build Coastguard Worker// VI:   s_lshr_b32 ttmp8, ttmp8, 12     ; encoding: [0x78,0x8c,0x78,0x8f]
64*9880d681SAndroid Build Coastguard Worker
65*9880d681SAndroid Build Coastguard Workerv_mov_b32     v1, ttmp8
66*9880d681SAndroid Build Coastguard Worker// SICI: v_mov_b32_e32 v1, ttmp8         ; encoding: [0x78,0x02,0x02,0x7e]
67*9880d681SAndroid Build Coastguard Worker// VI:   v_mov_b32_e32 v1, ttmp8         ; encoding: [0x78,0x02,0x02,0x7e]
68*9880d681SAndroid Build Coastguard Worker
69*9880d681SAndroid Build Coastguard Workers_mov_b32     m0, ttmp8
70*9880d681SAndroid Build Coastguard Worker// SICI: s_mov_b32 m0, ttmp8             ; encoding: [0x78,0x03,0xfc,0xbe]
71*9880d681SAndroid Build Coastguard Worker// VI:   s_mov_b32 m0, ttmp8             ; encoding: [0x78,0x00,0xfc,0xbe]
72*9880d681SAndroid Build Coastguard Worker
73*9880d681SAndroid Build Coastguard Workers_mov_b32     ttmp10, 0
74*9880d681SAndroid Build Coastguard Worker// SICI: s_mov_b32 ttmp10, 0             ; encoding: [0x80,0x03,0xfa,0xbe]
75*9880d681SAndroid Build Coastguard Worker// VI:   s_mov_b32 ttmp10, 0             ; encoding: [0x80,0x00,0xfa,0xbe]
76*9880d681SAndroid Build Coastguard Worker
77*9880d681SAndroid Build Coastguard Workers_mov_b32     ttmp11, 0x01024fac
78*9880d681SAndroid Build Coastguard Worker// SICI: s_mov_b32 ttmp11, 0x1024fac     ; encoding: [0xff,0x03,0xfb,0xbe,0xac,0x4f,0x02,0x01]
79*9880d681SAndroid Build Coastguard Worker// VI:   s_mov_b32 ttmp11, 0x1024fac     ; encoding: [0xff,0x00,0xfb,0xbe,0xac,0x4f,0x02,0x01]
80*9880d681SAndroid Build Coastguard Worker
81*9880d681SAndroid Build Coastguard Workers_mov_b32     ttmp8, m0
82*9880d681SAndroid Build Coastguard Worker// SICI: s_mov_b32 ttmp8, m0             ; encoding: [0x7c,0x03,0xf8,0xbe]
83*9880d681SAndroid Build Coastguard Worker// VI:   s_mov_b32 ttmp8, m0             ; encoding: [0x7c,0x00,0xf8,0xbe]
84*9880d681SAndroid Build Coastguard Worker
85*9880d681SAndroid Build Coastguard Workers_mov_b32     ttmp8, tma_lo
86*9880d681SAndroid Build Coastguard Worker// SICI: s_mov_b32 ttmp8, tma_lo         ; encoding: [0x6e,0x03,0xf8,0xbe]
87*9880d681SAndroid Build Coastguard Worker// VI:   s_mov_b32 ttmp8, tma_lo         ; encoding: [0x6e,0x00,0xf8,0xbe]
88*9880d681SAndroid Build Coastguard Worker
89*9880d681SAndroid Build Coastguard Workers_mul_i32     ttmp8, 0x00000324, ttmp8
90*9880d681SAndroid Build Coastguard Worker// SICI: s_mul_i32 ttmp8, 0x324, ttmp8   ; encoding: [0xff,0x78,0x78,0x93,0x24,0x03,0x00,0x00]
91*9880d681SAndroid Build Coastguard Worker// VI:   s_mul_i32 ttmp8, 0x324, ttmp8   ; encoding: [0xff,0x78,0x78,0x92,0x24,0x03,0x00,0x00]
92*9880d681SAndroid Build Coastguard Worker
93*9880d681SAndroid Build Coastguard Workers_or_b32      ttmp9, ttmp9, 0x00280000
94*9880d681SAndroid Build Coastguard Worker// SICI: s_or_b32 ttmp9, ttmp9, 0x280000 ; encoding: [0x79,0xff,0x79,0x88,0x00,0x00,0x28,0x00]
95*9880d681SAndroid Build Coastguard Worker// VI:   s_or_b32 ttmp9, ttmp9, 0x280000 ; encoding: [0x79,0xff,0x79,0x87,0x00,0x00,0x28,0x00]
96*9880d681SAndroid Build Coastguard Worker
97*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===//
98*9880d681SAndroid Build Coastguard Worker// Trap Handler related - Pairs and quadruples of registers
99*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===//
100*9880d681SAndroid Build Coastguard Worker
101*9880d681SAndroid Build Coastguard Workers_mov_b64     ttmp[4:5], exec
102*9880d681SAndroid Build Coastguard Worker// SICI: s_mov_b64 ttmp[4:5], exec       ; encoding: [0x7e,0x04,0xf4,0xbe]
103*9880d681SAndroid Build Coastguard Worker// VI:   s_mov_b64 ttmp[4:5], exec       ; encoding: [0x7e,0x01,0xf4,0xbe]
104*9880d681SAndroid Build Coastguard Worker
105*9880d681SAndroid Build Coastguard Workers_mov_b64     [ttmp4,ttmp5], exec
106*9880d681SAndroid Build Coastguard Worker// SICI: s_mov_b64 ttmp[4:5], exec       ; encoding: [0x7e,0x04,0xf4,0xbe]
107*9880d681SAndroid Build Coastguard Worker// VI:   s_mov_b64 ttmp[4:5], exec       ; encoding: [0x7e,0x01,0xf4,0xbe]
108*9880d681SAndroid Build Coastguard Worker
109*9880d681SAndroid Build Coastguard Workers_mov_b64     exec, [ttmp4,ttmp5]
110*9880d681SAndroid Build Coastguard Worker// SICI: s_mov_b64 exec, ttmp[4:5]       ; encoding: [0x74,0x04,0xfe,0xbe]
111*9880d681SAndroid Build Coastguard Worker// VI:   s_mov_b64 exec, ttmp[4:5]       ; encoding: [0x74,0x01,0xfe,0xbe]
112*9880d681SAndroid Build Coastguard Worker
113*9880d681SAndroid Build Coastguard Workers_mov_b64     tba, ttmp[4:5]
114*9880d681SAndroid Build Coastguard Worker// SICI: s_mov_b64 tba, ttmp[4:5]        ; encoding: [0x74,0x04,0xec,0xbe]
115*9880d681SAndroid Build Coastguard Worker// VI:   s_mov_b64 tba, ttmp[4:5]        ; encoding: [0x74,0x01,0xec,0xbe]
116*9880d681SAndroid Build Coastguard Worker
117*9880d681SAndroid Build Coastguard Workers_mov_b64     ttmp[4:5], tba
118*9880d681SAndroid Build Coastguard Worker// SICI: s_mov_b64 ttmp[4:5], tba        ; encoding: [0x6c,0x04,0xf4,0xbe]
119*9880d681SAndroid Build Coastguard Worker// VI:   s_mov_b64 ttmp[4:5], tba        ; encoding: [0x6c,0x01,0xf4,0xbe]
120*9880d681SAndroid Build Coastguard Worker
121*9880d681SAndroid Build Coastguard Workers_mov_b64     tma, ttmp[4:5]
122*9880d681SAndroid Build Coastguard Worker// SICI: s_mov_b64 tma, ttmp[4:5]        ; encoding: [0x74,0x04,0xee,0xbe]
123*9880d681SAndroid Build Coastguard Worker// VI:   s_mov_b64 tma, ttmp[4:5]        ; encoding: [0x74,0x01,0xee,0xbe]
124*9880d681SAndroid Build Coastguard Worker
125*9880d681SAndroid Build Coastguard Workers_mov_b64     ttmp[4:5], tma
126*9880d681SAndroid Build Coastguard Worker// SICI: s_mov_b64 ttmp[4:5], tma        ; encoding: [0x6e,0x04,0xf4,0xbe]
127*9880d681SAndroid Build Coastguard Worker// VI:   s_mov_b64 ttmp[4:5], tma        ; encoding: [0x6e,0x01,0xf4,0xbe]
128*9880d681SAndroid Build Coastguard Worker
129*9880d681SAndroid Build Coastguard Worker
130*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===//
131*9880d681SAndroid Build Coastguard Worker// Trap Handler related - Some specific instructions
132*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===//
133*9880d681SAndroid Build Coastguard Worker
134*9880d681SAndroid Build Coastguard Workers_setpc_b64   [ttmp2,ttmp3]
135*9880d681SAndroid Build Coastguard Worker// SICI: s_setpc_b64 ttmp[2:3]           ; encoding: [0x72,0x20,0x80,0xbe]
136*9880d681SAndroid Build Coastguard Worker// VI:   s_setpc_b64 ttmp[2:3]           ; encoding: [0x72,0x1d,0x80,0xbe]
137*9880d681SAndroid Build Coastguard Worker
138*9880d681SAndroid Build Coastguard Workerv_readfirstlane_b32  ttmp8, v1
139*9880d681SAndroid Build Coastguard Worker// SICI: v_readfirstlane_b32 ttmp8, v1   ; encoding: [0x01,0x05,0xf0,0x7e]
140*9880d681SAndroid Build Coastguard Worker// VI:   v_readfirstlane_b32 ttmp8, v1   ; encoding: [0x01,0x05,0xf0,0x7e]
141*9880d681SAndroid Build Coastguard Worker
142*9880d681SAndroid Build Coastguard Workerbuffer_atomic_inc  v1, off, ttmp[8:11], 56 glc
143*9880d681SAndroid Build Coastguard Worker// SICI: buffer_atomic_inc v1, off, ttmp[8:11], 56  glc ; encoding: [0x00,0x40,0xf0,0xe0,0x00,0x01,0x1e,0xb8]
144*9880d681SAndroid Build Coastguard Worker// VI:   buffer_atomic_inc v1, off, ttmp[8:11], 56  glc ; encoding: [0x00,0x40,0x2c,0xe1,0x00,0x01,0x1e,0xb8]
145