1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
4 //////////////////////////////////////////////////////////////////////////////
7 #if !defined(_TARGET_ARM64_)
8 #error Unexpected target type
12 //////////////////////////////////////////////////////////////////////////////
18 ID_OP_NONE, // no additional arguments
19 ID_OP_SCNS, // small const operand (21-bits or less, no reloc)
20 ID_OP_JMP, // local jump
21 ID_OP_CALL, // method call
22 ID_OP_SPEC, // special handling required
25 //////////////////////////////////////////////////////////////////////////////
26 #else // !DEFINE_ID_OPS
27 //////////////////////////////////////////////////////////////////////////////
30 #error Must define IF_DEF macro before including this file
33 //////////////////////////////////////////////////////////////////////////////
35 // enum insFormat instruction enum ID_OPS
38 //////////////////////////////////////////////////////////////////////////////
40 IF_DEF(NONE, IS_NONE, NONE) //
42 IF_DEF(LABEL, IS_NONE, JMP) // label
43 IF_DEF(LARGEJMP, IS_NONE, JMP) // large conditional branch pseudo-op (cond branch + uncond branch)
44 IF_DEF(LARGEADR, IS_NONE, JMP) // large address pseudo-op (adrp + add)
45 IF_DEF(LARGELDC, IS_NONE, JMP) // large constant pseudo-op (adrp + ldr)
47 /////////////////////////////////////////////////////////////////////////////////////////////////////////
49 IF_DEF(EN9, IS_NONE, NONE) // Instruction has 9 possible encoding types
50 IF_DEF(EN6A, IS_NONE, NONE) // Instruction has 6 possible encoding types, type A
51 IF_DEF(EN5A, IS_NONE, NONE) // Instruction has 5 possible encoding types, type A
52 IF_DEF(EN5B, IS_NONE, NONE) // Instruction has 5 possible encoding types, type B
53 IF_DEF(EN5C, IS_NONE, NONE) // Instruction has 5 possible encoding types, type C
54 IF_DEF(EN4A, IS_NONE, NONE) // Instruction has 4 possible encoding types, type A
55 IF_DEF(EN4B, IS_NONE, NONE) // Instruction has 4 possible encoding types, type B
56 IF_DEF(EN4C, IS_NONE, NONE) // Instruction has 4 possible encoding types, type C
57 IF_DEF(EN4D, IS_NONE, NONE) // Instruction has 4 possible encoding types, type D
58 IF_DEF(EN4E, IS_NONE, NONE) // Instruction has 4 possible encoding types, type E
59 IF_DEF(EN4F, IS_NONE, NONE) // Instruction has 4 possible encoding types, type F
60 IF_DEF(EN4G, IS_NONE, NONE) // Instruction has 4 possible encoding types, type G
61 IF_DEF(EN4H, IS_NONE, NONE) // Instruction has 4 possible encoding types, type H
62 IF_DEF(EN4I, IS_NONE, NONE) // Instruction has 4 possible encoding types, type I
63 IF_DEF(EN3A, IS_NONE, NONE) // Instruction has 3 possible encoding types, type A
64 IF_DEF(EN3B, IS_NONE, NONE) // Instruction has 3 possible encoding types, type B
65 IF_DEF(EN3C, IS_NONE, NONE) // Instruction has 3 possible encoding types, type C
66 IF_DEF(EN3D, IS_NONE, NONE) // Instruction has 3 possible encoding types, type D
67 IF_DEF(EN3E, IS_NONE, NONE) // Instruction has 3 possible encoding types, type E
68 IF_DEF(EN3F, IS_NONE, NONE) // Instruction has 3 possible encoding types, type F
69 IF_DEF(EN3G, IS_NONE, NONE) // Instruction has 3 possible encoding types, type G
70 IF_DEF(EN3H, IS_NONE, NONE) // Instruction has 3 possible encoding types, type H
71 IF_DEF(EN3I, IS_NONE, NONE) // Instruction has 3 possible encoding types, type I
72 IF_DEF(EN2A, IS_NONE, NONE) // Instruction has 2 possible encoding types, type A
73 IF_DEF(EN2B, IS_NONE, NONE) // Instruction has 2 possible encoding types, type B
74 IF_DEF(EN2C, IS_NONE, NONE) // Instruction has 2 possible encoding types, type C
75 IF_DEF(EN2D, IS_NONE, NONE) // Instruction has 2 possible encoding types, type D
76 IF_DEF(EN2E, IS_NONE, NONE) // Instruction has 2 possible encoding types, type E
77 IF_DEF(EN2F, IS_NONE, NONE) // Instruction has 2 possible encoding types, type F
78 IF_DEF(EN2G, IS_NONE, NONE) // Instruction has 2 possible encoding types, type G
79 IF_DEF(EN2H, IS_NONE, NONE) // Instruction has 2 possible encoding types, type H
80 IF_DEF(EN2I, IS_NONE, NONE) // Instruction has 2 possible encoding types, type I
81 IF_DEF(EN2J, IS_NONE, NONE) // Instruction has 2 possible encoding types, type J
82 IF_DEF(EN2K, IS_NONE, NONE) // Instruction has 2 possible encoding types, type K
83 IF_DEF(EN2L, IS_NONE, NONE) // Instruction has 2 possible encoding types, type L
84 IF_DEF(EN2M, IS_NONE, NONE) // Instruction has 2 possible encoding types, type M
85 IF_DEF(EN2N, IS_NONE, NONE) // Instruction has 2 possible encoding types, type N
86 IF_DEF(EN2O, IS_NONE, NONE) // Instruction has 2 possible encoding types, type O
87 IF_DEF(EN2P, IS_NONE, NONE) // Instruction has 2 possible encoding types, type P
89 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
91 // Key for insFormat names:
93 // Above (Specifies multiple encodings)
95 // EN#? :: (count of the number of encodings)
96 // (? is a unique letter A,B,C...)
98 // Below (Specifies an exact instruction encoding)
100 // -- the first two characters are
102 // DI :: Data Processing - Immediate
103 // DR :: Data Processing - Register
104 // DV :: Data Processing - Vector Register
105 // LS :: Loads and Stores
106 // BI :: Branches - Immediate
107 // BR :: Branches - Register
108 // SN :: System - No Registers or Immediates
109 // SI :: System - Immediate
111 // _ :: a separator char '_'
113 // -- the next two characters are
115 // # :: number of registers in the encoding
116 // ? :: A unique letter A,B,C,...
117 // -- optional third character
118 // I :: by elem immediate
120 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
122 IF_DEF(BI_0A, IS_NONE, JMP) // BI_0A ......iiiiiiiiii iiiiiiiiiiiiiiii simm26:00 b
123 IF_DEF(BI_0B, IS_NONE, JMP) // BI_0B ......iiiiiiiiii iiiiiiiiiii..... simm19:00 b<cond>
124 IF_DEF(BI_0C, IS_NONE, CALL) // BI_0C ......iiiiiiiiii iiiiiiiiiiiiiiii simm26:00 bl
125 IF_DEF(BI_1A, IS_NONE, JMP) // BI_1A X.......iiiiiiii iiiiiiiiiiittttt Rt simm19:00 cbz cbnz
126 IF_DEF(BI_1B, IS_NONE, JMP) // BI_1B B.......bbbbbiii iiiiiiiiiiittttt Rt imm6 simm14:00 tbz tbnz
127 IF_DEF(BR_1A, IS_NONE, CALL) // BR_1A ................ ......nnnnn..... Rn ret
128 IF_DEF(BR_1B, IS_NONE, CALL) // BR_1B ................ ......nnnnn..... Rn br blr
130 IF_DEF(LS_1A, IS_NONE, JMP) // LS_1A XX...V..iiiiiiii iiiiiiiiiiittttt Rt PC imm(1MB)
131 IF_DEF(LS_2A, IS_NONE, NONE) // LS_2A .X.......X...... ......nnnnnttttt Rt Rn
132 IF_DEF(LS_2B, IS_NONE, NONE) // LS_2B .X.......Xiiiiii iiiiiinnnnnttttt Rt Rn imm(0-4095)
133 IF_DEF(LS_2C, IS_NONE, NONE) // LS_2C .X.......X.iiiii iiiiP.nnnnnttttt Rt Rn imm(-256..+255) pre/post inc
134 IF_DEF(LS_3A, IS_NONE, NONE) // LS_3A .X.......X.mmmmm xxxS..nnnnnttttt Rt Rn Rm ext(Rm) LSL {}
135 IF_DEF(LS_3B, IS_NONE, NONE) // LS_3B X............... .aaaaannnnnddddd Rd Ra Rn
136 IF_DEF(LS_3C, IS_NONE, NONE) // LS_3C X.........iiiiii iaaaaannnnnddddd Rd Ra Rn imm(im7,sh)
137 IF_DEF(LS_3D, IS_NONE, NONE) // LS_3D .X.......X.mmmmm ......nnnnnttttt Wm Rt Rn
138 IF_DEF(LS_3E, IS_NONE, NONE) // LS_3E .X.........mmmmm ......nnnnnttttt Rm Rt Rn ARMv8.1 LSE Atomics
140 IF_DEF(DI_1A, IS_NONE, NONE) // DI_1A X.......shiiiiii iiiiiinnnnn..... Rn imm(i12,sh)
141 IF_DEF(DI_1B, IS_NONE, NONE) // DI_1B X........hwiiiii iiiiiiiiiiiddddd Rd imm(i16,hw)
142 IF_DEF(DI_1C, IS_NONE, NONE) // DI_1C X........Nrrrrrr ssssssnnnnn..... Rn imm(N,r,s)
143 IF_DEF(DI_1D, IS_NONE, NONE) // DI_1D X........Nrrrrrr ssssss.....ddddd Rd imm(N,r,s)
144 IF_DEF(DI_1E, IS_NONE, JMP) // DI_1E .ii.....iiiiiiii iiiiiiiiiiiddddd Rd simm21
145 IF_DEF(DI_1F, IS_NONE, NONE) // DI_1F X..........iiiii cccc..nnnnn.nzcv Rn imm5 nzcv cond
147 IF_DEF(DI_2A, IS_NONE, NONE) // DI_2A X.......shiiiiii iiiiiinnnnnddddd Rd Rn imm(i12,sh)
148 IF_DEF(DI_2B, IS_NONE, NONE) // DI_2B X.........Xnnnnn ssssssnnnnnddddd Rd Rn imm(0-63)
149 IF_DEF(DI_2C, IS_NONE, NONE) // DI_2C X........Nrrrrrr ssssssnnnnnddddd Rd Rn imm(N,r,s)
150 IF_DEF(DI_2D, IS_NONE, NONE) // DI_2D X........Nrrrrrr ssssssnnnnnddddd Rd Rn imr, imms (N,r,s)
152 IF_DEF(DR_1D, IS_NONE, NONE) // DR_1D X............... cccc.......ddddd Rd cond
154 IF_DEF(DR_2A, IS_NONE, NONE) // DR_2A X..........mmmmm ......nnnnn..... Rn Rm
155 IF_DEF(DR_2B, IS_NONE, NONE) // DR_2B X.......sh.mmmmm ssssssnnnnn..... Rn Rm {LSL,LSR,ASR} imm(0-63)
156 IF_DEF(DR_2C, IS_NONE, NONE) // DR_2C X..........mmmmm xxxsssnnnnn..... Rn Rm ext(Rm) LSL imm(0-4)
157 IF_DEF(DR_2D, IS_NONE, NONE) // DR_2D X..........nnnnn cccc..nnnnnddddd Rd Rn cond
158 IF_DEF(DR_2E, IS_NONE, NONE) // DR_2E X..........mmmmm ...........ddddd Rd Rm
159 IF_DEF(DR_2F, IS_NONE, NONE) // DR_2F X.......sh.mmmmm ssssss.....ddddd Rd Rm {LSL,LSR,ASR} imm(0-63)
160 IF_DEF(DR_2G, IS_NONE, NONE) // DR_2G X............... ......nnnnnddddd Rd Rn
161 IF_DEF(DR_2H, IS_NONE, NONE) // DR_2H X........X...... ......nnnnnddddd Rd Rn
162 IF_DEF(DR_2I, IS_NONE, NONE) // DR_2I X..........mmmmm cccc..nnnnn.nzcv Rn Rm nzcv cond
163 IF_DEF(DR_2J, IS_NONE, NONE) // DR_2J ................ ......nnnnnddddd Sd Sn
165 IF_DEF(DR_3A, IS_NONE, NONE) // DR_3A X..........mmmmm ......nnnnnddddd Rd Rn Rm
166 IF_DEF(DR_3B, IS_NONE, NONE) // DR_3B X.......sh.mmmmm ssssssnnnnnddddd Rd Rn Rm {LSL,LSR,ASR} imm(0-63)
167 IF_DEF(DR_3C, IS_NONE, NONE) // DR_3C X..........mmmmm xxxsssnnnnnddddd Rd Rn Rm ext(Rm) LSL imm(0-4)
168 IF_DEF(DR_3D, IS_NONE, NONE) // DR_3D X..........mmmmm cccc..nnnnnddddd Rd Rn Rm cond
169 IF_DEF(DR_3E, IS_NONE, NONE) // DR_3E X........X.mmmmm ssssssnnnnnddddd Rd Rn Rm imm(0-63)
171 IF_DEF(DR_4A, IS_NONE, NONE) // DR_4A X..........mmmmm .aaaaannnnnddddd Rd Rn Rm Ra
173 IF_DEF(DV_1A, IS_NONE, NONE) // DV_1A .........X.iiiii iii........ddddd Vd imm8 (fmov - immediate scalar)
174 IF_DEF(DV_1B, IS_NONE, NONE) // DV_1B .QX..........iii jjjj..iiiiiddddd Vd imm8 (fmov/movi - immediate vector)
175 IF_DEF(DV_1C, IS_NONE, NONE) // DV_1C .........X...... ......nnnnn..... Vn #0.0 (fcmp - with zero)
177 IF_DEF(DV_2A, IS_NONE, NONE) // DV_2A .Q.......X...... ......nnnnnddddd Vd Vn (fabs, fcvtXX - vector)
178 IF_DEF(DV_2B, IS_NONE, NONE) // DV_2B .Q.........iiiii ......nnnnnddddd Rd Vn[] (umov/smov - to general)
179 IF_DEF(DV_2C, IS_NONE, NONE) // DV_2C .Q.........iiiii ......nnnnnddddd Vd Rn (dup/ins - vector from
181 IF_DEF(DV_2D, IS_NONE, NONE) // DV_2D .Q.........iiiii ......nnnnnddddd Vd Vn[] (dup - vector)
182 IF_DEF(DV_2E, IS_NONE, NONE) // DV_2E ...........iiiii ......nnnnnddddd Vd Vn[] (dup - scalar)
183 IF_DEF(DV_2F, IS_NONE, NONE) // DV_2F ...........iiiii .jjjj.nnnnnddddd Vd[] Vn[] (ins - element)
184 IF_DEF(DV_2G, IS_NONE, NONE) // DV_2G .........X...... ......nnnnnddddd Vd Vn (fmov, fcvtXX - register)
185 IF_DEF(DV_2H, IS_NONE, NONE) // DV_2H X........X...... ......nnnnnddddd Rd Vn (fmov, fcvtXX - to general)
186 IF_DEF(DV_2I, IS_NONE, NONE) // DV_2I X........X...... ......nnnnnddddd Vd Rn (fmov, fcvtXX - from general)
187 IF_DEF(DV_2J, IS_NONE, NONE) // DV_2J .........d...... D.....nnnnnddddd Vd Vn (fcvt)
188 IF_DEF(DV_2K, IS_NONE, NONE) // DV_2K .........X.mmmmm ......nnnnn..... Vn Vm (fcmp)
189 IF_DEF(DV_2L, IS_NONE, NONE) // DV_2L ........XX...... ......nnnnnddddd Vd Vn (abs, neg - scalar)
190 IF_DEF(DV_2M, IS_NONE, NONE) // DV_2M .Q......XX...... ......nnnnnddddd Vd Vn (abs, neg - vector)
191 IF_DEF(DV_2N, IS_NONE, NONE) // DV_2N .........iiiiiii ......nnnnnddddd Vd Vn imm (shift - scalar)
192 IF_DEF(DV_2O, IS_NONE, NONE) // DV_2O .Q.......iiiiiii ......nnnnnddddd Vd Vn imm (shift - vector)
193 IF_DEF(DV_2P, IS_NONE, NONE) // DV_2P .,.............. ......nnnnnddddd Vd Vn (Vd used as both source and destination)
195 IF_DEF(DV_3A, IS_NONE, NONE) // DV_3A .Q......XX.mmmmm ......nnnnnddddd Vd Vn Vm (vector)
196 IF_DEF(DV_3AI, IS_NONE, NONE) // DV_3AI .Q......XXLMmmmm ....H.nnnnnddddd Vd Vn Vm[] (vector by elem)
197 IF_DEF(DV_3B, IS_NONE, NONE) // DV_3B .Q.......X.mmmmm ......nnnnnddddd Vd Vn Vm (vector)
198 IF_DEF(DV_3BI, IS_NONE, NONE) // DV_3BI .Q.......XLmmmmm ....H.nnnnnddddd Vd Vn Vm[] (vector by elem)
199 IF_DEF(DV_3C, IS_NONE, NONE) // DV_3C .Q.........mmmmm ......nnnnnddddd Vd Vn Vm (vector)
200 IF_DEF(DV_3D, IS_NONE, NONE) // DV_3D .........X.mmmmm ......nnnnnddddd Vd Vn Vm (scalar)
201 IF_DEF(DV_3DI, IS_NONE, NONE) // DV_3DI .........XLmmmmm ....H.nnnnnddddd Vd Vn Vm[] (scalar by elem)
202 IF_DEF(DV_3E, IS_NONE, NONE) // DV_3E ...........mmmmm ......nnnnnddddd Vd Vn Vm (scalar)
203 IF_DEF(DV_3F, IS_NONE, NONE) // DV_3F ...........mmmmm ......nnnnnddddd Qd Sn Vm (Qd used as both source and destination)
205 IF_DEF(DV_4A, IS_NONE, NONE) // DV_4A .........X.mmmmm .aaaaannnnnddddd Vd Vn Vm Va (scalar)
207 IF_DEF(SN_0A, IS_NONE, NONE) // SN_0A ................ ................
208 IF_DEF(SI_0A, IS_NONE, NONE) // SI_0A ...........iiiii iiiiiiiiiii..... imm16
209 IF_DEF(SI_0B, IS_NONE, NONE) // SI_0B ................ ....bbbb........ imm4 - barrier
211 IF_DEF(INVALID, IS_NONE, NONE) //
213 //////////////////////////////////////////////////////////////////////////////
215 //////////////////////////////////////////////////////////////////////////////
217 #endif // !DEFINE_ID_OPS
218 //////////////////////////////////////////////////////////////////////////////