2 * Tiny Code Interpreter for QEMU
4 * Copyright (c) 2009, 2011, 2016 Stefan Weil
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #include "qemu/osdep.h"
21 #include "qemu-common.h"
22 #include "tcg/tcg.h" /* MAX_OPC_PARAM_IARGS */
23 #include "exec/cpu_ldst.h"
24 #include "tcg/tcg-op.h"
25 #include "tcg/tcg-ldst.h"
26 #include "qemu/compiler.h"
31 * Enable TCI assertions only when debugging TCG (and without NDEBUG defined).
32 * Without assertions, the interpreter runs much faster.
34 #if defined(CONFIG_DEBUG_TCG)
35 # define tci_assert(cond) assert(cond)
37 # define tci_assert(cond) ((void)(cond))
40 __thread
uintptr_t tci_tb_ptr
;
42 static void tci_write_reg64(tcg_target_ulong
*regs
, uint32_t high_index
,
43 uint32_t low_index
, uint64_t value
)
45 regs
[low_index
] = (uint32_t)value
;
46 regs
[high_index
] = value
>> 32;
49 /* Create a 64 bit value from two 32 bit values. */
50 static uint64_t tci_uint64(uint32_t high
, uint32_t low
)
52 return ((uint64_t)high
<< 32) + low
;
56 * Load sets of arguments all at once. The naming convention is:
57 * tci_args_<arguments>
58 * where arguments is a sequence of
60 * b = immediate (bit position)
61 * c = condition (TCGCond)
62 * i = immediate (uint32_t)
63 * I = immediate (tcg_target_ulong)
64 * l = label or pointer
65 * m = immediate (MemOpIdx)
66 * n = immediate (call return length)
68 * s = signed ldst offset
71 static void tci_args_l(uint32_t insn
, const void *tb_ptr
, void **l0
)
73 int diff
= sextract32(insn
, 12, 20);
74 *l0
= diff
? (void *)tb_ptr
+ diff
: NULL
;
77 static void tci_args_r(uint32_t insn
, TCGReg
*r0
)
79 *r0
= extract32(insn
, 8, 4);
82 static void tci_args_nl(uint32_t insn
, const void *tb_ptr
,
83 uint8_t *n0
, void **l1
)
85 *n0
= extract32(insn
, 8, 4);
86 *l1
= sextract32(insn
, 12, 20) + (void *)tb_ptr
;
89 static void tci_args_rl(uint32_t insn
, const void *tb_ptr
,
90 TCGReg
*r0
, void **l1
)
92 *r0
= extract32(insn
, 8, 4);
93 *l1
= sextract32(insn
, 12, 20) + (void *)tb_ptr
;
96 static void tci_args_rr(uint32_t insn
, TCGReg
*r0
, TCGReg
*r1
)
98 *r0
= extract32(insn
, 8, 4);
99 *r1
= extract32(insn
, 12, 4);
102 static void tci_args_ri(uint32_t insn
, TCGReg
*r0
, tcg_target_ulong
*i1
)
104 *r0
= extract32(insn
, 8, 4);
105 *i1
= sextract32(insn
, 12, 20);
108 static void tci_args_rrm(uint32_t insn
, TCGReg
*r0
,
109 TCGReg
*r1
, MemOpIdx
*m2
)
111 *r0
= extract32(insn
, 8, 4);
112 *r1
= extract32(insn
, 12, 4);
113 *m2
= extract32(insn
, 20, 12);
116 static void tci_args_rrr(uint32_t insn
, TCGReg
*r0
, TCGReg
*r1
, TCGReg
*r2
)
118 *r0
= extract32(insn
, 8, 4);
119 *r1
= extract32(insn
, 12, 4);
120 *r2
= extract32(insn
, 16, 4);
123 static void tci_args_rrs(uint32_t insn
, TCGReg
*r0
, TCGReg
*r1
, int32_t *i2
)
125 *r0
= extract32(insn
, 8, 4);
126 *r1
= extract32(insn
, 12, 4);
127 *i2
= sextract32(insn
, 16, 16);
130 static void tci_args_rrbb(uint32_t insn
, TCGReg
*r0
, TCGReg
*r1
,
131 uint8_t *i2
, uint8_t *i3
)
133 *r0
= extract32(insn
, 8, 4);
134 *r1
= extract32(insn
, 12, 4);
135 *i2
= extract32(insn
, 16, 6);
136 *i3
= extract32(insn
, 22, 6);
139 static void tci_args_rrrc(uint32_t insn
,
140 TCGReg
*r0
, TCGReg
*r1
, TCGReg
*r2
, TCGCond
*c3
)
142 *r0
= extract32(insn
, 8, 4);
143 *r1
= extract32(insn
, 12, 4);
144 *r2
= extract32(insn
, 16, 4);
145 *c3
= extract32(insn
, 20, 4);
148 static void tci_args_rrrm(uint32_t insn
,
149 TCGReg
*r0
, TCGReg
*r1
, TCGReg
*r2
, MemOpIdx
*m3
)
151 *r0
= extract32(insn
, 8, 4);
152 *r1
= extract32(insn
, 12, 4);
153 *r2
= extract32(insn
, 16, 4);
154 *m3
= extract32(insn
, 20, 12);
157 static void tci_args_rrrbb(uint32_t insn
, TCGReg
*r0
, TCGReg
*r1
,
158 TCGReg
*r2
, uint8_t *i3
, uint8_t *i4
)
160 *r0
= extract32(insn
, 8, 4);
161 *r1
= extract32(insn
, 12, 4);
162 *r2
= extract32(insn
, 16, 4);
163 *i3
= extract32(insn
, 20, 6);
164 *i4
= extract32(insn
, 26, 6);
167 static void tci_args_rrrrr(uint32_t insn
, TCGReg
*r0
, TCGReg
*r1
,
168 TCGReg
*r2
, TCGReg
*r3
, TCGReg
*r4
)
170 *r0
= extract32(insn
, 8, 4);
171 *r1
= extract32(insn
, 12, 4);
172 *r2
= extract32(insn
, 16, 4);
173 *r3
= extract32(insn
, 20, 4);
174 *r4
= extract32(insn
, 24, 4);
177 static void tci_args_rrrr(uint32_t insn
,
178 TCGReg
*r0
, TCGReg
*r1
, TCGReg
*r2
, TCGReg
*r3
)
180 *r0
= extract32(insn
, 8, 4);
181 *r1
= extract32(insn
, 12, 4);
182 *r2
= extract32(insn
, 16, 4);
183 *r3
= extract32(insn
, 20, 4);
186 static void tci_args_rrrrrc(uint32_t insn
, TCGReg
*r0
, TCGReg
*r1
,
187 TCGReg
*r2
, TCGReg
*r3
, TCGReg
*r4
, TCGCond
*c5
)
189 *r0
= extract32(insn
, 8, 4);
190 *r1
= extract32(insn
, 12, 4);
191 *r2
= extract32(insn
, 16, 4);
192 *r3
= extract32(insn
, 20, 4);
193 *r4
= extract32(insn
, 24, 4);
194 *c5
= extract32(insn
, 28, 4);
197 static void tci_args_rrrrrr(uint32_t insn
, TCGReg
*r0
, TCGReg
*r1
,
198 TCGReg
*r2
, TCGReg
*r3
, TCGReg
*r4
, TCGReg
*r5
)
200 *r0
= extract32(insn
, 8, 4);
201 *r1
= extract32(insn
, 12, 4);
202 *r2
= extract32(insn
, 16, 4);
203 *r3
= extract32(insn
, 20, 4);
204 *r4
= extract32(insn
, 24, 4);
205 *r5
= extract32(insn
, 28, 4);
208 static bool tci_compare32(uint32_t u0
, uint32_t u1
, TCGCond condition
)
245 g_assert_not_reached();
250 static bool tci_compare64(uint64_t u0
, uint64_t u1
, TCGCond condition
)
287 g_assert_not_reached();
292 static uint64_t tci_qemu_ld(CPUArchState
*env
, target_ulong taddr
,
293 MemOpIdx oi
, const void *tb_ptr
)
295 MemOp mop
= get_memop(oi
) & (MO_BSWAP
| MO_SSIZE
);
296 uintptr_t ra
= (uintptr_t)tb_ptr
;
298 #ifdef CONFIG_SOFTMMU
301 return helper_ret_ldub_mmu(env
, taddr
, oi
, ra
);
303 return helper_ret_ldsb_mmu(env
, taddr
, oi
, ra
);
305 return helper_le_lduw_mmu(env
, taddr
, oi
, ra
);
307 return helper_le_ldsw_mmu(env
, taddr
, oi
, ra
);
309 return helper_le_ldul_mmu(env
, taddr
, oi
, ra
);
311 return helper_le_ldsl_mmu(env
, taddr
, oi
, ra
);
313 return helper_le_ldq_mmu(env
, taddr
, oi
, ra
);
315 return helper_be_lduw_mmu(env
, taddr
, oi
, ra
);
317 return helper_be_ldsw_mmu(env
, taddr
, oi
, ra
);
319 return helper_be_ldul_mmu(env
, taddr
, oi
, ra
);
321 return helper_be_ldsl_mmu(env
, taddr
, oi
, ra
);
323 return helper_be_ldq_mmu(env
, taddr
, oi
, ra
);
325 g_assert_not_reached();
328 void *haddr
= g2h(env_cpu(env
), taddr
);
331 set_helper_retaddr(ra
);
340 ret
= lduw_le_p(haddr
);
343 ret
= ldsw_le_p(haddr
);
346 ret
= (uint32_t)ldl_le_p(haddr
);
349 ret
= (int32_t)ldl_le_p(haddr
);
352 ret
= ldq_le_p(haddr
);
355 ret
= lduw_be_p(haddr
);
358 ret
= ldsw_be_p(haddr
);
361 ret
= (uint32_t)ldl_be_p(haddr
);
364 ret
= (int32_t)ldl_be_p(haddr
);
367 ret
= ldq_be_p(haddr
);
370 g_assert_not_reached();
372 clear_helper_retaddr();
377 static void tci_qemu_st(CPUArchState
*env
, target_ulong taddr
, uint64_t val
,
378 MemOpIdx oi
, const void *tb_ptr
)
380 MemOp mop
= get_memop(oi
) & (MO_BSWAP
| MO_SSIZE
);
381 uintptr_t ra
= (uintptr_t)tb_ptr
;
383 #ifdef CONFIG_SOFTMMU
386 helper_ret_stb_mmu(env
, taddr
, val
, oi
, ra
);
389 helper_le_stw_mmu(env
, taddr
, val
, oi
, ra
);
392 helper_le_stl_mmu(env
, taddr
, val
, oi
, ra
);
395 helper_le_stq_mmu(env
, taddr
, val
, oi
, ra
);
398 helper_be_stw_mmu(env
, taddr
, val
, oi
, ra
);
401 helper_be_stl_mmu(env
, taddr
, val
, oi
, ra
);
404 helper_be_stq_mmu(env
, taddr
, val
, oi
, ra
);
407 g_assert_not_reached();
410 void *haddr
= g2h(env_cpu(env
), taddr
);
412 set_helper_retaddr(ra
);
418 stw_le_p(haddr
, val
);
421 stl_le_p(haddr
, val
);
424 stq_le_p(haddr
, val
);
427 stw_be_p(haddr
, val
);
430 stl_be_p(haddr
, val
);
433 stq_be_p(haddr
, val
);
436 g_assert_not_reached();
438 clear_helper_retaddr();
442 #if TCG_TARGET_REG_BITS == 64
443 # define CASE_32_64(x) \
444 case glue(glue(INDEX_op_, x), _i64): \
445 case glue(glue(INDEX_op_, x), _i32):
446 # define CASE_64(x) \
447 case glue(glue(INDEX_op_, x), _i64):
449 # define CASE_32_64(x) \
450 case glue(glue(INDEX_op_, x), _i32):
454 /* Interpret pseudo code in tb. */
456 * Disable CFI checks.
457 * One possible operation in the pseudo code is a call to binary code.
458 * Therefore, disable CFI checks in the interpreter function
460 uintptr_t QEMU_DISABLE_CFI
tcg_qemu_tb_exec(CPUArchState
*env
,
461 const void *v_tb_ptr
)
463 const uint32_t *tb_ptr
= v_tb_ptr
;
464 tcg_target_ulong regs
[TCG_TARGET_NB_REGS
];
465 uint64_t stack
[(TCG_STATIC_CALL_ARGS_SIZE
+ TCG_STATIC_FRAME_SIZE
)
467 void *call_slots
[TCG_STATIC_CALL_ARGS_SIZE
/ sizeof(uint64_t)];
469 regs
[TCG_AREG0
] = (tcg_target_ulong
)env
;
470 regs
[TCG_REG_CALL_STACK
] = (uintptr_t)stack
;
471 /* Other call_slots entries initialized at first use (see below). */
472 call_slots
[0] = NULL
;
478 TCGReg r0
, r1
, r2
, r3
, r4
, r5
;
491 opc
= extract32(insn
, 0, 8);
496 * Set up the ffi_avalue array once, delayed until now
497 * because many TB's do not make any calls. In tcg_gen_callN,
498 * we arranged for every real argument to be "left-aligned"
499 * in each 64-bit slot.
501 if (unlikely(call_slots
[0] == NULL
)) {
502 for (int i
= 0; i
< ARRAY_SIZE(call_slots
); ++i
) {
503 call_slots
[i
] = &stack
[i
];
507 tci_args_nl(insn
, tb_ptr
, &len
, &ptr
);
509 /* Helper functions may need to access the "return address" */
510 tci_tb_ptr
= (uintptr_t)tb_ptr
;
514 ffi_call(pptr
[1], pptr
[0], stack
, call_slots
);
517 /* Any result winds up "left-aligned" in the stack[0] slot. */
521 case 1: /* uint32_t */
523 * Note that libffi has an odd special case in that it will
524 * always widen an integral result to ffi_arg.
526 if (sizeof(ffi_arg
) == 4) {
527 regs
[TCG_REG_R0
] = *(uint32_t *)stack
;
531 case 2: /* uint64_t */
532 if (TCG_TARGET_REG_BITS
== 32) {
533 tci_write_reg64(regs
, TCG_REG_R1
, TCG_REG_R0
, stack
[0]);
535 regs
[TCG_REG_R0
] = stack
[0];
539 g_assert_not_reached();
544 tci_args_l(insn
, tb_ptr
, &ptr
);
547 case INDEX_op_setcond_i32
:
548 tci_args_rrrc(insn
, &r0
, &r1
, &r2
, &condition
);
549 regs
[r0
] = tci_compare32(regs
[r1
], regs
[r2
], condition
);
551 case INDEX_op_movcond_i32
:
552 tci_args_rrrrrc(insn
, &r0
, &r1
, &r2
, &r3
, &r4
, &condition
);
553 tmp32
= tci_compare32(regs
[r1
], regs
[r2
], condition
);
554 regs
[r0
] = regs
[tmp32
? r3
: r4
];
556 #if TCG_TARGET_REG_BITS == 32
557 case INDEX_op_setcond2_i32
:
558 tci_args_rrrrrc(insn
, &r0
, &r1
, &r2
, &r3
, &r4
, &condition
);
559 T1
= tci_uint64(regs
[r2
], regs
[r1
]);
560 T2
= tci_uint64(regs
[r4
], regs
[r3
]);
561 regs
[r0
] = tci_compare64(T1
, T2
, condition
);
563 #elif TCG_TARGET_REG_BITS == 64
564 case INDEX_op_setcond_i64
:
565 tci_args_rrrc(insn
, &r0
, &r1
, &r2
, &condition
);
566 regs
[r0
] = tci_compare64(regs
[r1
], regs
[r2
], condition
);
568 case INDEX_op_movcond_i64
:
569 tci_args_rrrrrc(insn
, &r0
, &r1
, &r2
, &r3
, &r4
, &condition
);
570 tmp32
= tci_compare64(regs
[r1
], regs
[r2
], condition
);
571 regs
[r0
] = regs
[tmp32
? r3
: r4
];
575 tci_args_rr(insn
, &r0
, &r1
);
578 case INDEX_op_tci_movi
:
579 tci_args_ri(insn
, &r0
, &t1
);
582 case INDEX_op_tci_movl
:
583 tci_args_rl(insn
, tb_ptr
, &r0
, &ptr
);
584 regs
[r0
] = *(tcg_target_ulong
*)ptr
;
587 /* Load/store operations (32 bit). */
590 tci_args_rrs(insn
, &r0
, &r1
, &ofs
);
591 ptr
= (void *)(regs
[r1
] + ofs
);
592 regs
[r0
] = *(uint8_t *)ptr
;
595 tci_args_rrs(insn
, &r0
, &r1
, &ofs
);
596 ptr
= (void *)(regs
[r1
] + ofs
);
597 regs
[r0
] = *(int8_t *)ptr
;
600 tci_args_rrs(insn
, &r0
, &r1
, &ofs
);
601 ptr
= (void *)(regs
[r1
] + ofs
);
602 regs
[r0
] = *(uint16_t *)ptr
;
605 tci_args_rrs(insn
, &r0
, &r1
, &ofs
);
606 ptr
= (void *)(regs
[r1
] + ofs
);
607 regs
[r0
] = *(int16_t *)ptr
;
609 case INDEX_op_ld_i32
:
611 tci_args_rrs(insn
, &r0
, &r1
, &ofs
);
612 ptr
= (void *)(regs
[r1
] + ofs
);
613 regs
[r0
] = *(uint32_t *)ptr
;
616 tci_args_rrs(insn
, &r0
, &r1
, &ofs
);
617 ptr
= (void *)(regs
[r1
] + ofs
);
618 *(uint8_t *)ptr
= regs
[r0
];
621 tci_args_rrs(insn
, &r0
, &r1
, &ofs
);
622 ptr
= (void *)(regs
[r1
] + ofs
);
623 *(uint16_t *)ptr
= regs
[r0
];
625 case INDEX_op_st_i32
:
627 tci_args_rrs(insn
, &r0
, &r1
, &ofs
);
628 ptr
= (void *)(regs
[r1
] + ofs
);
629 *(uint32_t *)ptr
= regs
[r0
];
632 /* Arithmetic operations (mixed 32/64 bit). */
635 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
636 regs
[r0
] = regs
[r1
] + regs
[r2
];
639 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
640 regs
[r0
] = regs
[r1
] - regs
[r2
];
643 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
644 regs
[r0
] = regs
[r1
] * regs
[r2
];
647 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
648 regs
[r0
] = regs
[r1
] & regs
[r2
];
651 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
652 regs
[r0
] = regs
[r1
] | regs
[r2
];
655 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
656 regs
[r0
] = regs
[r1
] ^ regs
[r2
];
658 #if TCG_TARGET_HAS_andc_i32 || TCG_TARGET_HAS_andc_i64
660 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
661 regs
[r0
] = regs
[r1
] & ~regs
[r2
];
664 #if TCG_TARGET_HAS_orc_i32 || TCG_TARGET_HAS_orc_i64
666 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
667 regs
[r0
] = regs
[r1
] | ~regs
[r2
];
670 #if TCG_TARGET_HAS_eqv_i32 || TCG_TARGET_HAS_eqv_i64
672 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
673 regs
[r0
] = ~(regs
[r1
] ^ regs
[r2
]);
676 #if TCG_TARGET_HAS_nand_i32 || TCG_TARGET_HAS_nand_i64
678 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
679 regs
[r0
] = ~(regs
[r1
] & regs
[r2
]);
682 #if TCG_TARGET_HAS_nor_i32 || TCG_TARGET_HAS_nor_i64
684 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
685 regs
[r0
] = ~(regs
[r1
] | regs
[r2
]);
689 /* Arithmetic operations (32 bit). */
691 case INDEX_op_div_i32
:
692 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
693 regs
[r0
] = (int32_t)regs
[r1
] / (int32_t)regs
[r2
];
695 case INDEX_op_divu_i32
:
696 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
697 regs
[r0
] = (uint32_t)regs
[r1
] / (uint32_t)regs
[r2
];
699 case INDEX_op_rem_i32
:
700 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
701 regs
[r0
] = (int32_t)regs
[r1
] % (int32_t)regs
[r2
];
703 case INDEX_op_remu_i32
:
704 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
705 regs
[r0
] = (uint32_t)regs
[r1
] % (uint32_t)regs
[r2
];
707 #if TCG_TARGET_HAS_clz_i32
708 case INDEX_op_clz_i32
:
709 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
711 regs
[r0
] = tmp32
? clz32(tmp32
) : regs
[r2
];
714 #if TCG_TARGET_HAS_ctz_i32
715 case INDEX_op_ctz_i32
:
716 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
718 regs
[r0
] = tmp32
? ctz32(tmp32
) : regs
[r2
];
721 #if TCG_TARGET_HAS_ctpop_i32
722 case INDEX_op_ctpop_i32
:
723 tci_args_rr(insn
, &r0
, &r1
);
724 regs
[r0
] = ctpop32(regs
[r1
]);
728 /* Shift/rotate operations (32 bit). */
730 case INDEX_op_shl_i32
:
731 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
732 regs
[r0
] = (uint32_t)regs
[r1
] << (regs
[r2
] & 31);
734 case INDEX_op_shr_i32
:
735 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
736 regs
[r0
] = (uint32_t)regs
[r1
] >> (regs
[r2
] & 31);
738 case INDEX_op_sar_i32
:
739 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
740 regs
[r0
] = (int32_t)regs
[r1
] >> (regs
[r2
] & 31);
742 #if TCG_TARGET_HAS_rot_i32
743 case INDEX_op_rotl_i32
:
744 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
745 regs
[r0
] = rol32(regs
[r1
], regs
[r2
] & 31);
747 case INDEX_op_rotr_i32
:
748 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
749 regs
[r0
] = ror32(regs
[r1
], regs
[r2
] & 31);
752 #if TCG_TARGET_HAS_deposit_i32
753 case INDEX_op_deposit_i32
:
754 tci_args_rrrbb(insn
, &r0
, &r1
, &r2
, &pos
, &len
);
755 regs
[r0
] = deposit32(regs
[r1
], pos
, len
, regs
[r2
]);
758 #if TCG_TARGET_HAS_extract_i32
759 case INDEX_op_extract_i32
:
760 tci_args_rrbb(insn
, &r0
, &r1
, &pos
, &len
);
761 regs
[r0
] = extract32(regs
[r1
], pos
, len
);
764 #if TCG_TARGET_HAS_sextract_i32
765 case INDEX_op_sextract_i32
:
766 tci_args_rrbb(insn
, &r0
, &r1
, &pos
, &len
);
767 regs
[r0
] = sextract32(regs
[r1
], pos
, len
);
770 case INDEX_op_brcond_i32
:
771 tci_args_rl(insn
, tb_ptr
, &r0
, &ptr
);
772 if ((uint32_t)regs
[r0
]) {
776 #if TCG_TARGET_REG_BITS == 32 || TCG_TARGET_HAS_add2_i32
777 case INDEX_op_add2_i32
:
778 tci_args_rrrrrr(insn
, &r0
, &r1
, &r2
, &r3
, &r4
, &r5
);
779 T1
= tci_uint64(regs
[r3
], regs
[r2
]);
780 T2
= tci_uint64(regs
[r5
], regs
[r4
]);
781 tci_write_reg64(regs
, r1
, r0
, T1
+ T2
);
784 #if TCG_TARGET_REG_BITS == 32 || TCG_TARGET_HAS_sub2_i32
785 case INDEX_op_sub2_i32
:
786 tci_args_rrrrrr(insn
, &r0
, &r1
, &r2
, &r3
, &r4
, &r5
);
787 T1
= tci_uint64(regs
[r3
], regs
[r2
]);
788 T2
= tci_uint64(regs
[r5
], regs
[r4
]);
789 tci_write_reg64(regs
, r1
, r0
, T1
- T2
);
792 #if TCG_TARGET_HAS_mulu2_i32
793 case INDEX_op_mulu2_i32
:
794 tci_args_rrrr(insn
, &r0
, &r1
, &r2
, &r3
);
795 tmp64
= (uint64_t)(uint32_t)regs
[r2
] * (uint32_t)regs
[r3
];
796 tci_write_reg64(regs
, r1
, r0
, tmp64
);
799 #if TCG_TARGET_HAS_muls2_i32
800 case INDEX_op_muls2_i32
:
801 tci_args_rrrr(insn
, &r0
, &r1
, &r2
, &r3
);
802 tmp64
= (int64_t)(int32_t)regs
[r2
] * (int32_t)regs
[r3
];
803 tci_write_reg64(regs
, r1
, r0
, tmp64
);
806 #if TCG_TARGET_HAS_ext8s_i32 || TCG_TARGET_HAS_ext8s_i64
808 tci_args_rr(insn
, &r0
, &r1
);
809 regs
[r0
] = (int8_t)regs
[r1
];
812 #if TCG_TARGET_HAS_ext16s_i32 || TCG_TARGET_HAS_ext16s_i64 || \
813 TCG_TARGET_HAS_bswap16_i32 || TCG_TARGET_HAS_bswap16_i64
815 tci_args_rr(insn
, &r0
, &r1
);
816 regs
[r0
] = (int16_t)regs
[r1
];
819 #if TCG_TARGET_HAS_ext8u_i32 || TCG_TARGET_HAS_ext8u_i64
821 tci_args_rr(insn
, &r0
, &r1
);
822 regs
[r0
] = (uint8_t)regs
[r1
];
825 #if TCG_TARGET_HAS_ext16u_i32 || TCG_TARGET_HAS_ext16u_i64
827 tci_args_rr(insn
, &r0
, &r1
);
828 regs
[r0
] = (uint16_t)regs
[r1
];
831 #if TCG_TARGET_HAS_bswap16_i32 || TCG_TARGET_HAS_bswap16_i64
833 tci_args_rr(insn
, &r0
, &r1
);
834 regs
[r0
] = bswap16(regs
[r1
]);
837 #if TCG_TARGET_HAS_bswap32_i32 || TCG_TARGET_HAS_bswap32_i64
839 tci_args_rr(insn
, &r0
, &r1
);
840 regs
[r0
] = bswap32(regs
[r1
]);
843 #if TCG_TARGET_HAS_not_i32 || TCG_TARGET_HAS_not_i64
845 tci_args_rr(insn
, &r0
, &r1
);
846 regs
[r0
] = ~regs
[r1
];
849 #if TCG_TARGET_HAS_neg_i32 || TCG_TARGET_HAS_neg_i64
851 tci_args_rr(insn
, &r0
, &r1
);
852 regs
[r0
] = -regs
[r1
];
855 #if TCG_TARGET_REG_BITS == 64
856 /* Load/store operations (64 bit). */
858 case INDEX_op_ld32s_i64
:
859 tci_args_rrs(insn
, &r0
, &r1
, &ofs
);
860 ptr
= (void *)(regs
[r1
] + ofs
);
861 regs
[r0
] = *(int32_t *)ptr
;
863 case INDEX_op_ld_i64
:
864 tci_args_rrs(insn
, &r0
, &r1
, &ofs
);
865 ptr
= (void *)(regs
[r1
] + ofs
);
866 regs
[r0
] = *(uint64_t *)ptr
;
868 case INDEX_op_st_i64
:
869 tci_args_rrs(insn
, &r0
, &r1
, &ofs
);
870 ptr
= (void *)(regs
[r1
] + ofs
);
871 *(uint64_t *)ptr
= regs
[r0
];
874 /* Arithmetic operations (64 bit). */
876 case INDEX_op_div_i64
:
877 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
878 regs
[r0
] = (int64_t)regs
[r1
] / (int64_t)regs
[r2
];
880 case INDEX_op_divu_i64
:
881 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
882 regs
[r0
] = (uint64_t)regs
[r1
] / (uint64_t)regs
[r2
];
884 case INDEX_op_rem_i64
:
885 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
886 regs
[r0
] = (int64_t)regs
[r1
] % (int64_t)regs
[r2
];
888 case INDEX_op_remu_i64
:
889 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
890 regs
[r0
] = (uint64_t)regs
[r1
] % (uint64_t)regs
[r2
];
892 #if TCG_TARGET_HAS_clz_i64
893 case INDEX_op_clz_i64
:
894 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
895 regs
[r0
] = regs
[r1
] ? clz64(regs
[r1
]) : regs
[r2
];
898 #if TCG_TARGET_HAS_ctz_i64
899 case INDEX_op_ctz_i64
:
900 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
901 regs
[r0
] = regs
[r1
] ? ctz64(regs
[r1
]) : regs
[r2
];
904 #if TCG_TARGET_HAS_ctpop_i64
905 case INDEX_op_ctpop_i64
:
906 tci_args_rr(insn
, &r0
, &r1
);
907 regs
[r0
] = ctpop64(regs
[r1
]);
910 #if TCG_TARGET_HAS_mulu2_i64
911 case INDEX_op_mulu2_i64
:
912 tci_args_rrrr(insn
, &r0
, &r1
, &r2
, &r3
);
913 mulu64(®s
[r0
], ®s
[r1
], regs
[r2
], regs
[r3
]);
916 #if TCG_TARGET_HAS_muls2_i64
917 case INDEX_op_muls2_i64
:
918 tci_args_rrrr(insn
, &r0
, &r1
, &r2
, &r3
);
919 muls64(®s
[r0
], ®s
[r1
], regs
[r2
], regs
[r3
]);
922 #if TCG_TARGET_HAS_add2_i64
923 case INDEX_op_add2_i64
:
924 tci_args_rrrrrr(insn
, &r0
, &r1
, &r2
, &r3
, &r4
, &r5
);
925 T1
= regs
[r2
] + regs
[r4
];
926 T2
= regs
[r3
] + regs
[r5
] + (T1
< regs
[r2
]);
931 #if TCG_TARGET_HAS_add2_i64
932 case INDEX_op_sub2_i64
:
933 tci_args_rrrrrr(insn
, &r0
, &r1
, &r2
, &r3
, &r4
, &r5
);
934 T1
= regs
[r2
] - regs
[r4
];
935 T2
= regs
[r3
] - regs
[r5
] - (regs
[r2
] < regs
[r4
]);
941 /* Shift/rotate operations (64 bit). */
943 case INDEX_op_shl_i64
:
944 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
945 regs
[r0
] = regs
[r1
] << (regs
[r2
] & 63);
947 case INDEX_op_shr_i64
:
948 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
949 regs
[r0
] = regs
[r1
] >> (regs
[r2
] & 63);
951 case INDEX_op_sar_i64
:
952 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
953 regs
[r0
] = (int64_t)regs
[r1
] >> (regs
[r2
] & 63);
955 #if TCG_TARGET_HAS_rot_i64
956 case INDEX_op_rotl_i64
:
957 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
958 regs
[r0
] = rol64(regs
[r1
], regs
[r2
] & 63);
960 case INDEX_op_rotr_i64
:
961 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
962 regs
[r0
] = ror64(regs
[r1
], regs
[r2
] & 63);
965 #if TCG_TARGET_HAS_deposit_i64
966 case INDEX_op_deposit_i64
:
967 tci_args_rrrbb(insn
, &r0
, &r1
, &r2
, &pos
, &len
);
968 regs
[r0
] = deposit64(regs
[r1
], pos
, len
, regs
[r2
]);
971 #if TCG_TARGET_HAS_extract_i64
972 case INDEX_op_extract_i64
:
973 tci_args_rrbb(insn
, &r0
, &r1
, &pos
, &len
);
974 regs
[r0
] = extract64(regs
[r1
], pos
, len
);
977 #if TCG_TARGET_HAS_sextract_i64
978 case INDEX_op_sextract_i64
:
979 tci_args_rrbb(insn
, &r0
, &r1
, &pos
, &len
);
980 regs
[r0
] = sextract64(regs
[r1
], pos
, len
);
983 case INDEX_op_brcond_i64
:
984 tci_args_rl(insn
, tb_ptr
, &r0
, &ptr
);
989 case INDEX_op_ext32s_i64
:
990 case INDEX_op_ext_i32_i64
:
991 tci_args_rr(insn
, &r0
, &r1
);
992 regs
[r0
] = (int32_t)regs
[r1
];
994 case INDEX_op_ext32u_i64
:
995 case INDEX_op_extu_i32_i64
:
996 tci_args_rr(insn
, &r0
, &r1
);
997 regs
[r0
] = (uint32_t)regs
[r1
];
999 #if TCG_TARGET_HAS_bswap64_i64
1000 case INDEX_op_bswap64_i64
:
1001 tci_args_rr(insn
, &r0
, &r1
);
1002 regs
[r0
] = bswap64(regs
[r1
]);
1005 #endif /* TCG_TARGET_REG_BITS == 64 */
1007 /* QEMU specific operations. */
1009 case INDEX_op_exit_tb
:
1010 tci_args_l(insn
, tb_ptr
, &ptr
);
1011 return (uintptr_t)ptr
;
1013 case INDEX_op_goto_tb
:
1014 tci_args_l(insn
, tb_ptr
, &ptr
);
1015 tb_ptr
= *(void **)ptr
;
1018 case INDEX_op_goto_ptr
:
1019 tci_args_r(insn
, &r0
);
1020 ptr
= (void *)regs
[r0
];
1027 case INDEX_op_qemu_ld_i32
:
1028 if (TARGET_LONG_BITS
<= TCG_TARGET_REG_BITS
) {
1029 tci_args_rrm(insn
, &r0
, &r1
, &oi
);
1032 tci_args_rrrm(insn
, &r0
, &r1
, &r2
, &oi
);
1033 taddr
= tci_uint64(regs
[r2
], regs
[r1
]);
1035 tmp32
= tci_qemu_ld(env
, taddr
, oi
, tb_ptr
);
1039 case INDEX_op_qemu_ld_i64
:
1040 if (TCG_TARGET_REG_BITS
== 64) {
1041 tci_args_rrm(insn
, &r0
, &r1
, &oi
);
1043 } else if (TARGET_LONG_BITS
<= TCG_TARGET_REG_BITS
) {
1044 tci_args_rrrm(insn
, &r0
, &r1
, &r2
, &oi
);
1047 tci_args_rrrrr(insn
, &r0
, &r1
, &r2
, &r3
, &r4
);
1048 taddr
= tci_uint64(regs
[r3
], regs
[r2
]);
1051 tmp64
= tci_qemu_ld(env
, taddr
, oi
, tb_ptr
);
1052 if (TCG_TARGET_REG_BITS
== 32) {
1053 tci_write_reg64(regs
, r1
, r0
, tmp64
);
1059 case INDEX_op_qemu_st_i32
:
1060 if (TARGET_LONG_BITS
<= TCG_TARGET_REG_BITS
) {
1061 tci_args_rrm(insn
, &r0
, &r1
, &oi
);
1064 tci_args_rrrm(insn
, &r0
, &r1
, &r2
, &oi
);
1065 taddr
= tci_uint64(regs
[r2
], regs
[r1
]);
1068 tci_qemu_st(env
, taddr
, tmp32
, oi
, tb_ptr
);
1071 case INDEX_op_qemu_st_i64
:
1072 if (TCG_TARGET_REG_BITS
== 64) {
1073 tci_args_rrm(insn
, &r0
, &r1
, &oi
);
1077 if (TARGET_LONG_BITS
<= TCG_TARGET_REG_BITS
) {
1078 tci_args_rrrm(insn
, &r0
, &r1
, &r2
, &oi
);
1081 tci_args_rrrrr(insn
, &r0
, &r1
, &r2
, &r3
, &r4
);
1082 taddr
= tci_uint64(regs
[r3
], regs
[r2
]);
1085 tmp64
= tci_uint64(regs
[r1
], regs
[r0
]);
1087 tci_qemu_st(env
, taddr
, tmp64
, oi
, tb_ptr
);
1091 /* Ensure ordering for all kinds */
1095 g_assert_not_reached();
1101 * Disassembler that matches the interpreter
1104 static const char *str_r(TCGReg r
)
1106 static const char regs
[TCG_TARGET_NB_REGS
][4] = {
1107 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
1108 "r8", "r9", "r10", "r11", "r12", "r13", "env", "sp"
1111 QEMU_BUILD_BUG_ON(TCG_AREG0
!= TCG_REG_R14
);
1112 QEMU_BUILD_BUG_ON(TCG_REG_CALL_STACK
!= TCG_REG_R15
);
1114 assert((unsigned)r
< TCG_TARGET_NB_REGS
);
1118 static const char *str_c(TCGCond c
)
1120 static const char cond
[16][8] = {
1121 [TCG_COND_NEVER
] = "never",
1122 [TCG_COND_ALWAYS
] = "always",
1123 [TCG_COND_EQ
] = "eq",
1124 [TCG_COND_NE
] = "ne",
1125 [TCG_COND_LT
] = "lt",
1126 [TCG_COND_GE
] = "ge",
1127 [TCG_COND_LE
] = "le",
1128 [TCG_COND_GT
] = "gt",
1129 [TCG_COND_LTU
] = "ltu",
1130 [TCG_COND_GEU
] = "geu",
1131 [TCG_COND_LEU
] = "leu",
1132 [TCG_COND_GTU
] = "gtu",
1135 assert((unsigned)c
< ARRAY_SIZE(cond
));
1136 assert(cond
[c
][0] != 0);
1140 /* Disassemble TCI bytecode. */
1141 int print_insn_tci(bfd_vma addr
, disassemble_info
*info
)
1143 const uint32_t *tb_ptr
= (const void *)(uintptr_t)addr
;
1144 const TCGOpDef
*def
;
1145 const char *op_name
;
1148 TCGReg r0
, r1
, r2
, r3
, r4
, r5
;
1149 tcg_target_ulong i1
;
1156 /* TCI is always the host, so we don't need to load indirect. */
1159 info
->fprintf_func(info
->stream
, "%08x ", insn
);
1161 op
= extract32(insn
, 0, 8);
1162 def
= &tcg_op_defs
[op
];
1163 op_name
= def
->name
;
1167 case INDEX_op_exit_tb
:
1168 case INDEX_op_goto_tb
:
1169 tci_args_l(insn
, tb_ptr
, &ptr
);
1170 info
->fprintf_func(info
->stream
, "%-12s %p", op_name
, ptr
);
1173 case INDEX_op_goto_ptr
:
1174 tci_args_r(insn
, &r0
);
1175 info
->fprintf_func(info
->stream
, "%-12s %s", op_name
, str_r(r0
));
1179 tci_args_nl(insn
, tb_ptr
, &len
, &ptr
);
1180 info
->fprintf_func(info
->stream
, "%-12s %d, %p", op_name
, len
, ptr
);
1183 case INDEX_op_brcond_i32
:
1184 case INDEX_op_brcond_i64
:
1185 tci_args_rl(insn
, tb_ptr
, &r0
, &ptr
);
1186 info
->fprintf_func(info
->stream
, "%-12s %s, 0, ne, %p",
1187 op_name
, str_r(r0
), ptr
);
1190 case INDEX_op_setcond_i32
:
1191 case INDEX_op_setcond_i64
:
1192 tci_args_rrrc(insn
, &r0
, &r1
, &r2
, &c
);
1193 info
->fprintf_func(info
->stream
, "%-12s %s, %s, %s, %s",
1194 op_name
, str_r(r0
), str_r(r1
), str_r(r2
), str_c(c
));
1197 case INDEX_op_tci_movi
:
1198 tci_args_ri(insn
, &r0
, &i1
);
1199 info
->fprintf_func(info
->stream
, "%-12s %s, 0x%" TCG_PRIlx
,
1200 op_name
, str_r(r0
), i1
);
1203 case INDEX_op_tci_movl
:
1204 tci_args_rl(insn
, tb_ptr
, &r0
, &ptr
);
1205 info
->fprintf_func(info
->stream
, "%-12s %s, %p",
1206 op_name
, str_r(r0
), ptr
);
1209 case INDEX_op_ld8u_i32
:
1210 case INDEX_op_ld8u_i64
:
1211 case INDEX_op_ld8s_i32
:
1212 case INDEX_op_ld8s_i64
:
1213 case INDEX_op_ld16u_i32
:
1214 case INDEX_op_ld16u_i64
:
1215 case INDEX_op_ld16s_i32
:
1216 case INDEX_op_ld16s_i64
:
1217 case INDEX_op_ld32u_i64
:
1218 case INDEX_op_ld32s_i64
:
1219 case INDEX_op_ld_i32
:
1220 case INDEX_op_ld_i64
:
1221 case INDEX_op_st8_i32
:
1222 case INDEX_op_st8_i64
:
1223 case INDEX_op_st16_i32
:
1224 case INDEX_op_st16_i64
:
1225 case INDEX_op_st32_i64
:
1226 case INDEX_op_st_i32
:
1227 case INDEX_op_st_i64
:
1228 tci_args_rrs(insn
, &r0
, &r1
, &s2
);
1229 info
->fprintf_func(info
->stream
, "%-12s %s, %s, %d",
1230 op_name
, str_r(r0
), str_r(r1
), s2
);
1233 case INDEX_op_mov_i32
:
1234 case INDEX_op_mov_i64
:
1235 case INDEX_op_ext8s_i32
:
1236 case INDEX_op_ext8s_i64
:
1237 case INDEX_op_ext8u_i32
:
1238 case INDEX_op_ext8u_i64
:
1239 case INDEX_op_ext16s_i32
:
1240 case INDEX_op_ext16s_i64
:
1241 case INDEX_op_ext16u_i32
:
1242 case INDEX_op_ext32s_i64
:
1243 case INDEX_op_ext32u_i64
:
1244 case INDEX_op_ext_i32_i64
:
1245 case INDEX_op_extu_i32_i64
:
1246 case INDEX_op_bswap16_i32
:
1247 case INDEX_op_bswap16_i64
:
1248 case INDEX_op_bswap32_i32
:
1249 case INDEX_op_bswap32_i64
:
1250 case INDEX_op_bswap64_i64
:
1251 case INDEX_op_not_i32
:
1252 case INDEX_op_not_i64
:
1253 case INDEX_op_neg_i32
:
1254 case INDEX_op_neg_i64
:
1255 case INDEX_op_ctpop_i32
:
1256 case INDEX_op_ctpop_i64
:
1257 tci_args_rr(insn
, &r0
, &r1
);
1258 info
->fprintf_func(info
->stream
, "%-12s %s, %s",
1259 op_name
, str_r(r0
), str_r(r1
));
1262 case INDEX_op_add_i32
:
1263 case INDEX_op_add_i64
:
1264 case INDEX_op_sub_i32
:
1265 case INDEX_op_sub_i64
:
1266 case INDEX_op_mul_i32
:
1267 case INDEX_op_mul_i64
:
1268 case INDEX_op_and_i32
:
1269 case INDEX_op_and_i64
:
1270 case INDEX_op_or_i32
:
1271 case INDEX_op_or_i64
:
1272 case INDEX_op_xor_i32
:
1273 case INDEX_op_xor_i64
:
1274 case INDEX_op_andc_i32
:
1275 case INDEX_op_andc_i64
:
1276 case INDEX_op_orc_i32
:
1277 case INDEX_op_orc_i64
:
1278 case INDEX_op_eqv_i32
:
1279 case INDEX_op_eqv_i64
:
1280 case INDEX_op_nand_i32
:
1281 case INDEX_op_nand_i64
:
1282 case INDEX_op_nor_i32
:
1283 case INDEX_op_nor_i64
:
1284 case INDEX_op_div_i32
:
1285 case INDEX_op_div_i64
:
1286 case INDEX_op_rem_i32
:
1287 case INDEX_op_rem_i64
:
1288 case INDEX_op_divu_i32
:
1289 case INDEX_op_divu_i64
:
1290 case INDEX_op_remu_i32
:
1291 case INDEX_op_remu_i64
:
1292 case INDEX_op_shl_i32
:
1293 case INDEX_op_shl_i64
:
1294 case INDEX_op_shr_i32
:
1295 case INDEX_op_shr_i64
:
1296 case INDEX_op_sar_i32
:
1297 case INDEX_op_sar_i64
:
1298 case INDEX_op_rotl_i32
:
1299 case INDEX_op_rotl_i64
:
1300 case INDEX_op_rotr_i32
:
1301 case INDEX_op_rotr_i64
:
1302 case INDEX_op_clz_i32
:
1303 case INDEX_op_clz_i64
:
1304 case INDEX_op_ctz_i32
:
1305 case INDEX_op_ctz_i64
:
1306 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
1307 info
->fprintf_func(info
->stream
, "%-12s %s, %s, %s",
1308 op_name
, str_r(r0
), str_r(r1
), str_r(r2
));
1311 case INDEX_op_deposit_i32
:
1312 case INDEX_op_deposit_i64
:
1313 tci_args_rrrbb(insn
, &r0
, &r1
, &r2
, &pos
, &len
);
1314 info
->fprintf_func(info
->stream
, "%-12s %s, %s, %s, %d, %d",
1315 op_name
, str_r(r0
), str_r(r1
), str_r(r2
), pos
, len
);
1318 case INDEX_op_extract_i32
:
1319 case INDEX_op_extract_i64
:
1320 case INDEX_op_sextract_i32
:
1321 case INDEX_op_sextract_i64
:
1322 tci_args_rrbb(insn
, &r0
, &r1
, &pos
, &len
);
1323 info
->fprintf_func(info
->stream
, "%-12s %s,%s,%d,%d",
1324 op_name
, str_r(r0
), str_r(r1
), pos
, len
);
1327 case INDEX_op_movcond_i32
:
1328 case INDEX_op_movcond_i64
:
1329 case INDEX_op_setcond2_i32
:
1330 tci_args_rrrrrc(insn
, &r0
, &r1
, &r2
, &r3
, &r4
, &c
);
1331 info
->fprintf_func(info
->stream
, "%-12s %s, %s, %s, %s, %s, %s",
1332 op_name
, str_r(r0
), str_r(r1
), str_r(r2
),
1333 str_r(r3
), str_r(r4
), str_c(c
));
1336 case INDEX_op_mulu2_i32
:
1337 case INDEX_op_mulu2_i64
:
1338 case INDEX_op_muls2_i32
:
1339 case INDEX_op_muls2_i64
:
1340 tci_args_rrrr(insn
, &r0
, &r1
, &r2
, &r3
);
1341 info
->fprintf_func(info
->stream
, "%-12s %s, %s, %s, %s",
1342 op_name
, str_r(r0
), str_r(r1
),
1343 str_r(r2
), str_r(r3
));
1346 case INDEX_op_add2_i32
:
1347 case INDEX_op_add2_i64
:
1348 case INDEX_op_sub2_i32
:
1349 case INDEX_op_sub2_i64
:
1350 tci_args_rrrrrr(insn
, &r0
, &r1
, &r2
, &r3
, &r4
, &r5
);
1351 info
->fprintf_func(info
->stream
, "%-12s %s, %s, %s, %s, %s, %s",
1352 op_name
, str_r(r0
), str_r(r1
), str_r(r2
),
1353 str_r(r3
), str_r(r4
), str_r(r5
));
1356 case INDEX_op_qemu_ld_i64
:
1357 case INDEX_op_qemu_st_i64
:
1358 len
= DIV_ROUND_UP(64, TCG_TARGET_REG_BITS
);
1360 case INDEX_op_qemu_ld_i32
:
1361 case INDEX_op_qemu_st_i32
:
1364 len
+= DIV_ROUND_UP(TARGET_LONG_BITS
, TCG_TARGET_REG_BITS
);
1367 tci_args_rrm(insn
, &r0
, &r1
, &oi
);
1368 info
->fprintf_func(info
->stream
, "%-12s %s, %s, %x",
1369 op_name
, str_r(r0
), str_r(r1
), oi
);
1372 tci_args_rrrm(insn
, &r0
, &r1
, &r2
, &oi
);
1373 info
->fprintf_func(info
->stream
, "%-12s %s, %s, %s, %x",
1374 op_name
, str_r(r0
), str_r(r1
), str_r(r2
), oi
);
1377 tci_args_rrrrr(insn
, &r0
, &r1
, &r2
, &r3
, &r4
);
1378 info
->fprintf_func(info
->stream
, "%-12s %s, %s, %s, %s, %s",
1379 op_name
, str_r(r0
), str_r(r1
),
1380 str_r(r2
), str_r(r3
), str_r(r4
));
1383 g_assert_not_reached();
1388 /* tcg_out_nop_fill uses zeros */
1390 info
->fprintf_func(info
->stream
, "align");
1396 info
->fprintf_func(info
->stream
, "illegal opcode %d", op
);
1400 return sizeof(insn
);