1 /* SPDX-License-Identifier: MIT */
3 * LoongArch instruction formats, opcodes, and encoders for TCG use.
5 * This file is auto-generated by genqemutcgdefs from
6 * https://github.com/loongson-community/loongarch-opcodes,
7 * from commit 961f0c60f5b63e574d785995600c71ad5413fdc4.
12 OPC_CLZ_W = 0x00001400,
13 OPC_CTZ_W = 0x00001c00,
14 OPC_CLZ_D = 0x00002400,
15 OPC_CTZ_D = 0x00002c00,
16 OPC_REVB_2H = 0x00003000,
17 OPC_REVB_2W = 0x00003800,
18 OPC_REVB_D = 0x00003c00,
19 OPC_SEXT_H = 0x00005800,
20 OPC_SEXT_B = 0x00005c00,
21 OPC_ADD_W = 0x00100000,
22 OPC_ADD_D = 0x00108000,
23 OPC_SUB_W = 0x00110000,
24 OPC_SUB_D = 0x00118000,
26 OPC_SLTU = 0x00128000,
27 OPC_MASKEQZ = 0x00130000,
28 OPC_MASKNEZ = 0x00138000,
34 OPC_ANDN = 0x00168000,
35 OPC_SLL_W = 0x00170000,
36 OPC_SRL_W = 0x00178000,
37 OPC_SRA_W = 0x00180000,
38 OPC_SLL_D = 0x00188000,
39 OPC_SRL_D = 0x00190000,
40 OPC_SRA_D = 0x00198000,
41 OPC_ROTR_W = 0x001b0000,
42 OPC_ROTR_D = 0x001b8000,
43 OPC_MUL_W = 0x001c0000,
44 OPC_MULH_W = 0x001c8000,
45 OPC_MULH_WU = 0x001d0000,
46 OPC_MUL_D = 0x001d8000,
47 OPC_MULH_D = 0x001e0000,
48 OPC_MULH_DU = 0x001e8000,
49 OPC_DIV_W = 0x00200000,
50 OPC_MOD_W = 0x00208000,
51 OPC_DIV_WU = 0x00210000,
52 OPC_MOD_WU = 0x00218000,
53 OPC_DIV_D = 0x00220000,
54 OPC_MOD_D = 0x00228000,
55 OPC_DIV_DU = 0x00230000,
56 OPC_MOD_DU = 0x00238000,
57 OPC_SLLI_W = 0x00408000,
58 OPC_SLLI_D = 0x00410000,
59 OPC_SRLI_W = 0x00448000,
60 OPC_SRLI_D = 0x00450000,
61 OPC_SRAI_W = 0x00488000,
62 OPC_SRAI_D = 0x00490000,
63 OPC_ROTRI_W = 0x004c8000,
64 OPC_ROTRI_D = 0x004d0000,
65 OPC_BSTRINS_W = 0x00600000,
66 OPC_BSTRPICK_W = 0x00608000,
67 OPC_BSTRINS_D = 0x00800000,
68 OPC_BSTRPICK_D = 0x00c00000,
69 OPC_SLTI = 0x02000000,
70 OPC_SLTUI = 0x02400000,
71 OPC_ADDI_W = 0x02800000,
72 OPC_ADDI_D = 0x02c00000,
73 OPC_CU52I_D = 0x03000000,
74 OPC_ANDI = 0x03400000,
76 OPC_XORI = 0x03c00000,
77 OPC_LU12I_W = 0x14000000,
78 OPC_CU32I_D = 0x16000000,
79 OPC_PCADDU2I = 0x18000000,
80 OPC_PCALAU12I = 0x1a000000,
81 OPC_PCADDU12I = 0x1c000000,
82 OPC_PCADDU18I = 0x1e000000,
83 OPC_LD_B = 0x28000000,
84 OPC_LD_H = 0x28400000,
85 OPC_LD_W = 0x28800000,
86 OPC_LD_D = 0x28c00000,
87 OPC_ST_B = 0x29000000,
88 OPC_ST_H = 0x29400000,
89 OPC_ST_W = 0x29800000,
90 OPC_ST_D = 0x29c00000,
91 OPC_LD_BU = 0x2a000000,
92 OPC_LD_HU = 0x2a400000,
93 OPC_LD_WU = 0x2a800000,
94 OPC_LDX_B = 0x38000000,
95 OPC_LDX_H = 0x38040000,
96 OPC_LDX_W = 0x38080000,
97 OPC_LDX_D = 0x380c0000,
98 OPC_STX_B = 0x38100000,
99 OPC_STX_H = 0x38140000,
100 OPC_STX_W = 0x38180000,
101 OPC_STX_D = 0x381c0000,
102 OPC_LDX_BU = 0x38200000,
103 OPC_LDX_HU = 0x38240000,
104 OPC_LDX_WU = 0x38280000,
105 OPC_DBAR = 0x38720000,
106 OPC_JIRL = 0x4c000000,
109 OPC_BEQ = 0x58000000,
110 OPC_BNE = 0x5c000000,
111 OPC_BGT = 0x60000000,
112 OPC_BLE = 0x64000000,
113 OPC_BGTU = 0x68000000,
114 OPC_BLEU = 0x6c000000,
117 static int32_t __attribute__((unused))
118 encode_d_slot(LoongArchInsn opc, uint32_t d)
123 static int32_t __attribute__((unused))
124 encode_dj_slots(LoongArchInsn opc, uint32_t d, uint32_t j)
126 return opc | d | j << 5;
129 static int32_t __attribute__((unused))
130 encode_djk_slots(LoongArchInsn opc, uint32_t d, uint32_t j, uint32_t k)
132 return opc | d | j << 5 | k << 10;
135 static int32_t __attribute__((unused))
136 encode_djkm_slots(LoongArchInsn opc, uint32_t d, uint32_t j, uint32_t k,
139 return opc | d | j << 5 | k << 10 | m << 16;
142 static int32_t __attribute__((unused))
143 encode_dk_slots(LoongArchInsn opc, uint32_t d, uint32_t k)
145 return opc | d | k << 10;
148 static int32_t __attribute__((unused))
149 encode_dj_insn(LoongArchInsn opc, TCGReg d, TCGReg j)
151 tcg_debug_assert(d >= 0 && d <= 0x1f);
152 tcg_debug_assert(j >= 0 && j <= 0x1f);
153 return encode_dj_slots(opc, d, j);
156 static int32_t __attribute__((unused))
157 encode_djk_insn(LoongArchInsn opc, TCGReg d, TCGReg j, TCGReg k)
159 tcg_debug_assert(d >= 0 && d <= 0x1f);
160 tcg_debug_assert(j >= 0 && j <= 0x1f);
161 tcg_debug_assert(k >= 0 && k <= 0x1f);
162 return encode_djk_slots(opc, d, j, k);
165 static int32_t __attribute__((unused))
166 encode_djsk12_insn(LoongArchInsn opc, TCGReg d, TCGReg j, int32_t sk12)
168 tcg_debug_assert(d >= 0 && d <= 0x1f);
169 tcg_debug_assert(j >= 0 && j <= 0x1f);
170 tcg_debug_assert(sk12 >= -0x800 && sk12 <= 0x7ff);
171 return encode_djk_slots(opc, d, j, sk12 & 0xfff);
174 static int32_t __attribute__((unused))
175 encode_djsk16_insn(LoongArchInsn opc, TCGReg d, TCGReg j, int32_t sk16)
177 tcg_debug_assert(d >= 0 && d <= 0x1f);
178 tcg_debug_assert(j >= 0 && j <= 0x1f);
179 tcg_debug_assert(sk16 >= -0x8000 && sk16 <= 0x7fff);
180 return encode_djk_slots(opc, d, j, sk16 & 0xffff);
183 static int32_t __attribute__((unused))
184 encode_djuk12_insn(LoongArchInsn opc, TCGReg d, TCGReg j, uint32_t uk12)
186 tcg_debug_assert(d >= 0 && d <= 0x1f);
187 tcg_debug_assert(j >= 0 && j <= 0x1f);
188 tcg_debug_assert(uk12 <= 0xfff);
189 return encode_djk_slots(opc, d, j, uk12);
192 static int32_t __attribute__((unused))
193 encode_djuk5_insn(LoongArchInsn opc, TCGReg d, TCGReg j, uint32_t uk5)
195 tcg_debug_assert(d >= 0 && d <= 0x1f);
196 tcg_debug_assert(j >= 0 && j <= 0x1f);
197 tcg_debug_assert(uk5 <= 0x1f);
198 return encode_djk_slots(opc, d, j, uk5);
201 static int32_t __attribute__((unused))
202 encode_djuk5um5_insn(LoongArchInsn opc, TCGReg d, TCGReg j, uint32_t uk5,
205 tcg_debug_assert(d >= 0 && d <= 0x1f);
206 tcg_debug_assert(j >= 0 && j <= 0x1f);
207 tcg_debug_assert(uk5 <= 0x1f);
208 tcg_debug_assert(um5 <= 0x1f);
209 return encode_djkm_slots(opc, d, j, uk5, um5);
212 static int32_t __attribute__((unused))
213 encode_djuk6_insn(LoongArchInsn opc, TCGReg d, TCGReg j, uint32_t uk6)
215 tcg_debug_assert(d >= 0 && d <= 0x1f);
216 tcg_debug_assert(j >= 0 && j <= 0x1f);
217 tcg_debug_assert(uk6 <= 0x3f);
218 return encode_djk_slots(opc, d, j, uk6);
221 static int32_t __attribute__((unused))
222 encode_djuk6um6_insn(LoongArchInsn opc, TCGReg d, TCGReg j, uint32_t uk6,
225 tcg_debug_assert(d >= 0 && d <= 0x1f);
226 tcg_debug_assert(j >= 0 && j <= 0x1f);
227 tcg_debug_assert(uk6 <= 0x3f);
228 tcg_debug_assert(um6 <= 0x3f);
229 return encode_djkm_slots(opc, d, j, uk6, um6);
232 static int32_t __attribute__((unused))
233 encode_dsj20_insn(LoongArchInsn opc, TCGReg d, int32_t sj20)
235 tcg_debug_assert(d >= 0 && d <= 0x1f);
236 tcg_debug_assert(sj20 >= -0x80000 && sj20 <= 0x7ffff);
237 return encode_dj_slots(opc, d, sj20 & 0xfffff);
240 static int32_t __attribute__((unused))
241 encode_sd10k16_insn(LoongArchInsn opc, int32_t sd10k16)
243 tcg_debug_assert(sd10k16 >= -0x2000000 && sd10k16 <= 0x1ffffff);
244 return encode_dk_slots(opc, (sd10k16 >> 16) & 0x3ff, sd10k16 & 0xffff);
247 static int32_t __attribute__((unused))
248 encode_ud15_insn(LoongArchInsn opc, uint32_t ud15)
250 tcg_debug_assert(ud15 <= 0x7fff);
251 return encode_d_slot(opc, ud15);
254 /* Emits the `clz.w d, j` instruction. */
255 static void __attribute__((unused))
256 tcg_out_opc_clz_w(TCGContext *s, TCGReg d, TCGReg j)
258 tcg_out32(s, encode_dj_insn(OPC_CLZ_W, d, j));
261 /* Emits the `ctz.w d, j` instruction. */
262 static void __attribute__((unused))
263 tcg_out_opc_ctz_w(TCGContext *s, TCGReg d, TCGReg j)
265 tcg_out32(s, encode_dj_insn(OPC_CTZ_W, d, j));
268 /* Emits the `clz.d d, j` instruction. */
269 static void __attribute__((unused))
270 tcg_out_opc_clz_d(TCGContext *s, TCGReg d, TCGReg j)
272 tcg_out32(s, encode_dj_insn(OPC_CLZ_D, d, j));
275 /* Emits the `ctz.d d, j` instruction. */
276 static void __attribute__((unused))
277 tcg_out_opc_ctz_d(TCGContext *s, TCGReg d, TCGReg j)
279 tcg_out32(s, encode_dj_insn(OPC_CTZ_D, d, j));
282 /* Emits the `revb.2h d, j` instruction. */
283 static void __attribute__((unused))
284 tcg_out_opc_revb_2h(TCGContext *s, TCGReg d, TCGReg j)
286 tcg_out32(s, encode_dj_insn(OPC_REVB_2H, d, j));
289 /* Emits the `revb.2w d, j` instruction. */
290 static void __attribute__((unused))
291 tcg_out_opc_revb_2w(TCGContext *s, TCGReg d, TCGReg j)
293 tcg_out32(s, encode_dj_insn(OPC_REVB_2W, d, j));
296 /* Emits the `revb.d d, j` instruction. */
297 static void __attribute__((unused))
298 tcg_out_opc_revb_d(TCGContext *s, TCGReg d, TCGReg j)
300 tcg_out32(s, encode_dj_insn(OPC_REVB_D, d, j));
303 /* Emits the `sext.h d, j` instruction. */
304 static void __attribute__((unused))
305 tcg_out_opc_sext_h(TCGContext *s, TCGReg d, TCGReg j)
307 tcg_out32(s, encode_dj_insn(OPC_SEXT_H, d, j));
310 /* Emits the `sext.b d, j` instruction. */
311 static void __attribute__((unused))
312 tcg_out_opc_sext_b(TCGContext *s, TCGReg d, TCGReg j)
314 tcg_out32(s, encode_dj_insn(OPC_SEXT_B, d, j));
317 /* Emits the `add.w d, j, k` instruction. */
318 static void __attribute__((unused))
319 tcg_out_opc_add_w(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
321 tcg_out32(s, encode_djk_insn(OPC_ADD_W, d, j, k));
324 /* Emits the `add.d d, j, k` instruction. */
325 static void __attribute__((unused))
326 tcg_out_opc_add_d(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
328 tcg_out32(s, encode_djk_insn(OPC_ADD_D, d, j, k));
331 /* Emits the `sub.w d, j, k` instruction. */
332 static void __attribute__((unused))
333 tcg_out_opc_sub_w(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
335 tcg_out32(s, encode_djk_insn(OPC_SUB_W, d, j, k));
338 /* Emits the `sub.d d, j, k` instruction. */
339 static void __attribute__((unused))
340 tcg_out_opc_sub_d(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
342 tcg_out32(s, encode_djk_insn(OPC_SUB_D, d, j, k));
345 /* Emits the `slt d, j, k` instruction. */
346 static void __attribute__((unused))
347 tcg_out_opc_slt(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
349 tcg_out32(s, encode_djk_insn(OPC_SLT, d, j, k));
352 /* Emits the `sltu d, j, k` instruction. */
353 static void __attribute__((unused))
354 tcg_out_opc_sltu(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
356 tcg_out32(s, encode_djk_insn(OPC_SLTU, d, j, k));
359 /* Emits the `maskeqz d, j, k` instruction. */
360 static void __attribute__((unused))
361 tcg_out_opc_maskeqz(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
363 tcg_out32(s, encode_djk_insn(OPC_MASKEQZ, d, j, k));
366 /* Emits the `masknez d, j, k` instruction. */
367 static void __attribute__((unused))
368 tcg_out_opc_masknez(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
370 tcg_out32(s, encode_djk_insn(OPC_MASKNEZ, d, j, k));
373 /* Emits the `nor d, j, k` instruction. */
374 static void __attribute__((unused))
375 tcg_out_opc_nor(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
377 tcg_out32(s, encode_djk_insn(OPC_NOR, d, j, k));
380 /* Emits the `and d, j, k` instruction. */
381 static void __attribute__((unused))
382 tcg_out_opc_and(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
384 tcg_out32(s, encode_djk_insn(OPC_AND, d, j, k));
387 /* Emits the `or d, j, k` instruction. */
388 static void __attribute__((unused))
389 tcg_out_opc_or(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
391 tcg_out32(s, encode_djk_insn(OPC_OR, d, j, k));
394 /* Emits the `xor d, j, k` instruction. */
395 static void __attribute__((unused))
396 tcg_out_opc_xor(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
398 tcg_out32(s, encode_djk_insn(OPC_XOR, d, j, k));
401 /* Emits the `orn d, j, k` instruction. */
402 static void __attribute__((unused))
403 tcg_out_opc_orn(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
405 tcg_out32(s, encode_djk_insn(OPC_ORN, d, j, k));
408 /* Emits the `andn d, j, k` instruction. */
409 static void __attribute__((unused))
410 tcg_out_opc_andn(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
412 tcg_out32(s, encode_djk_insn(OPC_ANDN, d, j, k));
415 /* Emits the `sll.w d, j, k` instruction. */
416 static void __attribute__((unused))
417 tcg_out_opc_sll_w(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
419 tcg_out32(s, encode_djk_insn(OPC_SLL_W, d, j, k));
422 /* Emits the `srl.w d, j, k` instruction. */
423 static void __attribute__((unused))
424 tcg_out_opc_srl_w(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
426 tcg_out32(s, encode_djk_insn(OPC_SRL_W, d, j, k));
429 /* Emits the `sra.w d, j, k` instruction. */
430 static void __attribute__((unused))
431 tcg_out_opc_sra_w(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
433 tcg_out32(s, encode_djk_insn(OPC_SRA_W, d, j, k));
436 /* Emits the `sll.d d, j, k` instruction. */
437 static void __attribute__((unused))
438 tcg_out_opc_sll_d(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
440 tcg_out32(s, encode_djk_insn(OPC_SLL_D, d, j, k));
443 /* Emits the `srl.d d, j, k` instruction. */
444 static void __attribute__((unused))
445 tcg_out_opc_srl_d(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
447 tcg_out32(s, encode_djk_insn(OPC_SRL_D, d, j, k));
450 /* Emits the `sra.d d, j, k` instruction. */
451 static void __attribute__((unused))
452 tcg_out_opc_sra_d(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
454 tcg_out32(s, encode_djk_insn(OPC_SRA_D, d, j, k));
457 /* Emits the `rotr.w d, j, k` instruction. */
458 static void __attribute__((unused))
459 tcg_out_opc_rotr_w(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
461 tcg_out32(s, encode_djk_insn(OPC_ROTR_W, d, j, k));
464 /* Emits the `rotr.d d, j, k` instruction. */
465 static void __attribute__((unused))
466 tcg_out_opc_rotr_d(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
468 tcg_out32(s, encode_djk_insn(OPC_ROTR_D, d, j, k));
471 /* Emits the `mul.w d, j, k` instruction. */
472 static void __attribute__((unused))
473 tcg_out_opc_mul_w(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
475 tcg_out32(s, encode_djk_insn(OPC_MUL_W, d, j, k));
478 /* Emits the `mulh.w d, j, k` instruction. */
479 static void __attribute__((unused))
480 tcg_out_opc_mulh_w(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
482 tcg_out32(s, encode_djk_insn(OPC_MULH_W, d, j, k));
485 /* Emits the `mulh.wu d, j, k` instruction. */
486 static void __attribute__((unused))
487 tcg_out_opc_mulh_wu(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
489 tcg_out32(s, encode_djk_insn(OPC_MULH_WU, d, j, k));
492 /* Emits the `mul.d d, j, k` instruction. */
493 static void __attribute__((unused))
494 tcg_out_opc_mul_d(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
496 tcg_out32(s, encode_djk_insn(OPC_MUL_D, d, j, k));
499 /* Emits the `mulh.d d, j, k` instruction. */
500 static void __attribute__((unused))
501 tcg_out_opc_mulh_d(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
503 tcg_out32(s, encode_djk_insn(OPC_MULH_D, d, j, k));
506 /* Emits the `mulh.du d, j, k` instruction. */
507 static void __attribute__((unused))
508 tcg_out_opc_mulh_du(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
510 tcg_out32(s, encode_djk_insn(OPC_MULH_DU, d, j, k));
513 /* Emits the `div.w d, j, k` instruction. */
514 static void __attribute__((unused))
515 tcg_out_opc_div_w(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
517 tcg_out32(s, encode_djk_insn(OPC_DIV_W, d, j, k));
520 /* Emits the `mod.w d, j, k` instruction. */
521 static void __attribute__((unused))
522 tcg_out_opc_mod_w(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
524 tcg_out32(s, encode_djk_insn(OPC_MOD_W, d, j, k));
527 /* Emits the `div.wu d, j, k` instruction. */
528 static void __attribute__((unused))
529 tcg_out_opc_div_wu(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
531 tcg_out32(s, encode_djk_insn(OPC_DIV_WU, d, j, k));
534 /* Emits the `mod.wu d, j, k` instruction. */
535 static void __attribute__((unused))
536 tcg_out_opc_mod_wu(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
538 tcg_out32(s, encode_djk_insn(OPC_MOD_WU, d, j, k));
541 /* Emits the `div.d d, j, k` instruction. */
542 static void __attribute__((unused))
543 tcg_out_opc_div_d(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
545 tcg_out32(s, encode_djk_insn(OPC_DIV_D, d, j, k));
548 /* Emits the `mod.d d, j, k` instruction. */
549 static void __attribute__((unused))
550 tcg_out_opc_mod_d(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
552 tcg_out32(s, encode_djk_insn(OPC_MOD_D, d, j, k));
555 /* Emits the `div.du d, j, k` instruction. */
556 static void __attribute__((unused))
557 tcg_out_opc_div_du(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
559 tcg_out32(s, encode_djk_insn(OPC_DIV_DU, d, j, k));
562 /* Emits the `mod.du d, j, k` instruction. */
563 static void __attribute__((unused))
564 tcg_out_opc_mod_du(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
566 tcg_out32(s, encode_djk_insn(OPC_MOD_DU, d, j, k));
569 /* Emits the `slli.w d, j, uk5` instruction. */
570 static void __attribute__((unused))
571 tcg_out_opc_slli_w(TCGContext *s, TCGReg d, TCGReg j, uint32_t uk5)
573 tcg_out32(s, encode_djuk5_insn(OPC_SLLI_W, d, j, uk5));
576 /* Emits the `slli.d d, j, uk6` instruction. */
577 static void __attribute__((unused))
578 tcg_out_opc_slli_d(TCGContext *s, TCGReg d, TCGReg j, uint32_t uk6)
580 tcg_out32(s, encode_djuk6_insn(OPC_SLLI_D, d, j, uk6));
583 /* Emits the `srli.w d, j, uk5` instruction. */
584 static void __attribute__((unused))
585 tcg_out_opc_srli_w(TCGContext *s, TCGReg d, TCGReg j, uint32_t uk5)
587 tcg_out32(s, encode_djuk5_insn(OPC_SRLI_W, d, j, uk5));
590 /* Emits the `srli.d d, j, uk6` instruction. */
591 static void __attribute__((unused))
592 tcg_out_opc_srli_d(TCGContext *s, TCGReg d, TCGReg j, uint32_t uk6)
594 tcg_out32(s, encode_djuk6_insn(OPC_SRLI_D, d, j, uk6));
597 /* Emits the `srai.w d, j, uk5` instruction. */
598 static void __attribute__((unused))
599 tcg_out_opc_srai_w(TCGContext *s, TCGReg d, TCGReg j, uint32_t uk5)
601 tcg_out32(s, encode_djuk5_insn(OPC_SRAI_W, d, j, uk5));
604 /* Emits the `srai.d d, j, uk6` instruction. */
605 static void __attribute__((unused))
606 tcg_out_opc_srai_d(TCGContext *s, TCGReg d, TCGReg j, uint32_t uk6)
608 tcg_out32(s, encode_djuk6_insn(OPC_SRAI_D, d, j, uk6));
611 /* Emits the `rotri.w d, j, uk5` instruction. */
612 static void __attribute__((unused))
613 tcg_out_opc_rotri_w(TCGContext *s, TCGReg d, TCGReg j, uint32_t uk5)
615 tcg_out32(s, encode_djuk5_insn(OPC_ROTRI_W, d, j, uk5));
618 /* Emits the `rotri.d d, j, uk6` instruction. */
619 static void __attribute__((unused))
620 tcg_out_opc_rotri_d(TCGContext *s, TCGReg d, TCGReg j, uint32_t uk6)
622 tcg_out32(s, encode_djuk6_insn(OPC_ROTRI_D, d, j, uk6));
625 /* Emits the `bstrins.w d, j, uk5, um5` instruction. */
626 static void __attribute__((unused))
627 tcg_out_opc_bstrins_w(TCGContext *s, TCGReg d, TCGReg j, uint32_t uk5,
630 tcg_out32(s, encode_djuk5um5_insn(OPC_BSTRINS_W, d, j, uk5, um5));
633 /* Emits the `bstrpick.w d, j, uk5, um5` instruction. */
634 static void __attribute__((unused))
635 tcg_out_opc_bstrpick_w(TCGContext *s, TCGReg d, TCGReg j, uint32_t uk5,
638 tcg_out32(s, encode_djuk5um5_insn(OPC_BSTRPICK_W, d, j, uk5, um5));
641 /* Emits the `bstrins.d d, j, uk6, um6` instruction. */
642 static void __attribute__((unused))
643 tcg_out_opc_bstrins_d(TCGContext *s, TCGReg d, TCGReg j, uint32_t uk6,
646 tcg_out32(s, encode_djuk6um6_insn(OPC_BSTRINS_D, d, j, uk6, um6));
649 /* Emits the `bstrpick.d d, j, uk6, um6` instruction. */
650 static void __attribute__((unused))
651 tcg_out_opc_bstrpick_d(TCGContext *s, TCGReg d, TCGReg j, uint32_t uk6,
654 tcg_out32(s, encode_djuk6um6_insn(OPC_BSTRPICK_D, d, j, uk6, um6));
657 /* Emits the `slti d, j, sk12` instruction. */
658 static void __attribute__((unused))
659 tcg_out_opc_slti(TCGContext *s, TCGReg d, TCGReg j, int32_t sk12)
661 tcg_out32(s, encode_djsk12_insn(OPC_SLTI, d, j, sk12));
664 /* Emits the `sltui d, j, sk12` instruction. */
665 static void __attribute__((unused))
666 tcg_out_opc_sltui(TCGContext *s, TCGReg d, TCGReg j, int32_t sk12)
668 tcg_out32(s, encode_djsk12_insn(OPC_SLTUI, d, j, sk12));
671 /* Emits the `addi.w d, j, sk12` instruction. */
672 static void __attribute__((unused))
673 tcg_out_opc_addi_w(TCGContext *s, TCGReg d, TCGReg j, int32_t sk12)
675 tcg_out32(s, encode_djsk12_insn(OPC_ADDI_W, d, j, sk12));
678 /* Emits the `addi.d d, j, sk12` instruction. */
679 static void __attribute__((unused))
680 tcg_out_opc_addi_d(TCGContext *s, TCGReg d, TCGReg j, int32_t sk12)
682 tcg_out32(s, encode_djsk12_insn(OPC_ADDI_D, d, j, sk12));
685 /* Emits the `cu52i.d d, j, sk12` instruction. */
686 static void __attribute__((unused))
687 tcg_out_opc_cu52i_d(TCGContext *s, TCGReg d, TCGReg j, int32_t sk12)
689 tcg_out32(s, encode_djsk12_insn(OPC_CU52I_D, d, j, sk12));
692 /* Emits the `andi d, j, uk12` instruction. */
693 static void __attribute__((unused))
694 tcg_out_opc_andi(TCGContext *s, TCGReg d, TCGReg j, uint32_t uk12)
696 tcg_out32(s, encode_djuk12_insn(OPC_ANDI, d, j, uk12));
699 /* Emits the `ori d, j, uk12` instruction. */
700 static void __attribute__((unused))
701 tcg_out_opc_ori(TCGContext *s, TCGReg d, TCGReg j, uint32_t uk12)
703 tcg_out32(s, encode_djuk12_insn(OPC_ORI, d, j, uk12));
706 /* Emits the `xori d, j, uk12` instruction. */
707 static void __attribute__((unused))
708 tcg_out_opc_xori(TCGContext *s, TCGReg d, TCGReg j, uint32_t uk12)
710 tcg_out32(s, encode_djuk12_insn(OPC_XORI, d, j, uk12));
713 /* Emits the `lu12i.w d, sj20` instruction. */
714 static void __attribute__((unused))
715 tcg_out_opc_lu12i_w(TCGContext *s, TCGReg d, int32_t sj20)
717 tcg_out32(s, encode_dsj20_insn(OPC_LU12I_W, d, sj20));
720 /* Emits the `cu32i.d d, sj20` instruction. */
721 static void __attribute__((unused))
722 tcg_out_opc_cu32i_d(TCGContext *s, TCGReg d, int32_t sj20)
724 tcg_out32(s, encode_dsj20_insn(OPC_CU32I_D, d, sj20));
727 /* Emits the `pcaddu2i d, sj20` instruction. */
728 static void __attribute__((unused))
729 tcg_out_opc_pcaddu2i(TCGContext *s, TCGReg d, int32_t sj20)
731 tcg_out32(s, encode_dsj20_insn(OPC_PCADDU2I, d, sj20));
734 /* Emits the `pcalau12i d, sj20` instruction. */
735 static void __attribute__((unused))
736 tcg_out_opc_pcalau12i(TCGContext *s, TCGReg d, int32_t sj20)
738 tcg_out32(s, encode_dsj20_insn(OPC_PCALAU12I, d, sj20));
741 /* Emits the `pcaddu12i d, sj20` instruction. */
742 static void __attribute__((unused))
743 tcg_out_opc_pcaddu12i(TCGContext *s, TCGReg d, int32_t sj20)
745 tcg_out32(s, encode_dsj20_insn(OPC_PCADDU12I, d, sj20));
748 /* Emits the `pcaddu18i d, sj20` instruction. */
749 static void __attribute__((unused))
750 tcg_out_opc_pcaddu18i(TCGContext *s, TCGReg d, int32_t sj20)
752 tcg_out32(s, encode_dsj20_insn(OPC_PCADDU18I, d, sj20));
755 /* Emits the `ld.b d, j, sk12` instruction. */
756 static void __attribute__((unused))
757 tcg_out_opc_ld_b(TCGContext *s, TCGReg d, TCGReg j, int32_t sk12)
759 tcg_out32(s, encode_djsk12_insn(OPC_LD_B, d, j, sk12));
762 /* Emits the `ld.h d, j, sk12` instruction. */
763 static void __attribute__((unused))
764 tcg_out_opc_ld_h(TCGContext *s, TCGReg d, TCGReg j, int32_t sk12)
766 tcg_out32(s, encode_djsk12_insn(OPC_LD_H, d, j, sk12));
769 /* Emits the `ld.w d, j, sk12` instruction. */
770 static void __attribute__((unused))
771 tcg_out_opc_ld_w(TCGContext *s, TCGReg d, TCGReg j, int32_t sk12)
773 tcg_out32(s, encode_djsk12_insn(OPC_LD_W, d, j, sk12));
776 /* Emits the `ld.d d, j, sk12` instruction. */
777 static void __attribute__((unused))
778 tcg_out_opc_ld_d(TCGContext *s, TCGReg d, TCGReg j, int32_t sk12)
780 tcg_out32(s, encode_djsk12_insn(OPC_LD_D, d, j, sk12));
783 /* Emits the `st.b d, j, sk12` instruction. */
784 static void __attribute__((unused))
785 tcg_out_opc_st_b(TCGContext *s, TCGReg d, TCGReg j, int32_t sk12)
787 tcg_out32(s, encode_djsk12_insn(OPC_ST_B, d, j, sk12));
790 /* Emits the `st.h d, j, sk12` instruction. */
791 static void __attribute__((unused))
792 tcg_out_opc_st_h(TCGContext *s, TCGReg d, TCGReg j, int32_t sk12)
794 tcg_out32(s, encode_djsk12_insn(OPC_ST_H, d, j, sk12));
797 /* Emits the `st.w d, j, sk12` instruction. */
798 static void __attribute__((unused))
799 tcg_out_opc_st_w(TCGContext *s, TCGReg d, TCGReg j, int32_t sk12)
801 tcg_out32(s, encode_djsk12_insn(OPC_ST_W, d, j, sk12));
804 /* Emits the `st.d d, j, sk12` instruction. */
805 static void __attribute__((unused))
806 tcg_out_opc_st_d(TCGContext *s, TCGReg d, TCGReg j, int32_t sk12)
808 tcg_out32(s, encode_djsk12_insn(OPC_ST_D, d, j, sk12));
811 /* Emits the `ld.bu d, j, sk12` instruction. */
812 static void __attribute__((unused))
813 tcg_out_opc_ld_bu(TCGContext *s, TCGReg d, TCGReg j, int32_t sk12)
815 tcg_out32(s, encode_djsk12_insn(OPC_LD_BU, d, j, sk12));
818 /* Emits the `ld.hu d, j, sk12` instruction. */
819 static void __attribute__((unused))
820 tcg_out_opc_ld_hu(TCGContext *s, TCGReg d, TCGReg j, int32_t sk12)
822 tcg_out32(s, encode_djsk12_insn(OPC_LD_HU, d, j, sk12));
825 /* Emits the `ld.wu d, j, sk12` instruction. */
826 static void __attribute__((unused))
827 tcg_out_opc_ld_wu(TCGContext *s, TCGReg d, TCGReg j, int32_t sk12)
829 tcg_out32(s, encode_djsk12_insn(OPC_LD_WU, d, j, sk12));
832 /* Emits the `ldx.b d, j, k` instruction. */
833 static void __attribute__((unused))
834 tcg_out_opc_ldx_b(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
836 tcg_out32(s, encode_djk_insn(OPC_LDX_B, d, j, k));
839 /* Emits the `ldx.h d, j, k` instruction. */
840 static void __attribute__((unused))
841 tcg_out_opc_ldx_h(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
843 tcg_out32(s, encode_djk_insn(OPC_LDX_H, d, j, k));
846 /* Emits the `ldx.w d, j, k` instruction. */
847 static void __attribute__((unused))
848 tcg_out_opc_ldx_w(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
850 tcg_out32(s, encode_djk_insn(OPC_LDX_W, d, j, k));
853 /* Emits the `ldx.d d, j, k` instruction. */
854 static void __attribute__((unused))
855 tcg_out_opc_ldx_d(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
857 tcg_out32(s, encode_djk_insn(OPC_LDX_D, d, j, k));
860 /* Emits the `stx.b d, j, k` instruction. */
861 static void __attribute__((unused))
862 tcg_out_opc_stx_b(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
864 tcg_out32(s, encode_djk_insn(OPC_STX_B, d, j, k));
867 /* Emits the `stx.h d, j, k` instruction. */
868 static void __attribute__((unused))
869 tcg_out_opc_stx_h(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
871 tcg_out32(s, encode_djk_insn(OPC_STX_H, d, j, k));
874 /* Emits the `stx.w d, j, k` instruction. */
875 static void __attribute__((unused))
876 tcg_out_opc_stx_w(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
878 tcg_out32(s, encode_djk_insn(OPC_STX_W, d, j, k));
881 /* Emits the `stx.d d, j, k` instruction. */
882 static void __attribute__((unused))
883 tcg_out_opc_stx_d(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
885 tcg_out32(s, encode_djk_insn(OPC_STX_D, d, j, k));
888 /* Emits the `ldx.bu d, j, k` instruction. */
889 static void __attribute__((unused))
890 tcg_out_opc_ldx_bu(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
892 tcg_out32(s, encode_djk_insn(OPC_LDX_BU, d, j, k));
895 /* Emits the `ldx.hu d, j, k` instruction. */
896 static void __attribute__((unused))
897 tcg_out_opc_ldx_hu(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
899 tcg_out32(s, encode_djk_insn(OPC_LDX_HU, d, j, k));
902 /* Emits the `ldx.wu d, j, k` instruction. */
903 static void __attribute__((unused))
904 tcg_out_opc_ldx_wu(TCGContext *s, TCGReg d, TCGReg j, TCGReg k)
906 tcg_out32(s, encode_djk_insn(OPC_LDX_WU, d, j, k));
909 /* Emits the `dbar ud15` instruction. */
910 static void __attribute__((unused))
911 tcg_out_opc_dbar(TCGContext *s, uint32_t ud15)
913 tcg_out32(s, encode_ud15_insn(OPC_DBAR, ud15));
916 /* Emits the `jirl d, j, sk16` instruction. */
917 static void __attribute__((unused))
918 tcg_out_opc_jirl(TCGContext *s, TCGReg d, TCGReg j, int32_t sk16)
920 tcg_out32(s, encode_djsk16_insn(OPC_JIRL, d, j, sk16));
923 /* Emits the `b sd10k16` instruction. */
924 static void __attribute__((unused))
925 tcg_out_opc_b(TCGContext *s, int32_t sd10k16)
927 tcg_out32(s, encode_sd10k16_insn(OPC_B, sd10k16));
930 /* Emits the `bl sd10k16` instruction. */
931 static void __attribute__((unused))
932 tcg_out_opc_bl(TCGContext *s, int32_t sd10k16)
934 tcg_out32(s, encode_sd10k16_insn(OPC_BL, sd10k16));
937 /* Emits the `beq d, j, sk16` instruction. */
938 static void __attribute__((unused))
939 tcg_out_opc_beq(TCGContext *s, TCGReg d, TCGReg j, int32_t sk16)
941 tcg_out32(s, encode_djsk16_insn(OPC_BEQ, d, j, sk16));
944 /* Emits the `bne d, j, sk16` instruction. */
945 static void __attribute__((unused))
946 tcg_out_opc_bne(TCGContext *s, TCGReg d, TCGReg j, int32_t sk16)
948 tcg_out32(s, encode_djsk16_insn(OPC_BNE, d, j, sk16));
951 /* Emits the `bgt d, j, sk16` instruction. */
952 static void __attribute__((unused))
953 tcg_out_opc_bgt(TCGContext *s, TCGReg d, TCGReg j, int32_t sk16)
955 tcg_out32(s, encode_djsk16_insn(OPC_BGT, d, j, sk16));
958 /* Emits the `ble d, j, sk16` instruction. */
959 static void __attribute__((unused))
960 tcg_out_opc_ble(TCGContext *s, TCGReg d, TCGReg j, int32_t sk16)
962 tcg_out32(s, encode_djsk16_insn(OPC_BLE, d, j, sk16));
965 /* Emits the `bgtu d, j, sk16` instruction. */
966 static void __attribute__((unused))
967 tcg_out_opc_bgtu(TCGContext *s, TCGReg d, TCGReg j, int32_t sk16)
969 tcg_out32(s, encode_djsk16_insn(OPC_BGTU, d, j, sk16));
972 /* Emits the `bleu d, j, sk16` instruction. */
973 static void __attribute__((unused))
974 tcg_out_opc_bleu(TCGContext *s, TCGReg d, TCGReg j, int32_t sk16)
976 tcg_out32(s, encode_djsk16_insn(OPC_BLEU, d, j, sk16));
979 /* End of generated code. */