More updated translations
[binutils-gdb.git] / gdb / arch / loongarch-insn.h
blob805cd53dff71f2047f674cd34a343b47bee758f0
1 /* Target-dependent code for LoongArch
3 Copyright (C) 2024 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
18 /* The LoongArch opcode and mask definitions in this file are obtained from
19 https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=opcodes/loongarch-opc.c */
21 #ifndef ARCH_LOONGARCH_INSN_H
22 #define ARCH_LOONGARCH_INSN_H
24 /* loongarch fix insn opcode */
25 #define OP_CLO_W 0x00001000
26 #define OP_CLZ_W 0x00001400
27 #define OP_CTO_W 0x00001800
28 #define OP_CTZ_W 0x00001c00
29 #define OP_CLO_D 0x00002000
30 #define OP_CLZ_D 0x00002400
31 #define OP_CTO_D 0x00002800
32 #define OP_CTZ_D 0x00002c00
33 #define OP_REVB_2H 0x00003000
34 #define OP_REVB_4H 0x00003400
35 #define OP_REVB_2W 0x00003800
36 #define OP_REVB_D 0x00003c00
37 #define OP_REVH_2W 0x00004000
38 #define OP_REVH_D 0x00004400
39 #define OP_BITREV_4B 0x00004800
40 #define OP_BITREV_8B 0x00004c00
41 #define OP_BITREV_W 0x00005000
42 #define OP_BITREV_D 0x00005400
43 #define OP_EXT_W_H 0x00005800
44 #define OP_EXT_W_B 0x00005c00
45 #define OP_RDTIMEL_W 0x00006000
46 #define OP_RDTIMEH_W 0x00006400
47 #define OP_RDTIME_D 0x00006800
48 #define OP_CPUCFG 0x00006c00
49 #define OP_ASRTLE_D 0x00010000
50 #define OP_ASRTGT_D 0x00018000
51 #define OP_ALSL_W 0x00040000
52 #define OP_ALSL_WU 0x00060000
53 #define OP_BYTEPICK_W 0x00080000
54 #define OP_BYTEPICK_D 0x000c0000
55 #define OP_ADD_W 0x00100000
56 #define OP_ADD_D 0x00108000
57 #define OP_SUB_W 0x00110000
58 #define OP_SUB_D 0x00118000
59 #define OP_SLT 0x00120000
60 #define OP_SLTU 0x00128000
61 #define OP_MASKEQZ 0x00130000
62 #define OP_MASKNEZ 0x00138000
63 #define OP_NOR 0x00140000
64 #define OP_AND 0x00148000
65 #define OP_OR 0x00150000
66 #define OP_XOR 0x00158000
67 #define OP_ORN 0x00160000
68 #define OP_ANDN 0x00168000
69 #define OP_SLL_W 0x00170000
70 #define OP_SRL_W 0x00178000
71 #define OP_SRA_W 0x00180000
72 #define OP_SLL_D 0x00188000
73 #define OP_SRL_D 0x00190000
74 #define OP_SRA_D 0x00198000
75 #define OP_ROTR_W 0x001b0000
76 #define OP_ROTR_D 0x001b8000
77 #define OP_MUL_W 0x001c0000
78 #define OP_MULH_W 0x001c8000
79 #define OP_MULH_WU 0x001d0000
80 #define OP_MUL_D 0x001d8000
81 #define OP_MULH_D 0x001e0000
82 #define OP_MULH_DU 0x001e8000
83 #define OP_MULW_D_W 0x001f0000
84 #define OP_MULW_D_WU 0x001f8000
85 #define OP_DIV_W 0x00200000
86 #define OP_MOD_W 0x00208000
87 #define OP_DIV_WU 0x00210000
88 #define OP_MOD_WU 0x00218000
89 #define OP_DIV_D 0x00220000
90 #define OP_MOD_D 0x00228000
91 #define OP_DIV_DU 0x00230000
92 #define OP_MOD_DU 0x00238000
93 #define OP_CRC_W_B_W 0x00240000
94 #define OP_CRC_W_H_W 0x00248000
95 #define OP_CRC_W_W_W 0x00250000
96 #define OP_CRC_W_D_W 0x00258000
97 #define OP_CRCC_W_B_W 0x00260000
98 #define OP_CRCC_W_H_W 0x00268000
99 #define OP_CRCC_W_W_W 0x00270000
100 #define OP_CRCC_W_D_W 0x00278000
101 #define OP_BREAK 0x002a0000
102 #define OP_DBCL 0x002a8000
103 #define OP_SYSCALL 0x002b0000
104 #define OP_ALSL_D 0x002c0000
105 #define OP_SLLI_W 0x00408000
106 #define OP_SLLI_D 0x00410000
107 #define OP_SRLI_W 0x00448000
108 #define OP_SRLI_D 0x00450000
109 #define OP_SRAI_W 0x00488000
110 #define OP_SRAI_D 0x00490000
111 #define OP_ROTRI_W 0x004c8000
112 #define OP_ROTRI_D 0x004d0000
113 #define OP_BSTRINS_W 0x00600000
114 #define OP_BSTRPICK_W 0x00608000
115 #define OP_BSTRINS_D 0x00800000
116 #define OP_BSTRPICK_D 0x00c00000
118 /* loongarch single float insn opcode */
119 #define OP_FADD_S 0x01008000
120 #define OP_SUB_S 0x01028000
121 #define OP_MUL_S 0x01048000
122 #define OP_FDIV_S 0x01068000
123 #define OP_FMAX_S 0x01088000
124 #define OP_FMIN_S 0x010a8000
125 #define OP_FMAXA_S 0x010c8000
126 #define OP_FMINA_S 0x010e8000
127 #define OP_FSCALEB_S 0x01108000
128 #define OP_FCOPYSIGN_S 0x01128000
129 #define OP_FABS_S 0x01140400
130 #define OP_FNEG_S 0x01141400
131 #define OP_FLOGB_S 0x01142400
132 #define OP_FCLASS_S 0x01143400
133 #define OP_FSQRT_S 0x01144400
134 #define OP_FRECIP_S 0x01145400
135 #define OP_FRSQRT_S 0x01146400
136 #define OP_FRECIPE_S 0x01147400
137 #define OP_FRSQRTE_S 0x01148400
138 #define OP_FMOV_S 0x01149400
139 #define OP_MOVGR2FR_W 0x0114a400
140 #define OP_MOVGR2FRH_W 0x0114ac00
141 #define OP_MOVFR2GR_S 0x0114b400
142 #define OP_MOVFRH2GR_S 0x0114bc00
143 #define OP_MOVGR2FCSR 0x0114c000
144 #define OP_MOVFCSR2GR 0x0114c800
145 #define OP_MOVFR2CF 0x0114d000
146 #define OP_MOVCF2FR 0x0114d400
147 #define OP_MOVGR2CF 0x0114d800
148 #define OP_MOVCF2GR 0x0114dc00
149 #define OP_FTINTRM_W_S 0x011a0400
150 #define OP_FTINTRM_L_S 0x011a2400
151 #define OP_FTINTRP_W_S 0x011a4400
152 #define OP_FTINTRP_L_S 0x011a6400
153 #define OP_FTINTRZ_W_S 0x011a8400
154 #define OP_FTINTRZ_L_S 0x011aa400
155 #define OP_FTINTRNE_W_S 0x011ac400
156 #define OP_FTINTRNE_L_S 0x011ae400
157 #define OP_FTINT_W_S 0x011b0400
158 #define OP_FTINT_L_S 0x011b2400
159 #define OP_FFINT_S_W 0x011d1000
160 #define OP_FFINT_S_L 0x011d1800
161 #define OP_FRINT_S 0x011e4400
163 /* loongarch double float insn opcode */
164 #define OP_FADD_D 0x01010000
165 #define OP_FSUB_D 0x01030000
166 #define OP_FMUL_D 0x01050000
167 #define OP_FDIV_D 0x01070000
168 #define OP_FMAX_D 0x01090000
169 #define OP_FMIN_D 0x010b0000
170 #define OP_FMAXA_D 0x010d0000
171 #define OP_FMINA_D 0x010f0000
172 #define OP_FSCALEB_D 0x01110000
173 #define OP_FCOPYSIGN_D 0x01130000
174 #define OP_FABS_D 0x01140800
175 #define OP_FNEG_D 0x01141800
176 #define OP_FLOGB_D 0x01142800
177 #define OP_FCLASS_D 0x01143800
178 #define OP_FSQRT_D 0x01144800
179 #define OP_FRECIP_D 0x01145800
180 #define OP_FRSQRT_D 0x01146800
181 #define OP_FRECIPE_D 0x01147800
182 #define OP_FRSQRTE_D 0x01148800
183 #define OP_FMOV_D 0x01149800
184 #define OP_MOVGR2FR_D 0x0114a800
185 #define OP_MOVFR2GR_D 0x0114b800
186 #define OP_FCVT_S_D 0x01191800
187 #define OP_FCVT_D_S 0x01192400
188 #define OP_FTINTRM_W_D 0x011a0800
189 #define OP_FTINTRM_L_D 0x011a2800
190 #define OP_FTINTRP_W_D 0x011a4800
191 #define OP_FTINTRP_L_D 0x011a6800
192 #define OP_FTINTRZ_W_D 0x011a8800
193 #define OP_FTINTRZ_L_D 0x011aa800
194 #define OP_FTINTRNE_W_D 0x011ac800
195 #define OP_FTINTRNE_L_D 0x011ae800
196 #define OP_FTINT_W_D 0x011b0800
197 #define OP_FTINT_L_D 0x011b2800
198 #define OP_FFINT_D_W 0x011d2000
199 #define OP_FFINT_D_L 0x011d2800
200 #define OP_FRINT_D 0x011e4800
202 /* loongarch imm insn opcode */
203 #define OP_SLTI 0x02000000
204 #define OP_SLTUI 0x02400000
205 #define OP_ADDI_W 0x02800000
206 #define OP_ADDI_D 0x02c00000
207 #define OP_LU52I_D 0x03000000
208 #define OP_ANDI 0x03400000
209 #define OP_ORI 0x03800000
210 #define OP_XORI 0x03c00000
211 #define OP_ADDU16I_D 0x10000000
212 #define OP_LU12I_W 0x14000000
213 #define OP_LU32I_D 0x16000000
214 #define OP_PCADDI 0x18000000
215 #define OP_PCALAU12I 0x1a000000
216 #define OP_PCADDU12I 0x1c000000
217 #define OP_PCADDU18I 0x1e000000
219 /* loongarch privilege insn opcode */
220 #define OP_CSRRD 0x04000000
221 #define OP_CSRWR 0x04000020
222 #define OP_CSRXCHG 0x04000000
223 #define OP_CACOP 0x06000000
224 #define OP_LDDIR 0x06400000
225 #define OP_LDPTE 0x06440000
226 #define OP_IOCSRRD_B 0x06480000
227 #define OP_IOCSRRD_H 0x06480400
228 #define OP_IOCSRRD_W 0x06480800
229 #define OP_IOCSRRD_D 0x06480c00
230 #define OP_IOCSRWR_B 0x06481000
231 #define OP_IOCSRWR_H 0x06481400
232 #define OP_IOCSRWR_W 0x06481800
233 #define OP_IOCSRWR_D 0x06481c00
234 #define OP_TLBCLR 0x06482000
235 #define OP_TLBFLUSH 0x06482400
236 #define OP_TLBSRCH 0x06482800
237 #define OP_TLBRD 0x06482c00
238 #define OP_TLBWR 0x06483000
239 #define OP_TLBFILL 0x06483400
240 #define OP_ERTN 0x06483800
241 #define OP_IDLE 0x06488000
242 #define OP_INVTLB 0x06498000
244 /* loongarch 4opt single float insn opcode */
245 #define OP_FMADD_S 0x08100000
246 #define OP_FMSUB_S 0x08500000
247 #define OP_FNMADD_S 0x08900000
248 #define OP_FNMSUB_S 0x08d00000
249 #define OP_FCMP_CAF_S 0x0c100000
250 #define OP_FCMP_SAF_S 0x0c108000
251 #define OP_FCMP_CLT_S 0x0c110000
252 #define OP_FCMP_SLT_S 0x0c118000
253 #define OP_FCMP_SGT_S 0x0c118000
254 #define OP_FCMP_CEQ_S 0x0c120000
255 #define OP_FCMP_SEQ_S 0x0c128000
256 #define OP_FCMP_CLE_S 0x0c130000
257 #define OP_FCMP_SLE_S 0x0c138000
258 #define OP_FCMP_SGE_S 0x0c138000
259 #define OP_FCMP_CUN_S 0x0c140000
260 #define OP_FCMP_SUN_S 0x0c148000
261 #define OP_FCMP_CULT_S 0x0c150000
262 #define OP_FCMP_CUGT_S 0x0c150000
263 #define OP_FCMP_SULT_S 0x0c158000
264 #define OP_FCMP_CUEQ_S 0x0c160000
265 #define OP_FCMP_SUEQ_S 0x0c168000
266 #define OP_FCMP_CULE_S 0x0c170000
267 #define OP_FCMP_CUGE_S 0x0c170000
268 #define OP_FCMP_SULE_S 0x0c178000
269 #define OP_FCMP_CNE_S 0x0c180000
270 #define OP_FCMP_SNE_S 0x0c188000
271 #define OP_FCMP_COR_S 0x0c1a0000
272 #define OP_FCMP_SOR_S 0x0c1a8000
273 #define OP_FCMP_CUNE_S 0x0c1c0000
274 #define OP_FCMP_SUNE_S 0x0c1c8000
275 #define OP_FSEL 0x0d000000
277 /* loongarch 4opt double float insn opcode */
278 #define OP_FMADD_D 0x08200000
279 #define OP_FMSUB_D 0x08600000
280 #define OP_FNMADD_D 0x08a00000
281 #define OP_FNMSUB_D 0x08e00000
282 #define OP_FCMP_CAF_D 0x0c200000
283 #define OP_FCMP_SAF_D 0x0c208000
284 #define OP_FCMP_CLT_D 0x0c210000
285 #define OP_FCMP_SLT_D 0x0c218000
286 #define OP_FCMP_SGT_D 0x0c218000
287 #define OP_FCMP_CEQ_D 0x0c220000
288 #define OP_FCMP_SEQ_D 0x0c228000
289 #define OP_FCMP_CLE_D 0x0c230000
290 #define OP_FCMP_SLE_D 0x0c238000
291 #define OP_FCMP_SGE_D 0x0c238000
292 #define OP_FCMP_CUN_D 0x0c240000
293 #define OP_FCMP_SUN_D 0x0c248000
294 #define OP_FCMP_CULT_D 0x0c250000
295 #define OP_FCMP_CUGT_D 0x0c250000
296 #define OP_FCMP_SULT_D 0x0c258000
297 #define OP_FCMP_CUEQ_D 0x0c260000
298 #define OP_FCMP_SUEQ_D 0x0c268000
299 #define OP_FCMP_CULE_D 0x0c270000
300 #define OP_FCMP_CUGE_D 0x0c270000
301 #define OP_FCMP_SULE_D 0x0c278000
302 #define OP_FCMP_CNE_D 0x0c280000
303 #define OP_FCMP_SNE_D 0x0c288000
304 #define OP_FCMP_COR_D 0x0c2a0000
305 #define OP_FCMP_SOR_D 0x0c2a8000
306 #define OP_FCMP_CUNE_D 0x0c2c0000
307 #define OP_FCMP_SUNE_D 0x0c2c8000
309 /* loongarch load store insn opcode */
310 #define OP_LL_W 0x20000000
311 #define OP_SC_W 0x21000000
312 #define OP_LL_D 0x22000000
313 #define OP_SC_D 0x23000000
314 #define OP_LDPTR_W 0x24000000
315 #define OP_STPTR_W 0x25000000
316 #define OP_LDPTR_D 0x26000000
317 #define OP_STPTR_D 0x27000000
318 #define OP_LD_B 0x28000000
319 #define OP_LD_H 0x28400000
320 #define OP_LD_W 0x28800000
321 #define OP_LD_D 0x28c00000
322 #define OP_ST_B 0x29000000
323 #define OP_ST_H 0x29400000
324 #define OP_ST_W 0x29800000
325 #define OP_ST_D 0x29c00000
326 #define OP_LD_BU 0x2a000000
327 #define OP_LD_HU 0x2a400000
328 #define OP_LD_WU 0x2a800000
329 #define OP_PRELD 0x2ac00000
330 #define OP_LDX_B 0x38000000
331 #define OP_LDX_H 0x38040000
332 #define OP_LDX_W 0x38080000
333 #define OP_LDX_D 0x380c0000
334 #define OP_STX_B 0x38100000
335 #define OP_STX_H 0x38140000
336 #define OP_STX_W 0x38180000
337 #define OP_STX_D 0x381c0000
338 #define OP_LDX_BU 0x38200000
339 #define OP_LDX_HU 0x38240000
340 #define OP_LDX_WU 0x38280000
341 #define OP_PRELDX 0x382c0000
342 #define OP_SC_Q 0x38570000
343 #define OP_LLACQ_W 0x38578000
344 #define OP_SCREL_W 0x38578400
345 #define OP_LLACQ_D 0x38578800
346 #define OP_SCREL_D 0x38578c00
347 #define OP_AMCAS_B 0x38580000
348 #define OP_AMCAS_H 0x38588000
349 #define OP_AMCAS_W 0x38590000
350 #define OP_AMCAS_D 0x38598000
351 #define OP_AMCAS_DB_B 0x385a0000
352 #define OP_AMCAS_DB_H 0x385a8000
353 #define OP_AMCAS_DB_W 0x385b0000
354 #define OP_AMCAS_DB_D 0x385b8000
355 #define OP_AMSWAP_B 0x385c0000
356 #define OP_AMSWAP_H 0x385c8000
357 #define OP_AMADD_B 0x385d0000
358 #define OP_AMADD_H 0x385d8000
359 #define OP_AMSWAP_DB_B 0x385e0000
360 #define OP_AMSWAP_DB_H 0x385e8000
361 #define OP_AMADD_DB_B 0x385f0000
362 #define OP_AMADD_DB_H 0x385f8000
363 #define OP_AMSWAP_W 0x38600000
364 #define OP_AMSWAP_D 0x38608000
365 #define OP_AMADD_W 0x38610000
366 #define OP_AMADD_D 0x38618000
367 #define OP_AMAND_W 0x38620000
368 #define OP_AMAND_D 0x38628000
369 #define OP_AMOR_W 0x38630000
370 #define OP_AMOR_D 0x38638000
371 #define OP_AMXOR_W 0x38640000
372 #define OP_AMXOR_D 0x38648000
373 #define OP_AMMAX_W 0x38650000
374 #define OP_AMMAX_D 0x38658000
375 #define OP_AMMIN_W 0x38660000
376 #define OP_AMMIN_D 0x38668000
377 #define OP_AMMAX_WU 0x38670000
378 #define OP_AMMAX_DU 0x38678000
379 #define OP_AMMIN_WU 0x38680000
380 #define OP_AMMIN_DU 0x38688000
381 #define OP_AMSWAP_DB_W 0x38690000
382 #define OP_AMSWAP_DB_D 0x38698000
383 #define OP_AMADD_DB_W 0x386a0000
384 #define OP_AMADD_DB_D 0x386a8000
385 #define OP_AMAND_DB_W 0x386b0000
386 #define OP_AMAND_DB_D 0x386b8000
387 #define OP_AMOR_DB_W 0x386c0000
388 #define OP_AMOR_DB_D 0x386c8000
389 #define OP_AMXOR_DB_W 0x386d0000
390 #define OP_AMXOR_DB_D 0x386d8000
391 #define OP_AMMAX_DB_W 0x386e0000
392 #define OP_AMMAX_DB_D 0x386e8000
393 #define OP_AMMIN_DB_W 0x386f0000
394 #define OP_AMMIN_DB_D 0x386f8000
395 #define OP_AMMAX_DB_WU 0x38700000
396 #define OP_AMMAX_DB_DU 0x38708000
397 #define OP_AMMIN_DB_WU 0x38710000
398 #define OP_AMMIN_DB_DU 0x38718000
399 #define OP_DBAR 0x38720000
400 #define OP_IBAR 0x38728000
401 #define OP_LDGT_B 0x38780000
402 #define OP_LDGT_H 0x38788000
403 #define OP_LDGT_W 0x38790000
404 #define OP_LDGT_D 0x38798000
405 #define OP_LDLE_B 0x387a0000
406 #define OP_LDLE_H 0x387a8000
407 #define OP_LDLE_W 0x387b0000
408 #define OP_LDLE_D 0x387b8000
409 #define OP_STGT_B 0x387c0000
410 #define OP_STGT_H 0x387c8000
411 #define OP_STGT_W 0x387d0000
412 #define OP_STGT_D 0x387d8000
413 #define OP_STLE_B 0x387e0000
414 #define OP_STLE_H 0x387e8000
415 #define OP_STLE_W 0x387f0000
416 #define OP_STLE_D 0x387f8000
417 #define OP_VLD 0x2c000000
418 #define OP_VST 0x2c400000
419 #define OP_XVLD 0x2c800000
420 #define OP_XVST 0x2cc00000
422 /* loongarch single float load store insn opcode */
423 #define OP_FLD_S 0x2b000000
424 #define OP_FST_S 0x2b400000
425 #define OP_FLDX_S 0x38300000
426 #define OP_FSTX_S 0x38380000
427 #define OP_FLDGT_S 0x38740000
428 #define OP_FLDLE_S 0x38750000
429 #define OP_FSTGT_S 0x38760000
430 #define OP_FSTLE_S 0x38770000
432 /* loongarch double float load store insn opcode */
433 #define OP_FLD_D 0x2b800000
434 #define OP_FST_D 0x2bc00000
435 #define OP_FLDX_D 0x38340000
436 #define OP_FSTX_D 0x383c0000
437 #define OP_FLDGT_D 0x38748000
438 #define OP_FLDLE_D 0x38758000
439 #define OP_FSTGT_D 0x38768000
440 #define OP_FSTLE_D 0x38778000
442 /* loongarch float jmp insn opcode */
443 #define OP_BCEQZ 0x48000000
444 #define OP_BCNEZ 0x48000100
446 /* loongarch jmp insn opcode */
447 #define OP_BEQZ 0x40000000
448 #define OP_BNEZ 0x44000000
449 #define OP_JIRL 0x4c000000
450 #define OP_B 0x50000000
451 #define OP_BL 0x54000000
452 #define OP_BEQ 0x58000000
453 #define OP_BNE 0x5c000000
454 #define OP_BLT 0x60000000
455 #define OP_BGE 0x64000000
456 #define OP_BLTU 0x68000000
457 #define OP_BGEU 0x6c000000
459 /* loongarch fix insn mask */
460 #define MASK_CLO_W 0xfffffc00
461 #define MASK_CLZ_W 0xfffffc00
462 #define MASK_CTO_W 0xfffffc00
463 #define MASK_CTZ_W 0xfffffc00
464 #define MASK_CLO_D 0xfffffc00
465 #define MASK_CLZ_D 0xfffffc00
466 #define MASK_CTO_D 0xfffffc00
467 #define MASK_CTZ_D 0xfffffc00
468 #define MASK_REVB_2H 0xfffffc00
469 #define MASK_REVB_4H 0xfffffc00
470 #define MASK_REVB_2W 0xfffffc00
471 #define MASK_REVB_D 0xfffffc00
472 #define MASK_REVH_2W 0xfffffc00
473 #define MASK_REVH_D 0xfffffc00
474 #define MASK_BITREV_4B 0xfffffc00
475 #define MASK_BITREV_8B 0xfffffc00
476 #define MASK_BITREV_W 0xfffffc00
477 #define MASK_BITREV_D 0xfffffc00
478 #define MASK_EXT_W_H 0xfffffc00
479 #define MASK_EXT_W_B 0xfffffc00
480 #define MASK_RDTIMEL_W 0xfffffc00
481 #define MASK_RDTIMEH_W 0xfffffc00
482 #define MASK_RDTIME_D 0xfffffc00
483 #define MASK_CPUCFG 0xfffffc00
484 #define MASK_ASRTLE_D 0xffff801f
485 #define MASK_ASRTGT_D 0xffff801f
486 #define MASK_ALSL_W 0xfffe0000
487 #define MASK_ALSL_WU 0xfffe0000
488 #define MASK_BYTEPICK_W 0xfffe0000
489 #define MASK_BYTEPICK_D 0xfffc0000
490 #define MASK_ADD_W 0xffff8000
491 #define MASK_ADD_D 0xffff8000
492 #define MASK_SUB_W 0xffff8000
493 #define MASK_SUB_D 0xffff8000
494 #define MASK_SLT 0xffff8000
495 #define MASK_SLTU 0xffff8000
496 #define MASK_MASKEQZ 0xffff8000
497 #define MASK_MASKNEZ 0xffff8000
498 #define MASK_NOR 0xffff8000
499 #define MASK_AND 0xffff8000
500 #define MASK_OR 0xffff8000
501 #define MASK_XOR 0xffff8000
502 #define MASK_ORN 0xffff8000
503 #define MASK_ANDN 0xffff8000
504 #define MASK_SLL_W 0xffff8000
505 #define MASK_SRL_W 0xffff8000
506 #define MASK_SRA_W 0xffff8000
507 #define MASK_SLL_D 0xffff8000
508 #define MASK_SRL_D 0xffff8000
509 #define MASK_SRA_D 0xffff8000
510 #define MASK_ROTR_W 0xffff8000
511 #define MASK_ROTR_D 0xffff8000
512 #define MASK_MUL_W 0xffff8000
513 #define MASK_MULH_W 0xffff8000
514 #define MASK_MULH_WU 0xffff8000
515 #define MASK_MUL_D 0xffff8000
516 #define MASK_MULH_D 0xffff8000
517 #define MASK_MULH_DU 0xffff8000
518 #define MASK_MULW_D_W 0xffff8000
519 #define MASK_MULW_D_WU 0xffff8000
520 #define MASK_DIV_W 0xffff8000
521 #define MASK_MOD_W 0xffff8000
522 #define MASK_DIV_WU 0xffff8000
523 #define MASK_MOD_WU 0xffff8000
524 #define MASK_DIV_D 0xffff8000
525 #define MASK_MOD_D 0xffff8000
526 #define MASK_DIV_DU 0xffff8000
527 #define MASK_MOD_DU 0xffff8000
528 #define MASK_CRC_W_B_W 0xffff8000
529 #define MASK_CRC_W_H_W 0xffff8000
530 #define MASK_CRC_W_W_W 0xffff8000
531 #define MASK_CRC_W_D_W 0xffff8000
532 #define MASK_CRCC_W_B_W 0xffff8000
533 #define MASK_CRCC_W_H_W 0xffff8000
534 #define MASK_CRCC_W_W_W 0xffff8000
535 #define MASK_CRCC_W_D_W 0xffff8000
536 #define MASK_BREAK 0xffff8000
537 #define MASK_DBCL 0xffff8000
538 #define MASK_SYSCALL 0xffff8000
539 #define MASK_ALSL_D 0xfffe0000
540 #define MASK_SLLI_W 0xffff8000
541 #define MASK_SLLI_D 0xffff0000
542 #define MASK_SRLI_W 0xffff8000
543 #define MASK_SRLI_D 0xffff0000
544 #define MASK_SRAI_W 0xffff8000
545 #define MASK_SRAI_D 0xffff0000
546 #define MASK_ROTRI_W 0xffff8000
547 #define MASK_ROTRI_D 0xffff0000
548 #define MASK_BSTRINS_W 0xffe08000
549 #define MASK_BSTRPICK_W 0xffe08000
550 #define MASK_BSTRINS_D 0xffc00000
551 #define MASK_BSTRPICK_D 0xffc00000
553 /* loongarch single float insn mask */
554 #define MASK_FADD_S 0xffff8000
555 #define MASK_SUB_S 0xffff8000
556 #define MASK_MUL_S 0xffff8000
557 #define MASK_FDIV_S 0xffff8000
558 #define MASK_FMAX_S 0xffff8000
559 #define MASK_FMIN_S 0xffff8000
560 #define MASK_FMAXA_S 0xffff8000
561 #define MASK_FMINA_S 0xffff8000
562 #define MASK_FSCALEB_S 0xffff8000
563 #define MASK_FCOPYSIGN_S 0xffff8000
564 #define MASK_FABS_S 0xfffffc00
565 #define MASK_FNEG_S 0xfffffc00
566 #define MASK_FLOGB_S 0xfffffc00
567 #define MASK_FCLASS_S 0xfffffc00
568 #define MASK_FSQRT_S 0xfffffc00
569 #define MASK_FRECIP_S 0xfffffc00
570 #define MASK_FRSQRT_S 0xfffffc00
571 #define MASK_FRECIPE_S 0xfffffc00
572 #define MASK_FRSQRTE_S 0xfffffc00
573 #define MASK_FMOV_S 0xfffffc00
574 #define MASK_MOVGR2FR_W 0xfffffc00
575 #define MASK_MOVGR2FRH_W 0xfffffc00
576 #define MASK_MOVFR2GR_S 0xfffffc00
577 #define MASK_MOVFRH2GR_S 0xfffffc00
578 #define MASK_MOVGR2FCSR 0xfffffc1c
579 #define MASK_MOVFCSR2GR 0xffffff80
580 #define MASK_MOVFR2CF 0xfffffc18
581 #define MASK_MOVCF2FR 0xffffff00
582 #define MASK_MOVGR2CF 0xfffffc18
583 #define MASK_MOVCF2GR 0xffffff00
584 #define MASK_FTINTRM_W_S 0xfffffc00
585 #define MASK_FTINTRM_L_S 0xfffffc00
586 #define MASK_FTINTRP_W_S 0xfffffc00
587 #define MASK_FTINTRP_L_S 0xfffffc00
588 #define MASK_FTINTRZ_W_S 0xfffffc00
589 #define MASK_FTINTRZ_L_S 0xfffffc00
590 #define MASK_FTINTRNE_W_S 0xfffffc00
591 #define MASK_FTINTRNE_L_S 0xfffffc00
592 #define MASK_FTINT_W_S 0xfffffc00
593 #define MASK_FTINT_L_S 0xfffffc00
594 #define MASK_FFINT_S_W 0xfffffc00
595 #define MASK_FFINT_S_L 0xfffffc00
596 #define MASK_FRINT_S 0xfffffc00
598 /* loongarch double float insn mask */
599 #define MASK_FADD_D 0xffff8000
600 #define MASK_FSUB_D 0xffff8000
601 #define MASK_FMUL_D 0xffff8000
602 #define MASK_FDIV_D 0xffff8000
603 #define MASK_FMAX_D 0xffff8000
604 #define MASK_FMIN_D 0xffff8000
605 #define MASK_FMAXA_D 0xffff8000
606 #define MASK_FMINA_D 0xffff8000
607 #define MASK_FSCALEB_D 0xffff8000
608 #define MASK_FCOPYSIGN_D 0xffff8000
609 #define MASK_FABS_D 0xfffffc00
610 #define MASK_FNEG_D 0xfffffc00
611 #define MASK_FLOGB_D 0xfffffc00
612 #define MASK_FCLASS_D 0xfffffc00
613 #define MASK_FSQRT_D 0xfffffc00
614 #define MASK_FRECIP_D 0xfffffc00
615 #define MASK_FRSQRT_D 0xfffffc00
616 #define MASK_FRECIPE_D 0xfffffc00
617 #define MASK_FRSQRTE_D 0xfffffc00
618 #define MASK_FMOV_D 0xfffffc00
619 #define MASK_MOVGR2FR_D 0xfffffc00
620 #define MASK_MOVFR2GR_D 0xfffffc00
621 #define MASK_FCVT_S_D 0xfffffc00
622 #define MASK_FCVT_D_S 0xfffffc00
623 #define MASK_FTINTRM_W_D 0xfffffc00
624 #define MASK_FTINTRM_L_D 0xfffffc00
625 #define MASK_FTINTRP_W_D 0xfffffc00
626 #define MASK_FTINTRP_L_D 0xfffffc00
627 #define MASK_FTINTRZ_W_D 0xfffffc00
628 #define MASK_FTINTRZ_L_D 0xfffffc00
629 #define MASK_FTINTRNE_W_D 0xfffffc00
630 #define MASK_FTINTRNE_L_D 0xfffffc00
631 #define MASK_FTINT_W_D 0xfffffc00
632 #define MASK_FTINT_L_D 0xfffffc00
633 #define MASK_FFINT_D_W 0xfffffc00
634 #define MASK_FFINT_D_L 0xfffffc00
635 #define MASK_FRINT_D 0xfffffc00
637 /* loongarch imm insn mask */
638 #define MASK_SLTI 0xfffffc00
639 #define MASK_SLTUI 0xffc00000
640 #define MASK_ADDI_W 0xffc00000
641 #define MASK_ADDI_D 0xffc00000
642 #define MASK_LU52I_D 0xffc00000
643 #define MASK_ANDI 0xffc00000
644 #define MASK_ORI 0xffc00000
645 #define MASK_XORI 0xffc00000
646 #define MASK_ADDU16I_D 0xfc000000
647 #define MASK_LU12I_W 0xfe000000
648 #define MASK_LU32I_D 0xfe000000
649 #define MASK_PCADDI 0xfe000000
650 #define MASK_PCALAU12I 0xfe000000
651 #define MASK_PCADDU12I 0xfe000000
652 #define MASK_PCADDU18I 0xfe000000
654 /* loongarch privilege insn mask */
655 #define MASK_CSRRD 0xff0003e0
656 #define MASK_CSRWR 0xff0003e0
657 #define MASK_CSRXCHG 0xff000000
658 #define MASK_CACOP 0xffc00000
659 #define MASK_LDDIR 0xfffc0000
660 #define MASK_LDPTE 0xfffc001f
661 #define MASK_IOCSRRD_B 0xfffffc00
662 #define MASK_IOCSRRD_H 0xfffffc00
663 #define MASK_IOCSRRD_W 0xfffffc00
664 #define MASK_IOCSRRD_D 0xfffffc00
665 #define MASK_IOCSRWR_B 0xfffffc00
666 #define MASK_IOCSRWR_H 0xfffffc00
667 #define MASK_IOCSRWR_W 0xfffffc00
668 #define MASK_IOCSRWR_D 0xfffffc00
669 #define MASK_TLBCLR 0xffffffff
670 #define MASK_TLBFLUSH 0xffffffff
671 #define MASK_TLBSRCH 0xffffffff
672 #define MASK_TLBRD 0xffffffff
673 #define MASK_TLBWR 0xffffffff
674 #define MASK_TLBFILL 0xffffffff
675 #define MASK_ERTN 0xffffffff
676 #define MASK_IDLE 0xffff8000
677 #define MASK_INVTLB 0xffff8000
679 /* loongarch 4opt single float insn mask */
680 #define MASK_FMADD_S 0xfff00000
681 #define MASK_FMSUB_S 0xfff00000
682 #define MASK_FNMADD_S 0xfff00000
683 #define MASK_FNMSUB_S 0xfff00000
684 #define MASK_FCMP_CAF_S 0xffff8018
685 #define MASK_FCMP_SAF_S 0xffff8018
686 #define MASK_FCMP_CLT_S 0xffff8018
687 #define MASK_FCMP_SLT_S 0xffff8018
688 #define MASK_FCMP_SGT_S 0xffff8018
689 #define MASK_FCMP_CEQ_S 0xffff8018
690 #define MASK_FCMP_SEQ_S 0xffff8018
691 #define MASK_FCMP_CLE_S 0xffff8018
692 #define MASK_FCMP_SLE_S 0xffff8018
693 #define MASK_FCMP_SGE_S 0xffff8018
694 #define MASK_FCMP_CUN_S 0xffff8018
695 #define MASK_FCMP_SUN_S 0xffff8018
696 #define MASK_FCMP_CULT_S 0xffff8018
697 #define MASK_FCMP_CUGT_S 0xffff8018
698 #define MASK_FCMP_SULT_S 0xffff8018
699 #define MASK_FCMP_CUEQ_S 0xffff8018
700 #define MASK_FCMP_SUEQ_S 0xffff8018
701 #define MASK_FCMP_CULE_S 0xffff8018
702 #define MASK_FCMP_CUGE_S 0xffff8018
703 #define MASK_FCMP_SULE_S 0xffff8018
704 #define MASK_FCMP_CNE_S 0xffff8018
705 #define MASK_FCMP_SNE_S 0xffff8018
706 #define MASK_FCMP_COR_S 0xffff8018
707 #define MASK_FCMP_SOR_S 0xffff8018
708 #define MASK_FCMP_CUNE_S 0xffff8018
709 #define MASK_FCMP_SUNE_S 0xffff8018
710 #define MASK_FSEL 0xfffc0000
712 /* loongarch 4opt double float insn mask */
713 #define MASK_FMADD_D 0xfff00000
714 #define MASK_FMSUB_D 0xfff00000
715 #define MASK_FNMADD_D 0xfff00000
716 #define MASK_FNMSUB_D 0xfff00000
717 #define MASK_FCMP_CAF_D 0xffff8018
718 #define MASK_FCMP_SAF_D 0xffff8018
719 #define MASK_FCMP_CLT_D 0xffff8018
720 #define MASK_FCMP_SLT_D 0xffff8018
721 #define MASK_FCMP_SGT_D 0xffff8018
722 #define MASK_FCMP_CEQ_D 0xffff8018
723 #define MASK_FCMP_SEQ_D 0xffff8018
724 #define MASK_FCMP_CLE_D 0xffff8018
725 #define MASK_FCMP_SLE_D 0xffff8018
726 #define MASK_FCMP_SGE_D 0xffff8018
727 #define MASK_FCMP_CUN_D 0xffff8018
728 #define MASK_FCMP_SUN_D 0xffff8018
729 #define MASK_FCMP_CULT_D 0xffff8018
730 #define MASK_FCMP_CUGT_D 0xffff8018
731 #define MASK_FCMP_SULT_D 0xffff8018
732 #define MASK_FCMP_CUEQ_D 0xffff8018
733 #define MASK_FCMP_SUEQ_D 0xffff8018
734 #define MASK_FCMP_CULE_D 0xffff8018
735 #define MASK_FCMP_CUGE_D 0xffff8018
736 #define MASK_FCMP_SULE_D 0xffff8018
737 #define MASK_FCMP_CNE_D 0xffff8018
738 #define MASK_FCMP_SNE_D 0xffff8018
739 #define MASK_FCMP_COR_D 0xffff8018
740 #define MASK_FCMP_SOR_D 0xffff8018
741 #define MASK_FCMP_CUNE_D 0xffff8018
742 #define MASK_FCMP_SUNE_D 0xffff8018
744 /* loongarch load store insn mask */
745 #define MASK_LL_W 0xff000000
746 #define MASK_SC_W 0xff000000
747 #define MASK_LL_D 0xff000000
748 #define MASK_SC_D 0xff000000
749 #define MASK_LDPTR_W 0xff000000
750 #define MASK_STPTR_W 0xff000000
751 #define MASK_LDPTR_D 0xff000000
752 #define MASK_STPTR_D 0xff000000
753 #define MASK_LD_B 0xffc00000
754 #define MASK_LD_H 0xffc00000
755 #define MASK_LD_W 0xffc00000
756 #define MASK_LD_D 0xffc00000
757 #define MASK_ST_B 0xffc00000
758 #define MASK_ST_H 0xffc00000
759 #define MASK_ST_W 0xffc00000
760 #define MASK_ST_D 0xffc00000
761 #define MASK_LD_BU 0xffc00000
762 #define MASK_LD_HU 0xffc00000
763 #define MASK_LD_WU 0xffc00000
764 #define MASK_PRELD 0xffc00000
765 #define MASK_LDX_B 0xffff8000
766 #define MASK_LDX_H 0xffff8000
767 #define MASK_LDX_W 0xffff8000
768 #define MASK_LDX_D 0xffff8000
769 #define MASK_STX_B 0xffff8000
770 #define MASK_STX_H 0xffff8000
771 #define MASK_STX_W 0xffff8000
772 #define MASK_STX_D 0xffff8000
773 #define MASK_LDX_BU 0xffff8000
774 #define MASK_LDX_HU 0xffff8000
775 #define MASK_LDX_WU 0xffff8000
776 #define MASK_PRELDX 0xffff8000
777 #define MASK_SC_Q 0xffff8000
778 #define MASK_LLACQ_W 0xfffffc00
779 #define MASK_SCREL_W 0xfffffc00
780 #define MASK_LLACQ_D 0xfffffc00
781 #define MASK_SCREL_D 0xfffffc00
782 #define MASK_AMCAS_B 0xffff8000
783 #define MASK_AMCAS_H 0xffff8000
784 #define MASK_AMCAS_W 0xffff8000
785 #define MASK_AMCAS_D 0xffff8000
786 #define MASK_AMCAS_DB_B 0xffff8000
787 #define MASK_AMCAS_DB_H 0xffff8000
788 #define MASK_AMCAS_DB_W 0xffff8000
789 #define MASK_AMCAS_DB_D 0xffff8000
790 #define MASK_AMSWAP_B 0xffff8000
791 #define MASK_AMSWAP_H 0xffff8000
792 #define MASK_AMADD_B 0xffff8000
793 #define MASK_AMADD_H 0xffff8000
794 #define MASK_AMSWAP_DB_B 0xffff8000
795 #define MASK_AMSWAP_DB_H 0xffff8000
796 #define MASK_AMADD_DB_B 0xffff8000
797 #define MASK_AMADD_DB_H 0xffff8000
798 #define MASK_AMSWAP_W 0xffff8000
799 #define MASK_AMSWAP_D 0xffff8000
800 #define MASK_AMADD_W 0xffff8000
801 #define MASK_AMADD_D 0xffff8000
802 #define MASK_AMAND_W 0xffff8000
803 #define MASK_AMAND_D 0xffff8000
804 #define MASK_AMOR_W 0xffff8000
805 #define MASK_AMOR_D 0xffff8000
806 #define MASK_AMXOR_W 0xffff8000
807 #define MASK_AMXOR_D 0xffff8000
808 #define MASK_AMMAX_W 0xffff8000
809 #define MASK_AMMAX_D 0xffff8000
810 #define MASK_AMMIN_W 0xffff8000
811 #define MASK_AMMIN_D 0xffff8000
812 #define MASK_AMMAX_WU 0xffff8000
813 #define MASK_AMMAX_DU 0xffff8000
814 #define MASK_AMMIN_WU 0xffff8000
815 #define MASK_AMMIN_DU 0xffff8000
816 #define MASK_AMSWAP_DB_W 0xffff8000
817 #define MASK_AMSWAP_DB_D 0xffff8000
818 #define MASK_AMADD_DB_W 0xffff8000
819 #define MASK_AMADD_DB_D 0xffff8000
820 #define MASK_AMAND_DB_W 0xffff8000
821 #define MASK_AMAND_DB_D 0xffff8000
822 #define MASK_AMOR_DB_W 0xffff8000
823 #define MASK_AMOR_DB_D 0xffff8000
824 #define MASK_AMXOR_DB_W 0xffff8000
825 #define MASK_AMXOR_DB_D 0xffff8000
826 #define MASK_AMMAX_DB_W 0xffff8000
827 #define MASK_AMMAX_DB_D 0xffff8000
828 #define MASK_AMMIN_DB_W 0xffff8000
829 #define MASK_AMMIN_DB_D 0xffff8000
830 #define MASK_AMMAX_DB_WU 0xffff8000
831 #define MASK_AMMAX_DB_DU 0xffff8000
832 #define MASK_AMMIN_DB_WU 0xffff8000
833 #define MASK_AMMIN_DB_DU 0xffff8000
834 #define MASK_DBAR 0xffff8000
835 #define MASK_IBAR 0xffff8000
836 #define MASK_LDGT_B 0xffff8000
837 #define MASK_LDGT_H 0xffff8000
838 #define MASK_LDGT_W 0xffff8000
839 #define MASK_LDGT_D 0xffff8000
840 #define MASK_LDLE_B 0xffff8000
841 #define MASK_LDLE_H 0xffff8000
842 #define MASK_LDLE_W 0xffff8000
843 #define MASK_LDLE_D 0xffff8000
844 #define MASK_STGT_B 0xffff8000
845 #define MASK_STGT_H 0xffff8000
846 #define MASK_STGT_W 0xffff8000
847 #define MASK_STGT_D 0xffff8000
848 #define MASK_STLE_B 0xffff8000
849 #define MASK_STLE_H 0xffff8000
850 #define MASK_STLE_W 0xffff8000
851 #define MASK_STLE_D 0xffff8000
852 #define MASK_VLD 0xffc00000
853 #define MASK_VST 0xffc00000
854 #define MASK_XVLD 0xffc00000
855 #define MASK_XVST 0xffc00000
857 /* loongarch single float load store insn mask */
858 #define MASK_FLD_S 0xffc00000
859 #define MASK_FST_S 0xffc00000
860 #define MASK_FLDX_S 0xffff8000
861 #define MASK_FSTX_S 0xffff8000
862 #define MASK_FLDGT_S 0xffff8000
863 #define MASK_FLDLE_S 0xffff8000
864 #define MASK_FSTGT_S 0xffff8000
865 #define MASK_FSTLE_S 0xffff8000
867 /* loongarch double float load store insn mask */
868 #define MASK_FLD_D 0xffc00000
869 #define MASK_FST_D 0xffc00000
870 #define MASK_FLDX_D 0xffff8000
871 #define MASK_FSTX_D 0xffff8000
872 #define MASK_FLDGT_D 0xffff8000
873 #define MASK_FLDLE_D 0xffff8000
874 #define MASK_FSTGT_D 0xffff8000
875 #define MASK_FSTLE_D 0xffff8000
877 /* loongarch float jmp insn mask */
878 #define MASK_BCEQZ 0xfc000300
879 #define MASK_BCNEZ 0xfc000300
881 /* loongarch jmp insn mask */
882 #define MASK_BEQZ 0xfc000000
883 #define MASK_BNEZ 0xfc000000
884 #define MASK_JIRL 0xfc000000
885 #define MASK_B 0xfc000000
886 #define MASK_BL 0xfc000000
887 #define MASK_BEQ 0xfc000000
888 #define MASK_BNE 0xfc000000
889 #define MASK_BLT 0xfc000000
890 #define MASK_BGE 0xfc000000
891 #define MASK_BLTU 0xfc000000
892 #define MASK_BGEU 0xfc000000
894 /* Define a series of is_XXX_insn functions to check if the value INSN
895 is an instance of instruction XXX. */
896 #define DECLARE_INSN(INSN_NAME, INSN_OPCODE, INSN_MASK) \
897 static inline bool is_ ## INSN_NAME ## _insn (uint32_t insn) \
899 return (insn & INSN_MASK) == INSN_OPCODE; \
902 /* loongarch fix instruction */
903 DECLARE_INSN(clo_w, OP_CLO_W, MASK_CLO_W)
904 DECLARE_INSN(clz_w, OP_CLZ_W, MASK_CLZ_W)
905 DECLARE_INSN(cto_w, OP_CTO_W, MASK_CTO_W)
906 DECLARE_INSN(ctz_w, OP_CTZ_W, MASK_CTZ_W)
907 DECLARE_INSN(clo_d, OP_CLO_D, MASK_CLO_D)
908 DECLARE_INSN(clz_d, OP_CLZ_D, MASK_CLZ_D)
909 DECLARE_INSN(cto_d, OP_CTO_D, MASK_CTO_D)
910 DECLARE_INSN(ctz_d, OP_CTZ_D, MASK_CTZ_D)
911 DECLARE_INSN(revb_2h, OP_REVB_2H, MASK_REVB_2H)
912 DECLARE_INSN(revb_4h, OP_REVB_4H, MASK_REVB_4H)
913 DECLARE_INSN(revb_2w, OP_REVB_2W, MASK_REVB_2W)
914 DECLARE_INSN(revb_d, OP_REVB_D, MASK_REVB_D)
915 DECLARE_INSN(revh_2w, OP_REVH_2W, MASK_REVH_2W)
916 DECLARE_INSN(revh_d, OP_REVH_D, MASK_REVH_D)
917 DECLARE_INSN(bitrev_4b, OP_BITREV_4B, MASK_BITREV_4B)
918 DECLARE_INSN(bitrev_8b, OP_BITREV_8B, MASK_BITREV_8B)
919 DECLARE_INSN(bitrev_w, OP_BITREV_W, MASK_BITREV_W)
920 DECLARE_INSN(bitrev_d, OP_BITREV_D, MASK_BITREV_D)
921 DECLARE_INSN(ext_w_h, OP_EXT_W_H, MASK_EXT_W_H)
922 DECLARE_INSN(ext_w_b, OP_EXT_W_B, MASK_EXT_W_B)
923 DECLARE_INSN(rdtimel_w, OP_RDTIMEL_W, MASK_RDTIMEL_W)
924 DECLARE_INSN(rdtimeh_w, OP_RDTIMEH_W, MASK_RDTIMEH_W)
925 DECLARE_INSN(rdtime_d, OP_RDTIME_D, MASK_RDTIME_D)
926 DECLARE_INSN(cpucfg, OP_CPUCFG, MASK_CPUCFG)
927 DECLARE_INSN(asrtle_d, OP_ASRTLE_D, MASK_ASRTLE_D)
928 DECLARE_INSN(asrtgt_d, OP_ASRTGT_D, MASK_ASRTGT_D)
929 DECLARE_INSN(alsl_w, OP_ALSL_W, MASK_ALSL_W)
930 DECLARE_INSN(alsl_wu, OP_ALSL_WU, MASK_ALSL_WU)
931 DECLARE_INSN(bytepick_w, OP_BYTEPICK_W, MASK_BYTEPICK_W)
932 DECLARE_INSN(bytepick_d, OP_BYTEPICK_D, MASK_BYTEPICK_D)
933 DECLARE_INSN(add_w, OP_ADD_W, MASK_ADD_W)
934 DECLARE_INSN(add_d, OP_ADD_D, MASK_ADD_D)
935 DECLARE_INSN(sub_w, OP_SUB_W, MASK_SUB_W)
936 DECLARE_INSN(sub_d, OP_SUB_D, MASK_SUB_D)
937 DECLARE_INSN(slt, OP_SLT, MASK_SLT)
938 DECLARE_INSN(sltu, OP_SLTU, MASK_SLTU)
939 DECLARE_INSN(maskeqz, OP_MASKEQZ, MASK_MASKEQZ)
940 DECLARE_INSN(masknez, OP_MASKNEZ, MASK_MASKNEZ)
941 DECLARE_INSN(nor, OP_NOR, MASK_NOR)
942 DECLARE_INSN(and, OP_AND, MASK_AND)
943 DECLARE_INSN(or, OP_OR, MASK_OR)
944 DECLARE_INSN(xor, OP_XOR, MASK_XOR)
945 DECLARE_INSN(orn, OP_ORN, MASK_ORN)
946 DECLARE_INSN(andn, OP_ANDN, MASK_ANDN)
947 DECLARE_INSN(sll_w, OP_SLL_W, MASK_SLL_W)
948 DECLARE_INSN(srl_w, OP_SRL_W, MASK_SRL_W)
949 DECLARE_INSN(sra_w, OP_SRA_W, MASK_SRA_W)
950 DECLARE_INSN(sll_d, OP_SLL_D, MASK_SLL_D)
951 DECLARE_INSN(srl_d, OP_SRL_D, MASK_SRL_D)
952 DECLARE_INSN(sra_d, OP_SRA_D, MASK_SRA_D)
953 DECLARE_INSN(rotr_w, OP_ROTR_W, MASK_ROTR_W)
954 DECLARE_INSN(rotr_d, OP_ROTR_D, MASK_ROTR_D)
955 DECLARE_INSN(mul_w, OP_MUL_W, MASK_MUL_W)
956 DECLARE_INSN(mulh_w, OP_MULH_W, MASK_MULH_W)
957 DECLARE_INSN(mulh_wu, OP_MULH_WU, MASK_MULH_WU)
958 DECLARE_INSN(mul_d, OP_MUL_D, MASK_MUL_D)
959 DECLARE_INSN(mulh_d, OP_MULH_D, MASK_MULH_D)
960 DECLARE_INSN(mulh_du, OP_MULH_DU, MASK_MULH_DU)
961 DECLARE_INSN(mulw_d_w, OP_MULW_D_W, MASK_MULW_D_W)
962 DECLARE_INSN(mulw_d_wu, OP_MULW_D_WU, MASK_MULW_D_WU)
963 DECLARE_INSN(div_w, OP_DIV_W, MASK_DIV_W)
964 DECLARE_INSN(mod_w, OP_MOD_W, MASK_MOD_W)
965 DECLARE_INSN(div_wu, OP_DIV_WU, MASK_DIV_WU)
966 DECLARE_INSN(mod_wu, OP_MOD_WU, MASK_MOD_WU)
967 DECLARE_INSN(div_d, OP_DIV_D, MASK_DIV_D)
968 DECLARE_INSN(mod_d, OP_MOD_D, MASK_MOD_D)
969 DECLARE_INSN(div_du, OP_DIV_DU, MASK_DIV_DU)
970 DECLARE_INSN(mod_du, OP_MOD_DU, MASK_MOD_DU)
971 DECLARE_INSN(crc_w_b_w, OP_CRC_W_B_W, MASK_CRC_W_B_W)
972 DECLARE_INSN(crc_w_h_w, OP_CRC_W_H_W, MASK_CRC_W_H_W)
973 DECLARE_INSN(crc_w_w_w, OP_CRC_W_W_W, MASK_CRC_W_W_W)
974 DECLARE_INSN(crc_w_d_w, OP_CRC_W_D_W, MASK_CRC_W_D_W)
975 DECLARE_INSN(crcc_w_b_w, OP_CRCC_W_B_W, MASK_CRCC_W_B_W)
976 DECLARE_INSN(crcc_w_h_w, OP_CRCC_W_H_W, MASK_CRCC_W_H_W)
977 DECLARE_INSN(crcc_w_w_w, OP_CRCC_W_W_W, MASK_CRCC_W_W_W)
978 DECLARE_INSN(crcc_w_d_w, OP_CRCC_W_D_W, MASK_CRCC_W_D_W)
979 DECLARE_INSN(break, OP_BREAK, MASK_BREAK)
980 DECLARE_INSN(dbcl, OP_DBCL, MASK_DBCL)
981 DECLARE_INSN(syscall, OP_SYSCALL, MASK_SYSCALL)
982 DECLARE_INSN(alsl_d, OP_ALSL_D, MASK_ALSL_D)
983 DECLARE_INSN(slli_w, OP_SLLI_W, MASK_SLLI_W)
984 DECLARE_INSN(slli_d, OP_SLLI_D, MASK_SLLI_D)
985 DECLARE_INSN(srli_w, OP_SRLI_W, MASK_SRLI_W)
986 DECLARE_INSN(srli_d, OP_SRLI_D, MASK_SRLI_D)
987 DECLARE_INSN(srai_w, OP_SRAI_W, MASK_SRAI_W)
988 DECLARE_INSN(srai_d, OP_SRAI_D, MASK_SRAI_D)
989 DECLARE_INSN(rotri_w, OP_ROTRI_W, MASK_ROTRI_W)
990 DECLARE_INSN(rotri_d, OP_ROTRI_D, MASK_ROTRI_D)
991 DECLARE_INSN(bstrins_w, OP_BSTRINS_W, MASK_BSTRINS_W)
992 DECLARE_INSN(bstrpick_w, OP_BSTRPICK_W, MASK_BSTRPICK_W)
993 DECLARE_INSN(bstrins_d, OP_BSTRINS_D, MASK_BSTRINS_D)
994 DECLARE_INSN(bstrpick_d, OP_BSTRPICK_D, MASK_BSTRPICK_D)
996 /* loongarch single float instruction */
997 DECLARE_INSN(fadd_s, OP_FADD_S, MASK_FADD_S)
998 DECLARE_INSN(fsub_s, OP_SUB_S, MASK_SUB_S)
999 DECLARE_INSN(fmul_s, OP_MUL_S, MASK_MUL_S)
1000 DECLARE_INSN(fdiv_s, OP_FDIV_S, MASK_FDIV_S)
1001 DECLARE_INSN(fmax_s, OP_FMAX_S, MASK_FMAX_S)
1002 DECLARE_INSN(fmin_s, OP_FMIN_S, MASK_FMIN_S)
1003 DECLARE_INSN(fmaxa_s, OP_FMAXA_S, MASK_FMAXA_S)
1004 DECLARE_INSN(fmina_s, OP_FMINA_S, MASK_FMINA_S)
1005 DECLARE_INSN(fscaleb_s, OP_FSCALEB_S, MASK_FSCALEB_S)
1006 DECLARE_INSN(fcopysign_s, OP_FCOPYSIGN_S, MASK_FCOPYSIGN_S)
1007 DECLARE_INSN(fabs_s, OP_FABS_S, MASK_FABS_S)
1008 DECLARE_INSN(fneg_s, OP_FNEG_S, MASK_FNEG_S)
1009 DECLARE_INSN(flogb_s, OP_FLOGB_S, MASK_FLOGB_S)
1010 DECLARE_INSN(fclass_s, OP_FCLASS_S, MASK_FCLASS_S)
1011 DECLARE_INSN(fsqrt_s, OP_FSQRT_S, MASK_FSQRT_S)
1012 DECLARE_INSN(frecip_s, OP_FRECIP_S, MASK_FRECIP_S)
1013 DECLARE_INSN(frsqrt_s, OP_FRSQRT_S, MASK_FRSQRT_S)
1014 DECLARE_INSN(frecipe_s, OP_FRECIPE_S, MASK_FRECIPE_S)
1015 DECLARE_INSN(frsqrte_s, OP_FRSQRTE_S, MASK_FRSQRTE_S)
1016 DECLARE_INSN(fmov_s, OP_FMOV_S, MASK_FMOV_S)
1017 DECLARE_INSN(movgr2fr_w, OP_MOVGR2FR_W, MASK_MOVGR2FR_W)
1018 DECLARE_INSN(movgr2frh_w, OP_MOVGR2FRH_W, MASK_MOVGR2FRH_W)
1019 DECLARE_INSN(movfr2gr_s, OP_MOVFR2GR_S, MASK_MOVFR2GR_S)
1020 DECLARE_INSN(movfrh2gr_s, OP_MOVFRH2GR_S, MASK_MOVFRH2GR_S)
1021 DECLARE_INSN(movgr2fcsr, OP_MOVGR2FCSR, MASK_MOVGR2FCSR)
1022 DECLARE_INSN(movfcsr2gr, OP_MOVFCSR2GR, MASK_MOVFCSR2GR)
1023 DECLARE_INSN(movfr2cf, OP_MOVFR2CF, MASK_MOVFR2CF)
1024 DECLARE_INSN(movcf2fr, OP_MOVCF2FR, MASK_MOVCF2FR)
1025 DECLARE_INSN(movgr2cf, OP_MOVGR2CF, MASK_MOVGR2CF)
1026 DECLARE_INSN(movcf2gr, OP_MOVCF2GR, MASK_MOVCF2GR)
1027 DECLARE_INSN(ftintrm_w_s, OP_FTINTRM_W_S, MASK_FTINTRM_W_S)
1028 DECLARE_INSN(ftintrm_l_s, OP_FTINTRM_L_S, MASK_FTINTRM_L_S)
1029 DECLARE_INSN(ftintrp_w_s, OP_FTINTRP_W_S, MASK_FTINTRP_W_S)
1030 DECLARE_INSN(ftintrp_l_s, OP_FTINTRP_L_S, MASK_FTINTRP_L_S)
1031 DECLARE_INSN(ftintrz_w_s, OP_FTINTRZ_W_S, MASK_FTINTRZ_W_S)
1032 DECLARE_INSN(ftintrz_l_s, OP_FTINTRZ_L_S, MASK_FTINTRZ_L_S)
1033 DECLARE_INSN(ftintrne_w_s, OP_FTINTRNE_W_S, MASK_FTINTRNE_W_S)
1034 DECLARE_INSN(ftintrne_l_s, OP_FTINTRNE_L_S, MASK_FTINTRNE_L_S)
1035 DECLARE_INSN(ftint_w_s, OP_FTINT_W_S, MASK_FTINT_W_S)
1036 DECLARE_INSN(ftint_l_s, OP_FTINT_L_S, MASK_FTINT_L_S)
1037 DECLARE_INSN(ffint_s_w, OP_FFINT_S_W, MASK_FFINT_S_W)
1038 DECLARE_INSN(ffint_s_l, OP_FFINT_S_L, MASK_FFINT_S_L)
1039 DECLARE_INSN(frint_s, OP_FRINT_S, MASK_FRINT_S)
1041 /* loongarch double float instruction */
1042 DECLARE_INSN(fadd_d, OP_FADD_D, MASK_FADD_D)
1043 DECLARE_INSN(fsub_d, OP_FSUB_D, MASK_FSUB_D)
1044 DECLARE_INSN(fmul_d, OP_FMUL_D, MASK_FMUL_D)
1045 DECLARE_INSN(fdiv_d, OP_FDIV_D, MASK_FDIV_D)
1046 DECLARE_INSN(fmax_d, OP_FMAX_D, MASK_FMAX_D)
1047 DECLARE_INSN(fmin_d, OP_FMIN_D, MASK_FMIN_D)
1048 DECLARE_INSN(fmaxa_d, OP_FMAXA_D, MASK_FMAXA_D)
1049 DECLARE_INSN(fmina_d, OP_FMINA_D, MASK_FMINA_D)
1050 DECLARE_INSN(fscaleb_d, OP_FSCALEB_D, MASK_FSCALEB_D)
1051 DECLARE_INSN(fcopysign_d, OP_FCOPYSIGN_D, MASK_FCOPYSIGN_D)
1052 DECLARE_INSN(fabs_d, OP_FABS_D, MASK_FABS_D)
1053 DECLARE_INSN(fneg_d, OP_FNEG_D, MASK_FNEG_D)
1054 DECLARE_INSN(flogb_d, OP_FLOGB_D, MASK_FLOGB_D)
1055 DECLARE_INSN(fclass_d, OP_FCLASS_D, MASK_FCLASS_D)
1056 DECLARE_INSN(fsqrt_d, OP_FSQRT_D, MASK_FSQRT_D)
1057 DECLARE_INSN(frecip_d, OP_FRECIP_D, MASK_FRECIP_D)
1058 DECLARE_INSN(frsqrt_d, OP_FRSQRT_D, MASK_FRSQRT_D)
1059 DECLARE_INSN(frecipe_d, OP_FRECIPE_D, MASK_FRECIPE_D)
1060 DECLARE_INSN(frsqrte_d, OP_FRSQRTE_D, MASK_FRSQRTE_D)
1061 DECLARE_INSN(fmov_d, OP_FMOV_D, MASK_FMOV_D)
1062 DECLARE_INSN(movgr2fr_d, OP_MOVGR2FR_D, MASK_MOVGR2FR_D)
1063 DECLARE_INSN(movfr2gr_d, OP_MOVFR2GR_D, MASK_MOVFR2GR_D)
1064 DECLARE_INSN(fcvt_s_d, OP_FCVT_S_D, MASK_FCVT_S_D)
1065 DECLARE_INSN(fcvt_d_s, OP_FCVT_D_S, MASK_FCVT_D_S)
1066 DECLARE_INSN(ftintrm_w_d, OP_FTINTRM_W_D, MASK_FTINTRM_W_D)
1067 DECLARE_INSN(ftintrm_l_d, OP_FTINTRM_L_D, MASK_FTINTRM_L_D)
1068 DECLARE_INSN(ftintrp_w_d, OP_FTINTRP_W_D, MASK_FTINTRP_W_D)
1069 DECLARE_INSN(ftintrp_l_d, OP_FTINTRP_L_D, MASK_FTINTRP_L_D)
1070 DECLARE_INSN(ftintrz_w_d, OP_FTINTRZ_W_D, MASK_FTINTRZ_W_D)
1071 DECLARE_INSN(ftintrz_l_d, OP_FTINTRZ_L_D, MASK_FTINTRZ_L_D)
1072 DECLARE_INSN(ftintrne_w_d, OP_FTINTRNE_W_D, MASK_FTINTRNE_W_D)
1073 DECLARE_INSN(ftintrne_l_d, OP_FTINTRNE_L_D, MASK_FTINTRNE_L_D)
1074 DECLARE_INSN(ftint_w_d, OP_FTINT_W_D, MASK_FTINT_W_D)
1075 DECLARE_INSN(ftint_l_d, OP_FTINT_L_D, MASK_FTINT_L_D)
1076 DECLARE_INSN(ffint_d_w, OP_FFINT_D_W, MASK_FFINT_D_W)
1077 DECLARE_INSN(ffint_d_l, OP_FFINT_D_L, MASK_FFINT_D_L)
1078 DECLARE_INSN(frint_d, OP_FRINT_D, MASK_FRINT_D)
1080 /* loongarch imm instruction */
1081 DECLARE_INSN(slti, OP_SLTI, MASK_SLTI)
1082 DECLARE_INSN(sltui, OP_SLTUI, MASK_SLTUI)
1083 DECLARE_INSN(addi_w, OP_ADDI_W, MASK_ADDI_W)
1084 DECLARE_INSN(addi_d, OP_ADDI_D, MASK_ADDI_D)
1085 DECLARE_INSN(lu52i_d, OP_LU52I_D, MASK_LU52I_D)
1086 DECLARE_INSN(andi, OP_ANDI, MASK_ANDI)
1087 DECLARE_INSN(ori, OP_ORI, MASK_ORI)
1088 DECLARE_INSN(xori, OP_XORI, MASK_XORI)
1089 DECLARE_INSN(addu16i_d, OP_ADDU16I_D, MASK_ADDU16I_D)
1090 DECLARE_INSN(lu12i_w, OP_LU12I_W, MASK_LU12I_W)
1091 DECLARE_INSN(lu32i_d, OP_LU32I_D, MASK_LU32I_D)
1092 DECLARE_INSN(pcaddi, OP_PCADDI, MASK_PCADDI)
1093 DECLARE_INSN(pcalau12i, OP_PCALAU12I, MASK_PCALAU12I)
1094 DECLARE_INSN(pcaddu12i, OP_PCADDU12I, MASK_PCADDU12I)
1095 DECLARE_INSN(pcaddu18i, OP_PCADDU18I, MASK_PCADDU18I)
1097 /* loongarch privilege instruction */
1098 DECLARE_INSN(csrrd, OP_CSRRD, MASK_CSRRD)
1099 DECLARE_INSN(csrwr, OP_CSRWR, MASK_CSRWR)
1100 DECLARE_INSN(csrxchg, OP_CSRXCHG, MASK_CSRXCHG)
1101 DECLARE_INSN(cacop, OP_CACOP, MASK_CACOP)
1102 DECLARE_INSN(lddir, OP_LDDIR, MASK_LDDIR)
1103 DECLARE_INSN(ldpte, OP_LDPTE, MASK_LDPTE)
1104 DECLARE_INSN(iocsrrd_b, OP_IOCSRRD_B, MASK_IOCSRRD_B)
1105 DECLARE_INSN(iocsrrd_h, OP_IOCSRRD_H, MASK_IOCSRRD_H)
1106 DECLARE_INSN(iocsrrd_w, OP_IOCSRRD_W, MASK_IOCSRRD_W)
1107 DECLARE_INSN(iocsrrd_d, OP_IOCSRRD_D, MASK_IOCSRRD_D)
1108 DECLARE_INSN(iocsrwr_b, OP_IOCSRWR_B, MASK_IOCSRWR_B)
1109 DECLARE_INSN(iocsrwr_h, OP_IOCSRWR_H, MASK_IOCSRWR_H)
1110 DECLARE_INSN(iocsrwr_w, OP_IOCSRWR_W, MASK_IOCSRWR_W)
1111 DECLARE_INSN(iocsrwr_d, OP_IOCSRWR_D, MASK_IOCSRWR_D)
1112 DECLARE_INSN(tlbclr, OP_TLBCLR, MASK_TLBCLR)
1113 DECLARE_INSN(tlbflush, OP_TLBFLUSH, MASK_TLBFLUSH)
1114 DECLARE_INSN(tlbsrch, OP_TLBSRCH, MASK_TLBSRCH)
1115 DECLARE_INSN(tlbrd, OP_TLBRD, MASK_TLBRD)
1116 DECLARE_INSN(tlbwr, OP_TLBWR, MASK_TLBWR)
1117 DECLARE_INSN(tlbfill, OP_TLBFILL, MASK_TLBFILL)
1118 DECLARE_INSN(ertn, OP_ERTN, MASK_ERTN)
1119 DECLARE_INSN(idle, OP_IDLE, MASK_IDLE)
1120 DECLARE_INSN(invtlb, OP_INVTLB, MASK_INVTLB)
1122 /* loongarch 4opt single float instruction */
1123 DECLARE_INSN(fmadd_s, OP_FMADD_S, MASK_FMADD_S)
1124 DECLARE_INSN(fmsub_s, OP_FMSUB_S, MASK_FMSUB_S)
1125 DECLARE_INSN(fnmadd_s, OP_FNMADD_S, MASK_FNMADD_S)
1126 DECLARE_INSN(fnmsub_s, OP_FNMSUB_S, MASK_FNMSUB_S)
1127 DECLARE_INSN(fcmp_caf_s, OP_FCMP_CAF_S, MASK_FCMP_CAF_S)
1128 DECLARE_INSN(fcmp_saf_s, OP_FCMP_SAF_S, MASK_FCMP_SAF_S)
1129 DECLARE_INSN(fcmp_clt_s, OP_FCMP_CLT_S, MASK_FCMP_CLT_S)
1130 DECLARE_INSN(fcmp_slt_s, OP_FCMP_SLT_S, MASK_FCMP_SLT_S)
1131 DECLARE_INSN(fcmp_sgt_s, OP_FCMP_SGT_S, MASK_FCMP_SGT_S)
1132 DECLARE_INSN(fcmp_ceq_s, OP_FCMP_CEQ_S, MASK_FCMP_CEQ_S)
1133 DECLARE_INSN(fcmp_seq_s, OP_FCMP_SEQ_S, MASK_FCMP_SEQ_S)
1134 DECLARE_INSN(fcmp_cle_s, OP_FCMP_CLE_S, MASK_FCMP_CLE_S)
1135 DECLARE_INSN(fcmp_sle_s, OP_FCMP_SLE_S, MASK_FCMP_SLE_S)
1136 DECLARE_INSN(fcmp_sge_s, OP_FCMP_SGE_S, MASK_FCMP_SGE_S)
1137 DECLARE_INSN(fcmp_cun_s, OP_FCMP_CUN_S, MASK_FCMP_CUN_S)
1138 DECLARE_INSN(fcmp_sun_s, OP_FCMP_SUN_S, MASK_FCMP_SUN_S)
1139 DECLARE_INSN(fcmp_cult_s, OP_FCMP_CULT_S, MASK_FCMP_CULT_S)
1140 DECLARE_INSN(fcmp_cugt_s, OP_FCMP_CUGT_S, MASK_FCMP_CUGT_S)
1141 DECLARE_INSN(fcmp_sult_s, OP_FCMP_SULT_S, MASK_FCMP_SULT_S)
1142 DECLARE_INSN(fcmp_cueq_s, OP_FCMP_CUEQ_S, MASK_FCMP_CUEQ_S)
1143 DECLARE_INSN(fcmp_sueq_s, OP_FCMP_SUEQ_S, MASK_FCMP_SUEQ_S)
1144 DECLARE_INSN(fcmp_cule_s, OP_FCMP_CULE_S, MASK_FCMP_CULE_S)
1145 DECLARE_INSN(fcmp_cuge_s, OP_FCMP_CUGE_S, MASK_FCMP_CUGE_S)
1146 DECLARE_INSN(fcmp_sule_s, OP_FCMP_SULE_S, MASK_FCMP_SULE_S)
1147 DECLARE_INSN(fcmp_cne_s, OP_FCMP_CNE_S, MASK_FCMP_CNE_S)
1148 DECLARE_INSN(fcmp_sne_s, OP_FCMP_SNE_S, MASK_FCMP_SNE_S)
1149 DECLARE_INSN(fcmp_cor_s, OP_FCMP_COR_S, MASK_FCMP_COR_S)
1150 DECLARE_INSN(fcmp_sor_s, OP_FCMP_SOR_S, MASK_FCMP_SOR_S)
1151 DECLARE_INSN(fcmp_cune_s, OP_FCMP_CUNE_S, MASK_FCMP_CUNE_S)
1152 DECLARE_INSN(fcmp_sune_s, OP_FCMP_SUNE_S, MASK_FCMP_SUNE_S)
1153 DECLARE_INSN(fsel, OP_FSEL, MASK_FSEL)
1155 /* loongarch 4opt double float instruction */
1156 DECLARE_INSN(fmadd_d, OP_FMADD_D, MASK_FMADD_D)
1157 DECLARE_INSN(fmsub_d, OP_FMSUB_D, MASK_FMSUB_D)
1158 DECLARE_INSN(fnmadd_d, OP_FNMADD_D, MASK_FNMADD_D)
1159 DECLARE_INSN(fnmsub_d, OP_FNMSUB_D, MASK_FNMSUB_D)
1160 DECLARE_INSN(fcmp_caf_d, OP_FCMP_CAF_D, MASK_FCMP_CAF_D)
1161 DECLARE_INSN(fcmp_saf_d, OP_FCMP_SAF_D, MASK_FCMP_SAF_D)
1162 DECLARE_INSN(fcmp_clt_d, OP_FCMP_CLT_D, MASK_FCMP_CLT_D)
1163 DECLARE_INSN(fcmp_slt_d, OP_FCMP_SLT_D, MASK_FCMP_SLT_D)
1164 DECLARE_INSN(fcmp_sgt_d, OP_FCMP_SGT_D, MASK_FCMP_SGT_D)
1165 DECLARE_INSN(fcmp_ceq_d, OP_FCMP_CEQ_D, MASK_FCMP_CEQ_D)
1166 DECLARE_INSN(fcmp_seq_d, OP_FCMP_SEQ_D, MASK_FCMP_SEQ_D)
1167 DECLARE_INSN(fcmp_cle_d, OP_FCMP_CLE_D, MASK_FCMP_CLE_D)
1168 DECLARE_INSN(fcmp_sle_d, OP_FCMP_SLE_D, MASK_FCMP_SLE_D)
1169 DECLARE_INSN(fcmp_sge_d, OP_FCMP_SGE_D, MASK_FCMP_SGE_D)
1170 DECLARE_INSN(fcmp_cun_d, OP_FCMP_CUN_D, MASK_FCMP_CUN_D)
1171 DECLARE_INSN(fcmp_sun_d, OP_FCMP_SUN_D, MASK_FCMP_SUN_D)
1172 DECLARE_INSN(fcmp_cult_d, OP_FCMP_CULT_D, MASK_FCMP_CULT_D)
1173 DECLARE_INSN(fcmp_cugt_d, OP_FCMP_CUGT_D, MASK_FCMP_CUGT_D)
1174 DECLARE_INSN(fcmp_sult_d, OP_FCMP_SULT_D, MASK_FCMP_SULT_D)
1175 DECLARE_INSN(fcmp_cueq_d, OP_FCMP_CUEQ_D, MASK_FCMP_CUEQ_D)
1176 DECLARE_INSN(fcmp_sueq_d, OP_FCMP_SUEQ_D, MASK_FCMP_SUEQ_D)
1177 DECLARE_INSN(fcmp_cule_d, OP_FCMP_CULE_D, MASK_FCMP_CULE_D)
1178 DECLARE_INSN(fcmp_cuge_d, OP_FCMP_CUGE_D, MASK_FCMP_CUGE_D)
1179 DECLARE_INSN(fcmp_sule_d, OP_FCMP_SULE_D, MASK_FCMP_SULE_D)
1180 DECLARE_INSN(fcmp_cne_d, OP_FCMP_CNE_D, MASK_FCMP_CNE_D)
1181 DECLARE_INSN(fcmp_sne_d, OP_FCMP_SNE_D, MASK_FCMP_SNE_D)
1182 DECLARE_INSN(fcmp_cor_d, OP_FCMP_COR_D, MASK_FCMP_COR_D)
1183 DECLARE_INSN(fcmp_sor_d, OP_FCMP_SOR_D, MASK_FCMP_SOR_D)
1184 DECLARE_INSN(fcmp_cune_d, OP_FCMP_CUNE_D, MASK_FCMP_CUNE_D)
1185 DECLARE_INSN(fcmp_sune_d, OP_FCMP_SUNE_D, MASK_FCMP_SUNE_D)
1187 /* loongarch load store instruction */
1188 DECLARE_INSN(ll_w, OP_LL_W, MASK_LL_W)
1189 DECLARE_INSN(sc_w, OP_SC_W, MASK_SC_W)
1190 DECLARE_INSN(ll_d, OP_LL_D, MASK_LL_D)
1191 DECLARE_INSN(sc_d, OP_SC_D, MASK_SC_D)
1192 DECLARE_INSN(ldptr_w, OP_LDPTR_W, MASK_LDPTR_W)
1193 DECLARE_INSN(stptr_w, OP_STPTR_W, MASK_STPTR_W)
1194 DECLARE_INSN(ldptr_d, OP_LDPTR_D, MASK_LDPTR_D)
1195 DECLARE_INSN(stptr_d, OP_STPTR_D, MASK_STPTR_D)
1196 DECLARE_INSN(ld_b, OP_LD_B, MASK_LD_B)
1197 DECLARE_INSN(ld_h, OP_LD_H, MASK_LD_H)
1198 DECLARE_INSN(ld_w, OP_LD_W, MASK_LD_W)
1199 DECLARE_INSN(ld_d, OP_LD_D, MASK_LD_D)
1200 DECLARE_INSN(st_b, OP_ST_B, MASK_ST_B)
1201 DECLARE_INSN(st_h, OP_ST_H, MASK_ST_H)
1202 DECLARE_INSN(st_w, OP_ST_W, MASK_ST_W)
1203 DECLARE_INSN(st_d, OP_ST_D, MASK_ST_D)
1204 DECLARE_INSN(ld_bu, OP_LD_BU, MASK_LD_BU)
1205 DECLARE_INSN(ld_hu, OP_LD_HU, MASK_LD_HU)
1206 DECLARE_INSN(ld_wu, OP_LD_WU, MASK_LD_WU)
1207 DECLARE_INSN(preld, OP_PRELD, MASK_PRELD)
1208 DECLARE_INSN(ldx_b, OP_LDX_B, MASK_LDX_B)
1209 DECLARE_INSN(ldx_h, OP_LDX_H, MASK_LDX_H)
1210 DECLARE_INSN(ldx_w, OP_LDX_W, MASK_LDX_W)
1211 DECLARE_INSN(ldx_d, OP_LDX_D, MASK_LDX_D)
1212 DECLARE_INSN(stx_b, OP_STX_B, MASK_STX_B)
1213 DECLARE_INSN(stx_h, OP_STX_H, MASK_STX_H)
1214 DECLARE_INSN(stx_w, OP_STX_W, MASK_STX_W)
1215 DECLARE_INSN(stx_d, OP_STX_D, MASK_STX_D)
1216 DECLARE_INSN(ldx_bu, OP_LDX_BU, MASK_LDX_BU)
1217 DECLARE_INSN(ldx_hu, OP_LDX_HU, MASK_LDX_HU)
1218 DECLARE_INSN(ldx_wu, OP_LDX_WU, MASK_LDX_WU)
1219 DECLARE_INSN(preldx, OP_PRELDX, MASK_PRELDX)
1220 DECLARE_INSN(sc_q, OP_SC_Q, MASK_SC_Q)
1221 DECLARE_INSN(llacq_w, OP_LLACQ_W, MASK_LLACQ_W)
1222 DECLARE_INSN(screl_w, OP_SCREL_W, MASK_SCREL_W)
1223 DECLARE_INSN(llacq_d, OP_LLACQ_D, MASK_LLACQ_D)
1224 DECLARE_INSN(screl_d, OP_SCREL_D, MASK_LLACQ_D)
1225 DECLARE_INSN(amcas_b, OP_AMCAS_B, MASK_AMCAS_B)
1226 DECLARE_INSN(amcas_h, OP_AMCAS_H, MASK_AMCAS_H)
1227 DECLARE_INSN(amcas_w, OP_AMCAS_W, MASK_AMCAS_W)
1228 DECLARE_INSN(amcas_d, OP_AMCAS_D, MASK_AMCAS_D)
1229 DECLARE_INSN(amcas_db_b, OP_AMCAS_DB_B, MASK_AMCAS_DB_B)
1230 DECLARE_INSN(amcas_db_h, OP_AMCAS_DB_H, MASK_AMCAS_DB_H)
1231 DECLARE_INSN(amcas_db_w, OP_AMCAS_DB_W, MASK_AMCAS_DB_W)
1232 DECLARE_INSN(amcas_db_d, OP_AMCAS_DB_D, MASK_AMCAS_DB_D)
1233 DECLARE_INSN(amswap_b, OP_AMSWAP_B, MASK_AMSWAP_B)
1234 DECLARE_INSN(amswap_h, OP_AMSWAP_H, MASK_AMSWAP_H)
1235 DECLARE_INSN(amadd_b, OP_AMADD_B, MASK_AMADD_B)
1236 DECLARE_INSN(amadd_h, OP_AMADD_H, MASK_AMADD_H)
1237 DECLARE_INSN(amswap_db_b, OP_AMSWAP_DB_B, MASK_AMSWAP_DB_B)
1238 DECLARE_INSN(amswap_db_h, OP_AMSWAP_DB_H, MASK_AMSWAP_DB_H)
1239 DECLARE_INSN(amadd_db_b, OP_AMADD_DB_B, MASK_AMADD_DB_B)
1240 DECLARE_INSN(amadd_db_h, OP_AMADD_DB_H, MASK_AMADD_DB_H)
1241 DECLARE_INSN(amswap_w, OP_AMSWAP_W, MASK_AMSWAP_W)
1242 DECLARE_INSN(amswap_d, OP_AMSWAP_D, MASK_AMSWAP_D)
1243 DECLARE_INSN(amadd_w, OP_AMADD_W, MASK_AMADD_W)
1244 DECLARE_INSN(amadd_d, OP_AMADD_D, MASK_AMADD_D)
1245 DECLARE_INSN(amand_w, OP_AMAND_W, MASK_AMAND_W)
1246 DECLARE_INSN(amand_d, OP_AMAND_D, MASK_AMAND_D)
1247 DECLARE_INSN(amor_w, OP_AMOR_W, MASK_AMOR_W)
1248 DECLARE_INSN(amor_d, OP_AMOR_D, MASK_AMOR_D)
1249 DECLARE_INSN(amxor_w, OP_AMXOR_W, MASK_AMXOR_W)
1250 DECLARE_INSN(amxor_d, OP_AMXOR_D, MASK_AMXOR_D)
1251 DECLARE_INSN(ammax_w, OP_AMMAX_W, MASK_AMMAX_W)
1252 DECLARE_INSN(ammax_d, OP_AMMAX_D, MASK_AMMAX_D)
1253 DECLARE_INSN(ammin_w, OP_AMMIN_W, MASK_AMMIN_W)
1254 DECLARE_INSN(ammin_d, OP_AMMIN_D, MASK_AMMIN_D)
1255 DECLARE_INSN(ammax_wu, OP_AMMAX_WU, MASK_AMMAX_WU)
1256 DECLARE_INSN(ammax_du, OP_AMMAX_DU, MASK_AMMAX_DU)
1257 DECLARE_INSN(ammin_wu, OP_AMMIN_WU, MASK_AMMIN_WU)
1258 DECLARE_INSN(ammin_du, OP_AMMIN_DU, MASK_AMMIN_DU)
1259 DECLARE_INSN(amswap_db_w, OP_AMSWAP_DB_W, MASK_AMSWAP_DB_W)
1260 DECLARE_INSN(amswap_db_d, OP_AMSWAP_DB_D, MASK_AMSWAP_DB_D)
1261 DECLARE_INSN(amadd_db_w, OP_AMADD_DB_W, MASK_AMADD_DB_W)
1262 DECLARE_INSN(amadd_db_d, OP_AMADD_DB_D, MASK_AMADD_DB_D)
1263 DECLARE_INSN(amand_db_w, OP_AMAND_DB_W, MASK_AMAND_DB_W)
1264 DECLARE_INSN(amand_db_d, OP_AMAND_DB_D, MASK_AMAND_DB_D)
1265 DECLARE_INSN(amor_db_w, OP_AMOR_DB_W, MASK_AMOR_DB_W)
1266 DECLARE_INSN(amor_db_d, OP_AMOR_DB_D, MASK_AMOR_DB_D)
1267 DECLARE_INSN(amxor_db_w, OP_AMXOR_DB_W, MASK_AMXOR_DB_W)
1268 DECLARE_INSN(amxor_db_d, OP_AMXOR_DB_D, MASK_AMXOR_DB_D)
1269 DECLARE_INSN(ammax_db_w, OP_AMMAX_DB_W, MASK_AMMAX_DB_W)
1270 DECLARE_INSN(ammax_db_d, OP_AMMAX_DB_D, MASK_AMMAX_DB_D)
1271 DECLARE_INSN(ammin_db_w, OP_AMMIN_DB_W, MASK_AMMIN_DB_W)
1272 DECLARE_INSN(ammin_db_d, OP_AMMIN_DB_D, MASK_AMMIN_DB_D)
1273 DECLARE_INSN(ammax_db_wu, OP_AMMAX_DB_WU, MASK_AMMAX_DB_WU)
1274 DECLARE_INSN(ammax_db_du, OP_AMMAX_DB_DU, MASK_AMMAX_DB_DU)
1275 DECLARE_INSN(ammin_db_wu, OP_AMMIN_DB_WU, MASK_AMMIN_DB_WU)
1276 DECLARE_INSN(ammin_db_du, OP_AMMIN_DB_DU, MASK_AMMIN_DB_DU)
1277 DECLARE_INSN(dbar, OP_DBAR, MASK_DBAR)
1278 DECLARE_INSN(ibar, OP_IBAR, MASK_IBAR)
1279 DECLARE_INSN(ldgt_b, OP_LDGT_B, MASK_LDGT_B)
1280 DECLARE_INSN(ldgt_h, OP_LDGT_H, MASK_LDGT_H)
1281 DECLARE_INSN(ldgt_w, OP_LDGT_W, MASK_LDGT_W)
1282 DECLARE_INSN(ldgt_d, OP_LDGT_D, MASK_LDGT_D)
1283 DECLARE_INSN(ldle_b, OP_LDLE_B, MASK_LDLE_B)
1284 DECLARE_INSN(ldle_h, OP_LDLE_H, MASK_LDLE_H)
1285 DECLARE_INSN(ldle_w, OP_LDLE_W, MASK_LDLE_W)
1286 DECLARE_INSN(ldle_d, OP_LDLE_D, MASK_LDLE_D)
1287 DECLARE_INSN(stgt_b, OP_STGT_B, MASK_STGT_B)
1288 DECLARE_INSN(stgt_h, OP_STGT_H, MASK_STGT_H)
1289 DECLARE_INSN(stgt_w, OP_STGT_W, MASK_STGT_W)
1290 DECLARE_INSN(stgt_d, OP_STGT_D, MASK_STGT_D)
1291 DECLARE_INSN(stle_b, OP_STLE_B, MASK_STLE_B)
1292 DECLARE_INSN(stle_h, OP_STLE_H, MASK_STLE_H)
1293 DECLARE_INSN(stle_w, OP_STLE_W, MASK_STLE_W)
1294 DECLARE_INSN(stle_d, OP_STLE_D, MASK_STLE_D)
1295 DECLARE_INSN(vld, OP_VLD, MASK_VLD)
1296 DECLARE_INSN(vst, OP_VST, MASK_VST)
1297 DECLARE_INSN(xvld, OP_XVLD, MASK_XVLD)
1298 DECLARE_INSN(xvst, OP_XVST, MASK_XVST)
1300 /* loongarch single float load store instruction */
1301 DECLARE_INSN(fld_s, OP_FLD_S, MASK_FLD_S)
1302 DECLARE_INSN(fst_s, OP_FST_S, MASK_FST_S)
1303 DECLARE_INSN(fldx_s, OP_FLDX_S, MASK_FLDX_S)
1304 DECLARE_INSN(fstx_s, OP_FSTX_S, MASK_FSTX_S)
1305 DECLARE_INSN(fldgt_s, OP_FLDGT_S, MASK_FLDGT_S)
1306 DECLARE_INSN(fldle_s, OP_FLDLE_S, MASK_FLDLE_S)
1307 DECLARE_INSN(fstgt_s, OP_FSTGT_S, MASK_FSTGT_S)
1308 DECLARE_INSN(fstle_s, OP_FSTLE_S, MASK_FSTLE_S)
1310 /* loongarch double float load store instruction */
1311 DECLARE_INSN(fld_d, OP_FLD_D, MASK_FLD_D)
1312 DECLARE_INSN(fst_d, OP_FST_D, MASK_FST_D)
1313 DECLARE_INSN(fldx_d, OP_FLDX_D, MASK_FLDX_D)
1314 DECLARE_INSN(fstx_d, OP_FSTX_D, MASK_FSTX_D)
1315 DECLARE_INSN(fldgt_d, OP_FLDGT_D, MASK_FLDGT_D)
1316 DECLARE_INSN(fldle_d, OP_FLDLE_D, MASK_FLDLE_D)
1317 DECLARE_INSN(fstgt_d, OP_FSTGT_D, MASK_FSTGT_D)
1318 DECLARE_INSN(fstle_d, OP_FSTLE_D, MASK_FSTLE_D)
1320 /* loongarch float jmp instruction */
1321 DECLARE_INSN(bceqz, OP_BCEQZ, MASK_BCEQZ)
1322 DECLARE_INSN(bcnez, OP_BCNEZ, MASK_BCNEZ)
1324 /* loongarch jmp instruction */
1325 DECLARE_INSN(beqz, OP_BEQZ, MASK_BEQZ)
1326 DECLARE_INSN(bnez, OP_BNEZ, MASK_BNEZ)
1327 DECLARE_INSN(jirl, OP_JIRL, MASK_JIRL)
1328 DECLARE_INSN(b, OP_B, MASK_B)
1329 DECLARE_INSN(bl, OP_BL, MASK_BL)
1330 DECLARE_INSN(beq, OP_BEQ, MASK_BEQ)
1331 DECLARE_INSN(bne, OP_BNE, MASK_BNE)
1332 DECLARE_INSN(blt, OP_BLT, MASK_BLT)
1333 DECLARE_INSN(bge, OP_BGE, MASK_BGE)
1334 DECLARE_INSN(bltu, OP_BLTU, MASK_BLTU)
1335 DECLARE_INSN(bgeu, OP_BGEU, MASK_BGEU)
1337 #undef DECLARE_INSN
1339 static inline bool
1340 is_arithmetic_operation_insn (uint32_t insn)
1342 if (is_add_w_insn (insn)
1343 || is_add_d_insn (insn)
1344 || is_sub_w_insn (insn)
1345 || is_sub_d_insn (insn)
1346 || is_addi_w_insn (insn)
1347 || is_addi_d_insn (insn)
1348 || is_addu16i_d_insn (insn)
1349 || is_alsl_w_insn (insn)
1350 || is_alsl_wu_insn (insn)
1351 || is_alsl_d_insn (insn)
1352 || is_lu12i_w_insn (insn)
1353 || is_lu32i_d_insn (insn)
1354 || is_lu52i_d_insn (insn)
1355 || is_slt_insn (insn)
1356 || is_sltu_insn (insn)
1357 || is_slti_insn (insn)
1358 || is_sltui_insn (insn)
1359 || is_pcaddi_insn (insn)
1360 || is_pcaddu12i_insn (insn)
1361 || is_pcaddu18i_insn (insn)
1362 || is_pcalau12i_insn (insn)
1363 || is_and_insn (insn)
1364 || is_or_insn (insn)
1365 || is_nor_insn (insn)
1366 || is_xor_insn (insn)
1367 || is_andn_insn (insn)
1368 || is_orn_insn (insn)
1369 || is_andi_insn (insn)
1370 || is_ori_insn (insn)
1371 || is_xori_insn (insn)
1372 || is_mul_w_insn (insn)
1373 || is_mul_d_insn (insn)
1374 || is_mulh_w_insn (insn)
1375 || is_mulh_wu_insn (insn)
1376 || is_mulh_d_insn (insn)
1377 || is_mulh_du_insn (insn)
1378 || is_mulw_d_w_insn (insn)
1379 || is_mulw_d_wu_insn (insn)
1380 || is_div_w_insn (insn)
1381 || is_div_wu_insn (insn)
1382 || is_div_d_insn (insn)
1383 || is_div_du_insn (insn)
1384 || is_mod_w_insn (insn)
1385 || is_mod_wu_insn (insn)
1386 || is_mod_d_insn (insn)
1387 || is_mod_du_insn (insn))
1388 return true;
1389 else
1390 return false;
1393 static inline bool
1394 is_bit_shift_insn (uint32_t insn)
1396 if (is_sll_w_insn (insn)
1397 || is_srl_w_insn (insn)
1398 || is_sra_w_insn (insn)
1399 || is_rotr_w_insn (insn)
1400 || is_slli_w_insn (insn)
1401 || is_srli_w_insn (insn)
1402 || is_srai_w_insn (insn)
1403 || is_rotri_w_insn (insn)
1404 || is_slli_d_insn (insn)
1405 || is_srli_d_insn (insn)
1406 || is_srai_d_insn (insn)
1407 || is_rotri_d_insn (insn)
1408 || is_sll_d_insn (insn)
1409 || is_srl_d_insn (insn)
1410 || is_sra_d_insn (insn)
1411 || is_rotr_d_insn (insn))
1412 return true;
1413 else
1414 return false;
1417 static inline bool
1418 is_bit_manipulation_insn (uint32_t insn)
1420 if (is_clo_w_insn (insn)
1421 || is_clz_w_insn (insn)
1422 || is_cto_w_insn (insn)
1423 || is_ctz_w_insn (insn)
1424 || is_clo_d_insn (insn)
1425 || is_clz_d_insn (insn)
1426 || is_cto_d_insn (insn)
1427 || is_ctz_d_insn (insn)
1428 || is_ext_w_h_insn (insn)
1429 || is_ext_w_b_insn (insn)
1430 || is_bytepick_w_insn (insn)
1431 || is_bytepick_d_insn (insn)
1432 || is_revb_2h_insn (insn)
1433 || is_revb_4h_insn (insn)
1434 || is_revb_2w_insn (insn)
1435 || is_revb_d_insn (insn)
1436 || is_revh_2w_insn (insn)
1437 || is_revh_d_insn (insn)
1438 || is_bitrev_4b_insn (insn)
1439 || is_bitrev_8b_insn (insn)
1440 || is_bitrev_w_insn (insn)
1441 || is_bitrev_d_insn (insn)
1442 || is_bstrins_w_insn (insn)
1443 || is_bstrpick_w_insn (insn)
1444 || is_bstrins_d_insn (insn)
1445 || is_bstrpick_d_insn (insn)
1446 || is_maskeqz_insn (insn)
1447 || is_masknez_insn (insn))
1448 return true;
1449 else
1450 return false;
1453 static inline bool
1454 is_load_insn (uint32_t insn)
1456 if (is_ld_b_insn (insn)
1457 || is_ld_h_insn (insn)
1458 || is_ld_w_insn (insn)
1459 || is_ld_d_insn (insn)
1460 || is_ld_bu_insn (insn)
1461 || is_ld_hu_insn (insn)
1462 || is_ld_wu_insn (insn)
1463 || is_ldx_b_insn (insn)
1464 || is_ldx_h_insn (insn)
1465 || is_ldx_w_insn (insn)
1466 || is_ldx_d_insn (insn)
1467 || is_ldx_bu_insn (insn)
1468 || is_ldx_hu_insn (insn)
1469 || is_ldx_wu_insn (insn)
1470 || is_ldptr_w_insn (insn)
1471 || is_ldptr_d_insn (insn)
1472 || is_ll_w_insn (insn)
1473 || is_ll_d_insn (insn)
1474 || is_llacq_w_insn (insn)
1475 || is_llacq_d_insn (insn)
1476 || is_vld_insn (insn)
1477 || is_xvld_insn (insn))
1478 return true;
1479 else
1480 return false;
1483 static inline bool
1484 is_crc_check_insn (uint32_t insn)
1486 if (is_crc_w_b_w_insn (insn)
1487 || is_crc_w_h_w_insn (insn)
1488 || is_crc_w_w_w_insn (insn)
1489 || is_crc_w_d_w_insn (insn)
1490 || is_crcc_w_b_w_insn (insn)
1491 || is_crcc_w_h_w_insn (insn)
1492 || is_crcc_w_w_w_insn (insn)
1493 || is_crcc_w_d_w_insn (insn))
1494 return true;
1495 else
1496 return false;
1499 static inline bool
1500 is_fr_to_gr_insn (uint32_t insn)
1502 if (is_movfr2gr_s_insn (insn)
1503 || is_movfr2gr_d_insn (insn)
1504 || is_movfrh2gr_s_insn (insn)
1505 || is_movfcsr2gr_insn (insn)
1506 || is_movcf2gr_insn (insn))
1507 return true;
1508 else
1509 return false;
1512 static inline bool
1513 is_data_process_insn (uint32_t insn)
1515 if (is_arithmetic_operation_insn (insn)
1516 || is_bit_shift_insn (insn)
1517 || is_bit_manipulation_insn (insn)
1518 || is_load_insn (insn)
1519 || is_crc_check_insn (insn)
1520 || is_fr_to_gr_insn (insn)
1521 || is_cpucfg_insn (insn)
1522 || is_lddir_insn (insn))
1523 return true;
1524 else
1525 return false;
1528 static inline bool
1529 is_read_time_insn (uint32_t insn)
1531 if (is_rdtimel_w_insn (insn)
1532 || is_rdtimeh_w_insn (insn)
1533 || is_rdtime_d_insn (insn))
1534 return true;
1535 else
1536 return false;
1539 static inline bool
1540 is_float_arithmetic_operation_insn (uint32_t insn)
1542 if (is_fadd_s_insn (insn)
1543 || is_fsub_s_insn (insn)
1544 || is_fmul_s_insn (insn)
1545 || is_fdiv_s_insn (insn)
1546 || is_fadd_d_insn (insn)
1547 || is_fsub_d_insn (insn)
1548 || is_fmul_d_insn (insn)
1549 || is_fdiv_d_insn (insn)
1550 || is_fmadd_s_insn (insn)
1551 || is_fmsub_s_insn (insn)
1552 || is_fnmadd_s_insn (insn)
1553 || is_fnmsub_s_insn (insn)
1554 || is_fmadd_d_insn (insn)
1555 || is_fmsub_d_insn (insn)
1556 || is_fnmadd_d_insn (insn)
1557 || is_fnmsub_d_insn (insn)
1558 || is_fmax_s_insn (insn)
1559 || is_fmin_s_insn (insn)
1560 || is_fmax_d_insn (insn)
1561 || is_fmin_d_insn (insn)
1562 || is_fmaxa_s_insn (insn)
1563 || is_fmina_s_insn (insn)
1564 || is_fmaxa_d_insn (insn)
1565 || is_fmina_d_insn (insn)
1566 || is_fabs_s_insn (insn)
1567 || is_fneg_s_insn (insn)
1568 || is_fabs_d_insn (insn)
1569 || is_fneg_d_insn (insn)
1570 || is_fsqrt_s_insn (insn)
1571 || is_frecip_s_insn (insn)
1572 || is_frsqrt_s_insn (insn)
1573 || is_fsqrt_d_insn (insn)
1574 || is_frecip_d_insn (insn)
1575 || is_frsqrt_d_insn (insn)
1576 || is_fscaleb_s_insn (insn)
1577 || is_flogb_s_insn (insn)
1578 || is_fcopysign_s_insn (insn)
1579 || is_fscaleb_d_insn (insn)
1580 || is_flogb_d_insn (insn)
1581 || is_fcopysign_d_insn (insn)
1582 || is_fclass_s_insn (insn)
1583 || is_fclass_d_insn (insn)
1584 || is_frecipe_s_insn (insn)
1585 || is_frsqrte_s_insn (insn)
1586 || is_frecipe_d_insn (insn)
1587 || is_frsqrte_d_insn (insn))
1588 return true;
1589 else
1590 return false;
1593 static inline bool
1594 is_float_comparison_insn (uint32_t insn)
1596 if (is_fcmp_caf_s_insn (insn)
1597 || is_fcmp_cun_s_insn (insn)
1598 || is_fcmp_ceq_s_insn (insn)
1599 || is_fcmp_cueq_s_insn (insn)
1600 || is_fcmp_clt_s_insn (insn)
1601 || is_fcmp_cult_s_insn (insn)
1602 || is_fcmp_cle_s_insn (insn)
1603 || is_fcmp_cule_s_insn (insn)
1604 || is_fcmp_cne_s_insn (insn)
1605 || is_fcmp_cor_s_insn (insn)
1606 || is_fcmp_cune_s_insn (insn)
1607 || is_fcmp_saf_s_insn (insn)
1608 || is_fcmp_sun_s_insn (insn)
1609 || is_fcmp_seq_s_insn (insn)
1610 || is_fcmp_sueq_s_insn (insn)
1611 || is_fcmp_slt_s_insn (insn)
1612 || is_fcmp_sult_s_insn (insn)
1613 || is_fcmp_sle_s_insn (insn)
1614 || is_fcmp_sule_s_insn (insn)
1615 || is_fcmp_sne_s_insn (insn)
1616 || is_fcmp_sor_s_insn (insn)
1617 || is_fcmp_sune_s_insn (insn)
1618 || is_fcmp_sgt_s_insn (insn)
1619 || is_fcmp_sge_s_insn (insn)
1620 || is_fcmp_cugt_s_insn (insn)
1621 || is_fcmp_cuge_s_insn (insn)
1622 || is_fcmp_caf_d_insn (insn)
1623 || is_fcmp_cun_d_insn (insn)
1624 || is_fcmp_ceq_d_insn (insn)
1625 || is_fcmp_cueq_d_insn (insn)
1626 || is_fcmp_clt_d_insn (insn)
1627 || is_fcmp_cult_d_insn (insn)
1628 || is_fcmp_cle_d_insn (insn)
1629 || is_fcmp_cule_d_insn (insn)
1630 || is_fcmp_cne_d_insn (insn)
1631 || is_fcmp_cor_d_insn (insn)
1632 || is_fcmp_cune_d_insn (insn)
1633 || is_fcmp_saf_d_insn (insn)
1634 || is_fcmp_sun_d_insn (insn)
1635 || is_fcmp_seq_d_insn (insn)
1636 || is_fcmp_sueq_d_insn (insn)
1637 || is_fcmp_slt_d_insn (insn)
1638 || is_fcmp_sult_d_insn (insn)
1639 || is_fcmp_sle_d_insn (insn)
1640 || is_fcmp_sule_d_insn (insn)
1641 || is_fcmp_sne_d_insn (insn)
1642 || is_fcmp_sor_d_insn (insn)
1643 || is_fcmp_sune_d_insn (insn)
1644 || is_fcmp_sgt_d_insn (insn)
1645 || is_fcmp_sge_d_insn (insn)
1646 || is_fcmp_cugt_d_insn (insn)
1647 || is_fcmp_cuge_d_insn (insn))
1648 return true;
1649 else
1650 return false;
1653 static inline bool
1654 is_float_conversion_insn (uint32_t insn)
1656 if (is_fcvt_s_d_insn (insn)
1657 || is_fcvt_d_s_insn (insn)
1658 || is_ffint_s_w_insn (insn)
1659 || is_ffint_s_l_insn (insn)
1660 || is_ffint_d_w_insn (insn)
1661 || is_ffint_d_l_insn (insn)
1662 || is_ftint_w_s_insn (insn)
1663 || is_ftint_l_s_insn (insn)
1664 || is_ftint_w_d_insn (insn)
1665 || is_ftint_l_d_insn (insn)
1666 || is_ftintrm_w_s_insn (insn)
1667 || is_ftintrm_l_s_insn (insn)
1668 || is_ftintrp_w_s_insn (insn)
1669 || is_ftintrp_l_s_insn (insn)
1670 || is_ftintrz_w_s_insn (insn)
1671 || is_ftintrz_l_s_insn (insn)
1672 || is_ftintrne_w_s_insn (insn)
1673 || is_ftintrne_l_s_insn (insn)
1674 || is_ftintrm_w_d_insn (insn)
1675 || is_ftintrm_l_d_insn (insn)
1676 || is_ftintrp_w_d_insn (insn)
1677 || is_ftintrp_l_d_insn (insn)
1678 || is_ftintrz_w_d_insn (insn)
1679 || is_ftintrz_l_d_insn (insn)
1680 || is_ftintrne_w_d_insn (insn)
1681 || is_ftintrne_l_d_insn (insn)
1682 || is_frint_s_insn (insn)
1683 || is_frint_d_insn (insn))
1684 return true;
1685 else
1686 return false;
1689 static inline bool
1690 is_float_mov_insn (uint32_t insn)
1692 if (is_fmov_s_insn (insn)
1693 || is_fmov_d_insn (insn)
1694 || is_fsel_insn (insn)
1695 || is_movgr2fr_w_insn (insn)
1696 || is_movgr2fr_d_insn (insn)
1697 || is_movgr2frh_w_insn (insn)
1698 || is_movgr2fcsr_insn (insn)
1699 || is_movfr2cf_insn (insn)
1700 || is_movcf2fr_insn (insn)
1701 || is_movgr2cf_insn (insn))
1702 return true;
1703 else
1704 return false;
1707 static inline bool
1708 is_float_ld_insn (uint32_t insn)
1710 if (is_fld_s_insn (insn)
1711 || is_fld_d_insn (insn)
1712 || is_fldx_s_insn (insn)
1713 || is_fldx_d_insn (insn))
1714 return true;
1715 else
1716 return false;
1719 static inline bool
1720 is_mov2cf_insn (uint32_t insn)
1722 if (is_movfr2cf_insn (insn)
1723 || is_movgr2cf_insn (insn)
1724 || is_float_comparison_insn (insn))
1725 return true;
1726 else
1727 return false;
1730 static inline bool
1731 is_float_insn (uint32_t insn)
1733 if (is_float_arithmetic_operation_insn (insn)
1734 || is_float_conversion_insn (insn)
1735 || is_float_mov_insn (insn)
1736 || is_float_ld_insn (insn))
1737 return true;
1738 else
1739 return false;
1742 static inline bool
1743 is_store_insn (uint32_t insn)
1745 if (is_st_b_insn (insn)
1746 || is_st_h_insn (insn)
1747 || is_st_w_insn (insn)
1748 || is_st_d_insn (insn)
1749 || is_stx_b_insn (insn)
1750 || is_stx_h_insn (insn)
1751 || is_stx_w_insn (insn)
1752 || is_stx_d_insn (insn)
1753 || is_stptr_w_insn (insn)
1754 || is_stptr_d_insn (insn)
1755 || is_sc_w_insn (insn)
1756 || is_sc_d_insn (insn)
1757 || is_sc_q_insn (insn)
1758 || is_screl_w_insn (insn)
1759 || is_screl_d_insn (insn)
1760 || is_fst_s_insn (insn)
1761 || is_fst_d_insn (insn)
1762 || is_fstx_s_insn (insn)
1763 || is_fstx_d_insn (insn)
1764 || is_vst_insn (insn)
1765 || is_xvst_insn (insn))
1766 return true;
1767 else
1768 return false;
1771 static inline bool
1772 is_atomic_access_insn (uint32_t insn)
1774 if (is_amswap_w_insn (insn)
1775 || is_amswap_d_insn (insn)
1776 || is_amswap_db_w_insn (insn)
1777 || is_amswap_db_d_insn (insn)
1778 || is_amadd_w_insn (insn)
1779 || is_amadd_d_insn (insn)
1780 || is_amadd_db_w_insn (insn)
1781 || is_amadd_db_d_insn (insn)
1782 || is_amand_w_insn (insn)
1783 || is_amand_d_insn (insn)
1784 || is_amand_db_w_insn (insn)
1785 || is_amand_db_d_insn (insn)
1786 || is_amor_w_insn (insn)
1787 || is_amor_d_insn (insn)
1788 || is_amor_db_w_insn (insn)
1789 || is_amor_db_d_insn (insn)
1790 || is_amxor_w_insn (insn)
1791 || is_amxor_d_insn (insn)
1792 || is_amxor_db_w_insn (insn)
1793 || is_amxor_db_d_insn (insn)
1794 || is_ammax_w_insn (insn)
1795 || is_ammax_d_insn (insn)
1796 || is_ammax_db_w_insn (insn)
1797 || is_ammax_db_d_insn (insn)
1798 || is_ammin_w_insn (insn)
1799 || is_ammin_d_insn (insn)
1800 || is_ammin_db_w_insn (insn)
1801 || is_ammin_db_d_insn (insn)
1802 || is_ammax_wu_insn (insn)
1803 || is_ammax_du_insn (insn)
1804 || is_ammax_db_du_insn (insn)
1805 || is_ammin_db_wu_insn (insn)
1806 || is_ammin_wu_insn (insn)
1807 || is_ammin_du_insn (insn)
1808 || is_ammin_db_wu_insn (insn)
1809 || is_ammin_db_du_insn (insn)
1810 || is_amswap_b_insn (insn)
1811 || is_amswap_h_insn (insn)
1812 || is_amswap_db_b_insn (insn)
1813 || is_amswap_db_h_insn (insn)
1814 || is_amadd_b_insn (insn)
1815 || is_amadd_h_insn (insn)
1816 || is_amadd_db_b_insn (insn)
1817 || is_amadd_db_h_insn (insn)
1818 || is_amcas_b_insn (insn)
1819 || is_amcas_h_insn (insn)
1820 || is_amcas_w_insn (insn)
1821 || is_amcas_d_insn (insn)
1822 || is_amcas_db_b_insn (insn)
1823 || is_amcas_db_h_insn (insn)
1824 || is_amcas_db_w_insn (insn)
1825 || is_amcas_db_d_insn (insn))
1826 return true;
1827 else
1828 return false;
1831 static inline bool
1832 is_basic_am_w_d_insn (uint32_t insn)
1834 if (is_amswap_w_insn (insn)
1835 || is_amswap_d_insn (insn)
1836 || is_amswap_db_w_insn (insn)
1837 || is_amswap_db_d_insn (insn)
1838 || is_amadd_w_insn (insn)
1839 || is_amadd_d_insn (insn)
1840 || is_amadd_db_w_insn (insn)
1841 || is_amadd_db_d_insn (insn)
1842 || is_amand_w_insn (insn)
1843 || is_amand_d_insn (insn)
1844 || is_amand_db_w_insn (insn)
1845 || is_amand_db_d_insn (insn)
1846 || is_amor_w_insn (insn)
1847 || is_amor_d_insn (insn)
1848 || is_amor_db_w_insn (insn)
1849 || is_amor_db_d_insn (insn)
1850 || is_amxor_w_insn (insn)
1851 || is_amxor_d_insn (insn)
1852 || is_amxor_db_w_insn (insn)
1853 || is_amxor_db_d_insn (insn)
1854 || is_ammax_w_insn (insn)
1855 || is_ammax_d_insn (insn)
1856 || is_ammax_db_w_insn (insn)
1857 || is_ammax_db_d_insn (insn)
1858 || is_ammin_w_insn (insn)
1859 || is_ammin_d_insn (insn)
1860 || is_ammin_db_w_insn (insn)
1861 || is_ammin_db_d_insn (insn)
1862 || is_ammax_wu_insn (insn)
1863 || is_ammax_du_insn (insn)
1864 || is_ammax_db_du_insn (insn)
1865 || is_ammin_db_wu_insn (insn)
1866 || is_ammin_wu_insn (insn)
1867 || is_ammin_du_insn (insn)
1868 || is_ammin_db_wu_insn (insn)
1869 || is_ammin_db_du_insn (insn))
1870 return true;
1871 else
1872 return false;
1875 static inline bool
1876 is_am_b_h_insn (uint32_t insn)
1878 if (is_amswap_b_insn (insn)
1879 || is_amswap_h_insn (insn)
1880 || is_amswap_db_b_insn (insn)
1881 || is_amswap_db_h_insn (insn)
1882 || is_amadd_b_insn (insn)
1883 || is_amadd_h_insn (insn)
1884 || is_amadd_db_b_insn (insn)
1885 || is_amadd_db_h_insn (insn))
1886 return true;
1887 else
1888 return false;
1891 static inline bool
1892 is_amswap_insn (uint32_t insn)
1894 if (is_amswap_w_insn (insn)
1895 || is_amswap_d_insn (insn)
1896 || is_amswap_db_w_insn (insn)
1897 || is_amswap_db_d_insn (insn)
1898 || is_amswap_b_insn (insn)
1899 || is_amswap_h_insn (insn)
1900 || is_amswap_db_b_insn (insn)
1901 || is_amswap_db_h_insn (insn))
1902 return true;
1903 else
1904 return false;
1907 static inline bool
1908 is_amcas_insn (uint32_t insn)
1910 if (is_amcas_b_insn (insn)
1911 || is_amcas_h_insn (insn)
1912 || is_amcas_w_insn (insn)
1913 || is_amcas_d_insn (insn)
1914 || is_amcas_db_b_insn (insn)
1915 || is_amcas_db_h_insn (insn)
1916 || is_amcas_db_w_insn (insn)
1917 || is_amcas_db_d_insn (insn))
1918 return true;
1919 else
1920 return false;
1923 static inline bool
1924 is_bound_check_load_insn (uint32_t insn)
1926 if (is_ldgt_b_insn (insn)
1927 || is_ldgt_h_insn (insn)
1928 || is_ldgt_w_insn (insn)
1929 || is_ldgt_d_insn (insn)
1930 || is_ldle_b_insn (insn)
1931 || is_ldle_h_insn (insn)
1932 || is_ldle_w_insn (insn)
1933 || is_ldle_d_insn (insn)
1934 || is_fldgt_s_insn (insn)
1935 || is_fldle_s_insn (insn)
1936 || is_fldgt_d_insn (insn)
1937 || is_fldle_d_insn (insn))
1938 return true;
1939 else
1940 return false;
1943 static inline bool
1944 is_bound_check_store_insn (uint32_t insn)
1946 if (is_stgt_b_insn (insn)
1947 || is_stgt_h_insn (insn)
1948 || is_stgt_w_insn (insn)
1949 || is_stgt_d_insn (insn)
1950 || is_stle_b_insn (insn)
1951 || is_stle_h_insn (insn)
1952 || is_stle_w_insn (insn)
1953 || is_stle_d_insn (insn)
1954 || is_fstgt_s_insn (insn)
1955 || is_fstle_s_insn (insn)
1956 || is_fstgt_d_insn (insn)
1957 || is_fstle_d_insn (insn))
1958 return true;
1959 else
1960 return false;
1963 static inline bool
1964 is_ldgt_insn (uint32_t insn)
1966 if (is_ldgt_b_insn (insn)
1967 || is_ldgt_h_insn (insn)
1968 || is_ldgt_w_insn (insn)
1969 || is_ldgt_d_insn (insn))
1970 return true;
1971 else
1972 return false;
1975 static inline bool
1976 is_ldle_insn (uint32_t insn)
1978 if (is_ldle_b_insn (insn)
1979 || is_ldle_h_insn (insn)
1980 || is_ldle_w_insn (insn)
1981 || is_ldle_d_insn (insn))
1982 return true;
1983 else
1984 return false;
1987 static inline bool
1988 is_fldgt_insn (uint32_t insn)
1990 if (is_fldgt_s_insn (insn)
1991 || is_fldgt_d_insn (insn))
1992 return true;
1993 else
1994 return false;
1997 static inline bool
1998 is_fldle_insn (uint32_t insn)
2000 if (is_fldle_s_insn (insn)
2001 || is_fldle_d_insn (insn))
2002 return true;
2003 else
2004 return false;
2007 static inline bool
2008 is_stgt_insn (uint32_t insn)
2010 if (is_stgt_b_insn (insn)
2011 || is_stgt_h_insn (insn)
2012 || is_stgt_w_insn (insn)
2013 || is_stgt_d_insn (insn))
2014 return true;
2015 else
2016 return false;
2019 static inline bool
2020 is_stle_insn (uint32_t insn)
2022 if (is_stle_b_insn (insn)
2023 || is_stle_h_insn (insn)
2024 || is_stle_w_insn (insn)
2025 || is_stle_d_insn (insn))
2026 return true;
2027 else
2028 return false;
2031 static inline bool
2032 is_fstgt_insn (uint32_t insn)
2034 if (is_fstgt_s_insn (insn)
2035 || is_fstgt_d_insn (insn))
2036 return true;
2037 else
2038 return false;
2041 static inline bool
2042 is_fstle_insn (uint32_t insn)
2044 if (is_fstle_s_insn (insn)
2045 || is_fstle_d_insn (insn))
2046 return true;
2047 else
2048 return false;
2051 static inline bool
2052 is_branch_insn (uint32_t insn)
2054 if (is_beqz_insn (insn)
2055 || is_bnez_insn (insn)
2056 || is_jirl_insn (insn)
2057 || is_b_insn (insn)
2058 || is_bl_insn (insn)
2059 || is_beq_insn (insn)
2060 || is_bne_insn (insn)
2061 || is_blt_insn (insn)
2062 || is_bge_insn (insn)
2063 || is_bltu_insn (insn)
2064 || is_bgeu_insn (insn)
2065 || is_bceqz_insn (insn)
2066 || is_bcnez_insn (insn))
2067 return true;
2068 else
2069 return false;
2072 static inline bool
2073 is_special_insn (uint32_t insn)
2075 if (is_cacop_insn (insn)
2076 || is_tlbsrch_insn (insn)
2077 || is_tlbrd_insn (insn)
2078 || is_tlbwr_insn (insn)
2079 || is_tlbfill_insn (insn)
2080 || is_tlbclr_insn (insn)
2081 || is_tlbflush_insn (insn)
2082 || is_invtlb_insn (insn)
2083 || is_ldpte_insn (insn)
2084 || is_ertn_insn (insn)
2085 || is_idle_insn (insn)
2086 || is_dbcl_insn (insn)
2087 || is_preld_insn (insn)
2088 || is_preldx_insn (insn)
2089 || is_dbar_insn (insn)
2090 || is_ibar_insn (insn))
2091 return true;
2092 else
2093 return false;
2096 #endif /* ARCH_LOONGARCH_INSN_H */