TCI fixes and cleanups
v4 cover TCI fixes and cleanups
Changes since v3:
* First patch fixes g2h() breakage. This shows a hole in our CI, in that we only build softmmu with TCI, not linux-user.
* Tidy-up for the magic qemu_ld/st macros.
* Fix libffi return value case with ffi_arg.
Changes since v2:
* 20-something patches are now upstream.
* Increase testing timeout for tci.
* Gitlab testing for tci w/ 32-bit host.
r~
Richard Henderson (71):
tcg/tci: Use exec/cpu_ldst.h interfaces
tcg: Split out tcg_raise_tb_overflow
tcg: Manage splitwx in tc_ptr_to_region_tree by hand tcg/tci: Merge identical cases in generation
tcg/tci: Remove tci_read_r8
tcg/tci: Remove tci_read_r8s
tcg/tci: Remove tci_read_r16
tcg/tci: Remove tci_read_r16s
tcg/tci: Remove tci_read_r32
tcg/tci: Remove tci_read_r32s
tcg/tci: Reduce use of tci_read_r64
tcg/tci: Merge basic arithmetic operations
tcg/tci: Merge extension operations
tcg/tci: Remove ifdefs for TCG_TARGET_HAS_ext32[us]_i64 tcg/tci: Merge bswap operations
tcg/tci: Merge mov, not and neg operations
tcg/tci: Rename tci_read_r to tci_read_rval
tcg/tci: Split out tci_args_rrs
tcg/tci: Split out tci_args_rr
tcg/tci: Split out tci_args_rrr
tcg/tci: Split out tci_args_rrrc
tcg/tci: Split out tci_args_l
tcg/tci: Split out tci_args_rrrrrc
tcg/tci: Split out tci_args_rrcl and tci_args_rrrrcl tcg/tci: Split out tci_args_ri and tci_args_rI
tcg/tci: Reuse tci_args_l for calls.
tcg/tci: Reuse tci_args_l for exit_tb
tcg/tci: Reuse tci_args_l for goto_tb
tcg/tci: Split out tci_args_rrrrrr
tcg/tci: Split out tci_args_rrrr
tcg/tci: Clean up deposit operations
tcg/tci: Reduce qemu_ld/st TCGMemOpIdx operand to 32-bits tcg/tci: Split out tci_args_{rrm,rrrm,rrrrm}
tcg/tci: Hoist op_size checking into tci_args_*
tcg/tci: Remove tci_disas
tcg/tci: Implement the disassembler properly
tcg: Build ffi data structures for helpers
tcg/tci: Use ffi for calls
tcg/tci: Improve tcg_target_call_clobber_regs
tcg/tci: Move call-return regs to end of tcg_target_reg_alloc_order tcg/tci: Push opcode emit into each case
tcg/tci: Split out tcg_out_op_rrs
tcg/tci: Split out tcg_out_op_l
tcg/tci: Split out tcg_out_op_p
tcg/tci: Split out tcg_out_op_rr
tcg/tci: Split out tcg_out_op_rrr
tcg/tci: Split out tcg_out_op_rrrc
tcg/tci: Split out tcg_out_op_rrrrrc
tcg/tci: Split out tcg_out_op_rrrbb
tcg/tci: Split out tcg_out_op_rrcl
tcg/tci: Split out tcg_out_op_rrrrrr
tcg/tci: Split out tcg_out_op_rrrr
tcg/tci: Split out tcg_out_op_rrrrcl
tcg/tci: Split out tcg_out_op_{rrm,rrrm,rrrrm}
tcg/tci: Split out tcg_out_op_v
tcg/tci: Split out tcg_out_op_np
tcg/tci: Split out tcg_out_op_r[iI]
tcg/tci: Reserve r13 for a temporary
tcg/tci: Emit setcond before brcond
tcg/tci: Remove tci_write_reg
tcg/tci: Change encoding to uint32_t units
tcg/tci: Implement goto_ptr
tcg/tci: Implement movcond
tcg/tci: Implement andc, orc, eqv, nand, nor
tcg/tci: Implement extract, sextract
tcg/tci: Implement clz, ctz, ctpop
tcg/tci: Implement mulu2, muls2
tcg/tci: Implement add2, sub2
tcg/tci: Split out tci_qemu_ld, tci_qemu_st
tests/tcg: Increase timeout for TCI
gitlab: Enable cross-i386 builds of TCI
configure | 3 + meson.build | 9 +- include/exec/helper-ffi.h | 115 ++ include/exec/helper-tcg.h | 24 +- include/tcg/tcg-opc.h | 6 +- include/tcg/tcg.h | 1 + target/hppa/helper.h | 2 + target/i386/ops_sse_header.h | 6 + target/m68k/helper.h | 1 + target/ppc/helper.h | 3 + tcg/tci/tcg-target-con-set.h | 2 +- tcg/tci/tcg-target.h | 81 +- disas/tci.c | 61 - tcg/tcg.c | 117 +- tcg/tci.c | 1759 +++++++++-------- tcg/tci/tcg-target.c.inc | 926 +++++---- .gitlab-ci.d/crossbuilds.yml | 17 +- tcg/tci/README | 20 +- .../dockerfiles/fedora-i386-cross.docker | 1 + tests/docker/dockerfiles/fedora.docker | 1 + tests/tcg/Makefile.target | 6 +- 21 files changed, 1789 insertions(+), 1372 deletions(-) create mode 100644 include/exec/helper-ffi.h delete mode 100644 disas/tci.c
Signature · 1 line
2.25.1
PATCH v4 1/71 tcg/tci: Use exec/cpu_ldst.h interfaces
Use the provided cpu_ldst.h interfaces. This fixes the build vs the unconverted uses of g2h(), adds missed memory trace events, and correctly recognizes when a SIGSEGV belongs to the guest via set_helper_retaddr().
--- tcg/tci.c | 73 +++++++++++++++++++++---------------------------------- 1 file changed, 28 insertions(+), 45 deletions(-)
tcg/tci.c +28 -45
@@ -346,51 +346,34 @@ static bool tci_compare64(uint64_t u0, uint64_t u1, TCGCond condition)return result; } -#ifdef CONFIG_SOFTMMU -# define qemu_ld_ub \ - helper_ret_ldub_mmu(env, taddr, oi, (uintptr_t)tb_ptr) -# define qemu_ld_leuw \ - helper_le_lduw_mmu(env, taddr, oi, (uintptr_t)tb_ptr) -# define qemu_ld_leul \ - helper_le_ldul_mmu(env, taddr, oi, (uintptr_t)tb_ptr) -# define qemu_ld_leq \ - helper_le_ldq_mmu(env, taddr, oi, (uintptr_t)tb_ptr) -# define qemu_ld_beuw \ - helper_be_lduw_mmu(env, taddr, oi, (uintptr_t)tb_ptr) -# define qemu_ld_beul \ - helper_be_ldul_mmu(env, taddr, oi, (uintptr_t)tb_ptr) -# define qemu_ld_beq \ - helper_be_ldq_mmu(env, taddr, oi, (uintptr_t)tb_ptr) -# define qemu_st_b (X ) \ - helper_ret_stb_mmu(env, taddr, X, oi, (uintptr_t)tb_ptr) -# define qemu_st_lew (X ) \ - helper_le_stw_mmu(env, taddr, X, oi, (uintptr_t)tb_ptr) -# define qemu_st_lel (X ) \ - helper_le_stl_mmu(env, taddr, X, oi, (uintptr_t)tb_ptr) -# define qemu_st_leq (X ) \ - helper_le_stq_mmu(env, taddr, X, oi, (uintptr_t)tb_ptr) -# define qemu_st_bew (X ) \ - helper_be_stw_mmu(env, taddr, X, oi, (uintptr_t)tb_ptr) -# define qemu_st_bel (X ) \ - helper_be_stl_mmu(env, taddr, X, oi, (uintptr_t)tb_ptr) -# define qemu_st_beq (X ) \ - helper_be_stq_mmu(env, taddr, X, oi, (uintptr_t)tb_ptr) -#else -# define qemu_ld_ub ldub_p(g2h(taddr)) -# define qemu_ld_leuw lduw_le_p(g2h(taddr)) -# define qemu_ld_leul (uint32_t)ldl_le_p(g2h(taddr)) -# define qemu_ld_leq ldq_le_p(g2h(taddr)) -# define qemu_ld_beuw lduw_be_p(g2h(taddr)) -# define qemu_ld_beul (uint32_t)ldl_be_p(g2h(taddr)) -# define qemu_ld_beq ldq_be_p(g2h(taddr)) -# define qemu_st_b (X ) stb_p(g2h(taddr), X) -# define qemu_st_lew (X ) stw_le_p(g2h(taddr), X) -# define qemu_st_lel (X ) stl_le_p(g2h(taddr), X) -# define qemu_st_leq (X ) stq_le_p(g2h(taddr), X) -# define qemu_st_bew (X ) stw_be_p(g2h(taddr), X) -# define qemu_st_bel (X ) stl_be_p(g2h(taddr), X) -# define qemu_st_beq (X ) stq_be_p(g2h(taddr), X) -#endif +#define qemu_ld_ub \ + cpu_ldub_mmuidx_ra(env, taddr, get_mmuidx(oi), (uintptr_t)tb_ptr) +#define qemu_ld_leuw \ + cpu_lduw_le_mmuidx_ra(env, taddr, get_mmuidx(oi), (uintptr_t)tb_ptr) +#define qemu_ld_leul \ + cpu_ldl_le_mmuidx_ra(env, taddr, get_mmuidx(oi), (uintptr_t)tb_ptr) +#define qemu_ld_leq \ + cpu_ldq_le_mmuidx_ra(env, taddr, get_mmuidx(oi), (uintptr_t)tb_ptr) +#define qemu_ld_beuw \ + cpu_lduw_be_mmuidx_ra(env, taddr, get_mmuidx(oi), (uintptr_t)tb_ptr) +#define qemu_ld_beul \ + cpu_ldl_be_mmuidx_ra(env, taddr, get_mmuidx(oi), (uintptr_t)tb_ptr) +#define qemu_ld_beq \ + cpu_ldq_be_mmuidx_ra(env, taddr, get_mmuidx(oi), (uintptr_t)tb_ptr) +#define qemu_st_b (X ) \ + cpu_stb_mmuidx_ra(env, taddr, X, get_mmuidx(oi), (uintptr_t)tb_ptr) +#define qemu_st_lew (X ) \ + cpu_stw_le_mmuidx_ra(env, taddr, X, get_mmuidx(oi), (uintptr_t)tb_ptr) +#define qemu_st_lel (X ) \ + cpu_stl_le_mmuidx_ra(env, taddr, X, get_mmuidx(oi), (uintptr_t)tb_ptr) +#define qemu_st_leq (X ) \ + cpu_stq_le_mmuidx_ra(env, taddr, X, get_mmuidx(oi), (uintptr_t)tb_ptr) +#define qemu_st_bew (X ) \ + cpu_stw_be_mmuidx_ra(env, taddr, X, get_mmuidx(oi), (uintptr_t)tb_ptr) +#define qemu_st_bel (X ) \ + cpu_stl_be_mmuidx_ra(env, taddr, X, get_mmuidx(oi), (uintptr_t)tb_ptr) +#define qemu_st_beq (X ) \ + cpu_stq_be_mmuidx_ra(env, taddr, X, get_mmuidx(oi), (uintptr_t)tb_ptr)#if TCG_TARGET_REG_BITS ==64 # define CASE_32_64 (x) \
Signature · 1 line
2.25.1
Re: [PATCH v4 01/71] tcg/tci: Use exec/cpu_ldst.h interfaces
Quoted 10 lines · Richard Henderson
Use the provided
cpu_ldst.hinterfaces. This fixes the build vs the unconverted uses ofg2h(), adds missed memory trace events, and correctly recognizes when a SIGSEGV belongs to the guest viaset_helper_retaddr().Fixes 3e8f1628e864Signed-off-by Richard Henderson <[email protected]>--- tcg/tci.c | 73 +++++++++++++++++++++---------------------------------- 1 file changed, 28 insertions(+), 45 deletions(-)
Hit that today:
../tcg/tci.c: In function ‘tcg_qemu_tb_exec’:../tcg/tci.c:379:37: error: passing argument 1 of ‘g2h’ makes pointer from integer without a cast [-Werror=int-conversion]
379 | # define qemu_ld_ub ldub_p(g2h(taddr))
| ^~~~~
| |
| target_ulong {aka unsigned int}
../tcg/tci.c:1034:25: note: in expansion of macro ‘qemu_ld_ub’
1034 | tmp32 = qemu_ld_ub;
| ^~~~~~~~~~In file included from ../tcg/tci.c:32:include/exec/cpu_ldst.h:85:35: note: expected ‘CPUState *’ but argument is of type ‘target_ulong’ {aka ‘unsigned int’}
85 | static inline void *g2h(CPUState *cs, abi_ptr x)
| ~~~~~~~~~~^~
../tcg/tci.c:379:33: error: too few arguments to function ‘g2h’
379 | # define qemu_ld_ub ldub_p(g2h(taddr))
| ^~~../tcg/tci.c:1034:25: note: in expansion of macro ‘qemu_ld_ub’
1034 | tmp32 = qemu_ld_ub;
| ^~~~~~~~~~So:
PATCH v4 2/71 tcg: Split out tcg_raise_tb_overflow
In reply to Richard HendersonAllow other places in tcg to restart with a smaller tb.
--- tcg/tcg.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
tcg/tcg.c +7 -2
@@ -346,6 +346,12 @@ static void set_jmp_reset_offset(TCGContext *s, int which) s->tb_jmp_reset_offset[which] =tcg_current_code_size (s); } +/* Signal overflow, starting over with fewer guest insns. */ +static void QEMU_NORETURN tcg_raise_tb_overflow(TCGContext *s) +{ +siglongjmp (s->jmp_trans,-2 ); +} +#define C_PFX1 (P ,A ) P##A#define C_PFX2 (P ,A ,B ) P##A##_##B#define C_PFX3 (P ,A ,B ,C ) P##A##_##B##_##C
@@ -1310,8 +1316,7 @@ static TCGTemp *tcg_temp_alloc(TCGContext *s)int n = s->nb_temps++;if (n >=TCG_MAX_TEMPS ) { -/* Signal overflow, starting over with fewer guest insns. */ -siglongjmp (s->jmp_trans,-2 ); +tcg_raise_tb_overflow (s); }return memset (&s->temps[n],0 ,sizeof (TCGTemp)); }
Signature · 1 line
2.25.1
Re: [PATCH v4 02/71] tcg: Split out tcg_raise_tb_overflow
Quoted 6 lines · Richard Henderson
Allow other places in tcg to restart with a smaller tb.
Signed-off-by Richard Henderson <[email protected]>--- tcg/tcg.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
PATCH v4 3/71 tcg: Manage splitwx in tc_ptr_to_region_tree by hand
In reply to Richard HendersonThe use in tcg_tb_lookup is given a random pc that comes from the pc of a signal handler. Do not assert that the pointer is already within the code gen buffer at all, much less the writable mirror of it.
---
For TCI, this indicates a bug in handle_cpu_signal, in that we are taking PC from the host signal frame. Which is, nearly, unrelated to TCI at all.
The TCI "pc" is tci_tb_ptr (fixed in the next patch to at least be thread-local). We update this only on calls, since we don't expect SEGV during the interpretation loop. Which works ok for softmmu, in which we pass down pc by hand to the helpers, but is not ok for user-only, where we simply perform the raw memory operation.
I don't know how to fix this, exactly. Probably by storing to tci_tb_ptr before each qemu_ld/qemu_st operation, with barriers. Then Doing the Right Thing in handle_cpu_signal. And perhaps by clearing tci_tb_ptr whenever we're not expecting a SEGV on behalf of the guest (and thus anything left is a qemu host bug).
---
v2: Retain full struct initialization
--- tcg/tcg.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
tcg/tcg.c +18 -2
@@ -513,11 +513,21 @@ static void tcg_region_trees_init(void) } } -static struct tcg_region_tree *tc_ptr_to_region_tree (const void *cp) +static struct tcg_region_tree *tc_ptr_to_region_tree (const void *p) { -void *p =tcg_splitwx_to_rw (cp);size_t region_idx; +/* +* Like tcg_splitwx_to_rw, with no assert. The pc may come from +* a signal handler over which the caller has no control. +*/ +if (!in_code_gen_buffer (p)) { + p -= tcg_splitwx_diff; +if (!in_code_gen_buffer (p)) { +return NULL ; + } + } +if (p < region.start_aligned) { region_idx =0 ; }else {
@@ -536,6 +546,7 @@ void tcg_tb_insert(TranslationBlock *tb) {struct tcg_region_tree *rt =tc_ptr_to_region_tree (tb->tc.ptr); +g_assert (rt !=NULL );qemu_mutex_lock (&rt->lock);g_tree_insert (rt->tree, &tb->tc, tb);qemu_mutex_unlock (&rt->lock);
@@ -545,6 +556,7 @@ void tcg_tb_remove(TranslationBlock *tb) {struct tcg_region_tree *rt =tc_ptr_to_region_tree (tb->tc.ptr); +g_assert (rt !=NULL );qemu_mutex_lock (&rt->lock);g_tree_remove (rt->tree, &tb->tc);qemu_mutex_unlock (&rt->lock);
@@ -561,6 +573,10 @@ TranslationBlock *tcg_tb_lookup(uintptr_t tc_ptr)TranslationBlock *tb;struct tb_tc s = { .ptr = (void *)tc_ptr }; +if (rt ==NULL ) { +return NULL ; + } +qemu_mutex_lock (&rt->lock); tb =g_tree_lookup (rt->tree, &s);qemu_mutex_unlock (&rt->lock);
Signature · 1 line
2.25.1
PATCH v4 4/71 tcg/tci: Merge identical cases in generation
In reply to Richard HendersonUse CASE_32_64 and CASE_64 to reduce ifdefs and merge cases that are identical between 32-bit and 64-bit hosts.
--- tcg/tci/tcg-target.c.inc | 204 ++++++++++++++------------------------- 1 file changed, 73 insertions(+), 131 deletions(-)
tcg/tci/tcg-target.c.inc +73 -131
@@ -380,6 +380,18 @@ static inline void tcg_out_call(TCGContext *s, const tcg_insn_unit *arg) old_code_ptr[1] = s->code_ptr - old_code_ptr; } +#if TCG_TARGET_REG_BITS == 64 +# define CASE_32_64(x) \ + case glue(glue(INDEX_op_, x), _i64): \ + case glue(glue(INDEX_op_, x), _i32): +# define CASE_64(x) \ + case glue(glue(INDEX_op_, x), _i64): +#else +# define CASE_32_64(x) \ + case glue(glue(INDEX_op_, x), _i32): +# define CASE_64(x) +#endif + static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, const int *const_args) {
@@ -391,6 +403,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, case INDEX_op_exit_tb: tcg_out64(s, args[0]); break; + case INDEX_op_goto_tb: if (s->tb_jmp_insn_offset) { /* Direct jump method. */
@@ -404,15 +417,18 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, } set_jmp_reset_offset(s, args[0]); break; + case INDEX_op_br: tci_out_label(s, arg_label(args[0])); break; - case INDEX_op_setcond_i32: + + CASE_32_64(setcond) tcg_out_r(s, args[0]); tcg_out_r(s, args[1]); tcg_out_r(s, args[2]); tcg_out8(s, args[3]); /* condition */ break; + #if TCG_TARGET_REG_BITS == 32 case INDEX_op_setcond2_i32: /* setcond2_i32 cond, t0, t1_low, t1_high, t2_low, t2_high */
@@ -423,60 +439,54 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, tcg_out_r(s, args[4]); tcg_out8(s, args[5]); /* condition */ break; -#elif TCG_TARGET_REG_BITS == 64 - case INDEX_op_setcond_i64: - tcg_out_r(s, args[0]); - tcg_out_r(s, args[1]); - tcg_out_r(s, args[2]); - tcg_out8(s, args[3]); /* condition */ - break; #endif - case INDEX_op_ld8u_i32: - case INDEX_op_ld8s_i32: - case INDEX_op_ld16u_i32: - case INDEX_op_ld16s_i32: + + CASE_32_64(ld8u) + CASE_32_64(ld8s) + CASE_32_64(ld16u) + CASE_32_64(ld16s) case INDEX_op_ld_i32: - case INDEX_op_st8_i32: - case INDEX_op_st16_i32: + CASE_64(ld32u) + CASE_64(ld32s) + CASE_64(ld) + CASE_32_64(st8) + CASE_32_64(st16) case INDEX_op_st_i32: - case INDEX_op_ld8u_i64: - case INDEX_op_ld8s_i64: - case INDEX_op_ld16u_i64: - case INDEX_op_ld16s_i64: - case INDEX_op_ld32u_i64: - case INDEX_op_ld32s_i64: - case INDEX_op_ld_i64: - case INDEX_op_st8_i64: - case INDEX_op_st16_i64: - case INDEX_op_st32_i64: - case INDEX_op_st_i64: + CASE_64(st32) + CASE_64(st) stack_bounds_check(args[1], args[2]); tcg_out_r(s, args[0]); tcg_out_r(s, args[1]); tcg_debug_assert(args[2] == (int32_t)args[2]); tcg_out32(s, args[2]); break; - case INDEX_op_add_i32: - case INDEX_op_sub_i32: - case INDEX_op_mul_i32: - case INDEX_op_and_i32: - case INDEX_op_andc_i32: /* Optional (TCG_TARGET_HAS_andc_i32). */ - case INDEX_op_eqv_i32: /* Optional (TCG_TARGET_HAS_eqv_i32). */ - case INDEX_op_nand_i32: /* Optional (TCG_TARGET_HAS_nand_i32). */ - case INDEX_op_nor_i32: /* Optional (TCG_TARGET_HAS_nor_i32). */ - case INDEX_op_or_i32: - case INDEX_op_orc_i32: /* Optional (TCG_TARGET_HAS_orc_i32). */ - case INDEX_op_xor_i32: - case INDEX_op_shl_i32: - case INDEX_op_shr_i32: - case INDEX_op_sar_i32: - case INDEX_op_rotl_i32: /* Optional (TCG_TARGET_HAS_rot_i32). */ - case INDEX_op_rotr_i32: /* Optional (TCG_TARGET_HAS_rot_i32). */ + + CASE_32_64(add) + CASE_32_64(sub) + CASE_32_64(mul) + CASE_32_64(and) + CASE_32_64(or) + CASE_32_64(xor) + CASE_32_64(andc) /* Optional (TCG_TARGET_HAS_andc_*). */ + CASE_32_64(orc) /* Optional (TCG_TARGET_HAS_orc_*). */ + CASE_32_64(eqv) /* Optional (TCG_TARGET_HAS_eqv_*). */ + CASE_32_64(nand) /* Optional (TCG_TARGET_HAS_nand_*). */ + CASE_32_64(nor) /* Optional (TCG_TARGET_HAS_nor_*). */ + CASE_32_64(shl) + CASE_32_64(shr) + CASE_32_64(sar) + CASE_32_64(rotl) /* Optional (TCG_TARGET_HAS_rot_*). */ + CASE_32_64(rotr) /* Optional (TCG_TARGET_HAS_rot_*). */ + CASE_32_64(div) /* Optional (TCG_TARGET_HAS_div_*). */ + CASE_32_64(divu) /* Optional (TCG_TARGET_HAS_div_*). */ + CASE_32_64(rem) /* Optional (TCG_TARGET_HAS_div_*). */ + CASE_32_64(remu) /* Optional (TCG_TARGET_HAS_div_*). */ tcg_out_r(s, args[0]); tcg_out_r(s, args[1]); tcg_out_r(s, args[2]); break; - case INDEX_op_deposit_i32: /* Optional (TCG_TARGET_HAS_deposit_i32). */ + + CASE_32_64(deposit) /* Optional (TCG_TARGET_HAS_deposit_*). */ tcg_out_r(s, args[0]); tcg_out_r(s, args[1]); tcg_out_r(s, args[2]);
@@ -486,79 +496,30 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, tcg_out8(s, args[4]); break; -#if TCG_TARGET_REG_BITS == 64 - case INDEX_op_add_i64: - case INDEX_op_sub_i64: - case INDEX_op_mul_i64: - case INDEX_op_and_i64: - case INDEX_op_andc_i64: /* Optional (TCG_TARGET_HAS_andc_i64). */ - case INDEX_op_eqv_i64: /* Optional (TCG_TARGET_HAS_eqv_i64). */ - case INDEX_op_nand_i64: /* Optional (TCG_TARGET_HAS_nand_i64). */ - case INDEX_op_nor_i64: /* Optional (TCG_TARGET_HAS_nor_i64). */ - case INDEX_op_or_i64: - case INDEX_op_orc_i64: /* Optional (TCG_TARGET_HAS_orc_i64). */ - case INDEX_op_xor_i64: - case INDEX_op_shl_i64: - case INDEX_op_shr_i64: - case INDEX_op_sar_i64: - case INDEX_op_rotl_i64: /* Optional (TCG_TARGET_HAS_rot_i64). */ - case INDEX_op_rotr_i64: /* Optional (TCG_TARGET_HAS_rot_i64). */ - case INDEX_op_div_i64: /* Optional (TCG_TARGET_HAS_div_i64). */ - case INDEX_op_divu_i64: /* Optional (TCG_TARGET_HAS_div_i64). */ - case INDEX_op_rem_i64: /* Optional (TCG_TARGET_HAS_div_i64). */ - case INDEX_op_remu_i64: /* Optional (TCG_TARGET_HAS_div_i64). */ - tcg_out_r(s, args[0]); - tcg_out_r(s, args[1]); - tcg_out_r(s, args[2]); - break; - case INDEX_op_deposit_i64: /* Optional (TCG_TARGET_HAS_deposit_i64). */ - tcg_out_r(s, args[0]); - tcg_out_r(s, args[1]); - tcg_out_r(s, args[2]); - tcg_debug_assert(args[3] <= UINT8_MAX); - tcg_out8(s, args[3]); - tcg_debug_assert(args[4] <= UINT8_MAX); - tcg_out8(s, args[4]); - break; - case INDEX_op_brcond_i64: + CASE_32_64(brcond) tcg_out_r(s, args[0]); tcg_out_r(s, args[1]); tcg_out8(s, args[2]); /* condition */ tci_out_label(s, arg_label(args[3])); break; - case INDEX_op_bswap16_i64: /* Optional (TCG_TARGET_HAS_bswap16_i64). */ - case INDEX_op_bswap32_i64: /* Optional (TCG_TARGET_HAS_bswap32_i64). */ - case INDEX_op_bswap64_i64: /* Optional (TCG_TARGET_HAS_bswap64_i64). */ - case INDEX_op_not_i64: /* Optional (TCG_TARGET_HAS_not_i64). */ - case INDEX_op_neg_i64: /* Optional (TCG_TARGET_HAS_neg_i64). */ - case INDEX_op_ext8s_i64: /* Optional (TCG_TARGET_HAS_ext8s_i64). */ - case INDEX_op_ext8u_i64: /* Optional (TCG_TARGET_HAS_ext8u_i64). */ - case INDEX_op_ext16s_i64: /* Optional (TCG_TARGET_HAS_ext16s_i64). */ - case INDEX_op_ext16u_i64: /* Optional (TCG_TARGET_HAS_ext16u_i64). */ - case INDEX_op_ext32s_i64: /* Optional (TCG_TARGET_HAS_ext32s_i64). */ - case INDEX_op_ext32u_i64: /* Optional (TCG_TARGET_HAS_ext32u_i64). */ - case INDEX_op_ext_i32_i64: - case INDEX_op_extu_i32_i64: -#endif /* TCG_TARGET_REG_BITS == 64 */ - case INDEX_op_neg_i32: /* Optional (TCG_TARGET_HAS_neg_i32). */ - case INDEX_op_not_i32: /* Optional (TCG_TARGET_HAS_not_i32). */ - case INDEX_op_ext8s_i32: /* Optional (TCG_TARGET_HAS_ext8s_i32). */ - case INDEX_op_ext16s_i32: /* Optional (TCG_TARGET_HAS_ext16s_i32). */ - case INDEX_op_ext8u_i32: /* Optional (TCG_TARGET_HAS_ext8u_i32). */ - case INDEX_op_ext16u_i32: /* Optional (TCG_TARGET_HAS_ext16u_i32). */ - case INDEX_op_bswap16_i32: /* Optional (TCG_TARGET_HAS_bswap16_i32). */ - case INDEX_op_bswap32_i32: /* Optional (TCG_TARGET_HAS_bswap32_i32). */ + + CASE_32_64(neg) /* Optional (TCG_TARGET_HAS_neg_*). */ + CASE_32_64(not) /* Optional (TCG_TARGET_HAS_not_*). */ + CASE_32_64(ext8s) /* Optional (TCG_TARGET_HAS_ext8s_*). */ + CASE_32_64(ext8u) /* Optional (TCG_TARGET_HAS_ext8u_*). */ + CASE_32_64(ext16s) /* Optional (TCG_TARGET_HAS_ext16s_*). */ + CASE_32_64(ext16u) /* Optional (TCG_TARGET_HAS_ext16u_*). */ + CASE_64(ext32s) /* Optional (TCG_TARGET_HAS_ext32s_i64). */ + CASE_64(ext32u) /* Optional (TCG_TARGET_HAS_ext32u_i64). */ + CASE_64(ext_i32) + CASE_64(extu_i32) + CASE_32_64(bswap16) /* Optional (TCG_TARGET_HAS_bswap16_*). */ + CASE_32_64(bswap32) /* Optional (TCG_TARGET_HAS_bswap32_*). */ + CASE_64(bswap64) /* Optional (TCG_TARGET_HAS_bswap64_i64). */ tcg_out_r(s, args[0]); tcg_out_r(s, args[1]); break; - case INDEX_op_div_i32: /* Optional (TCG_TARGET_HAS_div_i32). */ - case INDEX_op_divu_i32: /* Optional (TCG_TARGET_HAS_div_i32). */ - case INDEX_op_rem_i32: /* Optional (TCG_TARGET_HAS_div_i32). */ - case INDEX_op_remu_i32: /* Optional (TCG_TARGET_HAS_div_i32). */ - tcg_out_r(s, args[0]); - tcg_out_r(s, args[1]); - tcg_out_r(s, args[2]); - break; + #if TCG_TARGET_REG_BITS == 32 case INDEX_op_add2_i32: case INDEX_op_sub2_i32:
@@ -584,31 +545,8 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, tcg_out_r(s, args[3]); break; #endif - case INDEX_op_brcond_i32: - tcg_out_r(s, args[0]); - tcg_out_r(s, args[1]); - tcg_out8(s, args[2]); /* condition */ - tci_out_label(s, arg_label(args[3])); - break; + case INDEX_op_qemu_ld_i32: - tcg_out_r(s, *args++); - tcg_out_r(s, *args++); - if (TARGET_LONG_BITS > TCG_TARGET_REG_BITS) { - tcg_out_r(s, *args++); - } - tcg_out_i(s, *args++); - break; - case INDEX_op_qemu_ld_i64: - tcg_out_r(s, *args++); - if (TCG_TARGET_REG_BITS == 32) { - tcg_out_r(s, *args++); - } - tcg_out_r(s, *args++); - if (TARGET_LONG_BITS > TCG_TARGET_REG_BITS) { - tcg_out_r(s, *args++); - } - tcg_out_i(s, *args++); - break; case INDEX_op_qemu_st_i32: tcg_out_r(s, *args++); tcg_out_r(s, *args++);
@@ -617,6 +555,8 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, } tcg_out_i(s, *args++); break; + + case INDEX_op_qemu_ld_i64: case INDEX_op_qemu_st_i64: tcg_out_r(s, *args++); if (TCG_TARGET_REG_BITS == 32) {
@@ -628,8 +568,10 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, } tcg_out_i(s, *args++); break; + case INDEX_op_mb: break; + case INDEX_op_mov_i32: /* Always emitted via tcg_out_mov. */ case INDEX_op_mov_i64: case INDEX_op_call: /* Always emitted via tcg_out_call. */
Signature · 1 line
2.25.1
Re: [PATCH v4 04/71] tcg/tci: Merge identical cases in generation
Quoted 7 lines · Richard Henderson
Use
CASE_32_64andCASE_64to reduce ifdefs and merge cases that are identical between 32-bit and 64-bit hosts.Signed-off-by Richard Henderson <[email protected]>--- tcg/tci/tcg-target.c.inc | 204 ++++++++++++++------------------------- 1 file changed, 73 insertions(+), 131 deletions(-)
But I had to split this patch to follow all the changes. I'll send as a separate series, so if you find it useful you can replace it.
PATCH v4 5/71 tcg/tci: Remove tci_read_r8
In reply to Richard HendersonUse explicit casts for ext8u opcodes, and allow truncation to happen with the store for st8 opcodes.
--- tcg/tci.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-)
tcg/tci.c +5 -18
@@ -78,11 +78,6 @@ static int32_t tci_read_reg32s(const tcg_target_ulong *regs, TCGReg index) }#endif -static uint8_t tci_read_reg8 (const tcg_target_ulong *regs,TCGReg index) -{ -return (uint8_t )tci_read_reg (regs, index); -} -static uint16_t tci_read_reg16 (const tcg_target_ulong *regs,TCGReg index) {return (uint16_t )tci_read_reg (regs, index);
@@ -169,14 +164,6 @@ tci_read_r(const tcg_target_ulong *regs, const uint8_t **tb_ptr)return value; } -/* Read indexed register (8 bit) from bytecode. */ -static uint8_t tci_read_r8 (const tcg_target_ulong *regs,const uint8_t **tb_ptr) -{ -uint8_t value =tci_read_reg8 (regs, **tb_ptr); - *tb_ptr +=1 ; -return value; -} -#if TCG_TARGET_HAS_ext8s_i32 || TCG_TARGET_HAS_ext8s_i64/* Read indexed register (8 bit signed) from bytecode. */ static int8_t tci_read_r8s (const tcg_target_ulong *regs,const uint8_t **tb_ptr)
@@ -533,7 +520,7 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,tci_write_reg (regs, t0, *(uint32_t *)(t1 + t2));break ;CASE_32_64 (st8) - t0 =tci_read_r8 (regs, &tb_ptr); + t0 =tci_read_r (regs, &tb_ptr); t1 =tci_read_r (regs, &tb_ptr); t2 =tci_read_s32 (&tb_ptr); *(uint8_t *)(t1 + t2) = t0;
@@ -722,8 +709,8 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,#if TCG_TARGET_HAS_ext8u_i32case INDEX_op_ext8u_i32: t0 = *tb_ptr++; - t1 =tci_read_r8 (regs, &tb_ptr); -tci_write_reg (regs, t0, t1); + t1 =tci_read_r (regs, &tb_ptr); +tci_write_reg (regs, t0, (uint8_t )t1);break ;#endif #if TCG_TARGET_HAS_ext16u_i32
@@ -916,8 +903,8 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,#if TCG_TARGET_HAS_ext8u_i64case INDEX_op_ext8u_i64: t0 = *tb_ptr++; - t1 =tci_read_r8 (regs, &tb_ptr); -tci_write_reg (regs, t0, t1); + t1 =tci_read_r (regs, &tb_ptr); +tci_write_reg (regs, t0, (uint8_t )t1);break ;#endif #if TCG_TARGET_HAS_ext8s_i64
Signature · 1 line
2.25.1
Re: [PATCH v4 05/71] tcg/tci: Remove tci_read_r8
Quoted 40 lines · Richard Henderson
Use explicit casts for ext8u opcodes, and allow truncation to happen with the store for st8 opcodes.
Signed-off-by Richard Henderson <[email protected]>--- tcg/tci.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-)tcg/tci.c +0
-13@@ -78,11 +78,6 @@ static int32_t tci_read_reg32s(const tcg_target_ulong *regs, TCGReg index) }#endif -static uint8_t tci_read_reg8 (const tcg_target_ulong *regs,TCGReg index) -{ -return (uint8_t )tci_read_reg (regs, index); -} -static uint16_t tci_read_reg16 (const tcg_target_ulong *regs,TCGReg index) {return (uint16_t )tci_read_reg (regs, index);@@ -169,14 +164,6 @@ tci_read_r(const tcg_target_ulong *regs, const uint8_t **tb_ptr)return value; } -/* Read indexed register (8 bit) from bytecode. */ -static uint8_t tci_read_r8 (const tcg_target_ulong *regs,const uint8_t **tb_ptr) -{ -uint8_t value =tci_read_reg8 (regs, **tb_ptr); - *tb_ptr +=1 ; -return value; -} -#if TCG_TARGET_HAS_ext8s_i32 || TCG_TARGET_HAS_ext8s_i64/* Read indexed register (8 bit signed) from bytecode. */ static int8_t tci_read_r8s (const tcg_target_ulong *regs,const uint8_t **tb_ptr)
tcg/tci.c uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, · line 523
Quoted 5 lines
tcg/tci.c +1
-1@@ -533,7 +520,7 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,tci_write_reg (regs, t0, *(uint32_t *)(t1 + t2));break ;CASE_32_64 (st8) - t0 =tci_read_r8 (regs, &tb_ptr); + t0 =tci_read_r (regs, &tb_ptr);
No need for tb_ptr++ here?
Quoted 26 lines
tcg/tci.c +4
-4t1 =tci_read_r (regs, &tb_ptr); t2 =tci_read_s32 (&tb_ptr); *(uint8_t *)(t1 + t2) = t0;@@ -722,8 +709,8 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,#if TCG_TARGET_HAS_ext8u_i32case INDEX_op_ext8u_i32: t0 = *tb_ptr++; - t1 =tci_read_r8 (regs, &tb_ptr); -tci_write_reg (regs, t0, t1); + t1 =tci_read_r (regs, &tb_ptr); +tci_write_reg (regs, t0, (uint8_t )t1);break ;#endif #if TCG_TARGET_HAS_ext16u_i32@@ -916,8 +903,8 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,#if TCG_TARGET_HAS_ext8u_i64case INDEX_op_ext8u_i64: t0 = *tb_ptr++; - t1 =tci_read_r8 (regs, &tb_ptr); -tci_write_reg (regs, t0, t1); + t1 =tci_read_r (regs, &tb_ptr); +tci_write_reg (regs, t0, (uint8_t )t1);break ;#endif #if TCG_TARGET_HAS_ext8s_i64
Re: [PATCH v4 05/71] tcg/tci: Remove tci_read_r8
Quoted 8 lines · Philippe Mathieu-Daudé
tcg/tci.c uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, · line 523
Quoted 6 lines
tcg/tci.c +1
-1@@ -533,7 +520,7 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,tci_write_reg (regs, t0, *(uint32_t *)(t1 + t2));break ;CASE_32_64 (st8) - t0 =tci_read_r8 (regs, &tb_ptr); + t0 =tci_read_r (regs, &tb_ptr);No need for tb_ptr++ here?
Done in tcg_read_b, called by tci_read_r.
r~
Philippe Mathieu-Daudé
Reviewed-byRe: [PATCH v4 05/71] tcg/tci: Remove tci_read_r8
Quoted 11 lines · Richard Henderson
Quoted 8 lines · Philippe Mathieu-Daudé
tcg/tci.c uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, · line 523
Quoted 6 lines
tcg/tci.c +1
-1@@ -533,7 +520,7 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,tci_write_reg (regs, t0, *(uint32_t *)(t1 + t2));break ;CASE_32_64 (st8) - t0 =tci_read_r8 (regs, &tb_ptr); + t0 =tci_read_r (regs, &tb_ptr);No need for tb_ptr++ here?
Done in
tcg_read_b, called bytci_read_r.
Doh I missed it is done in tci_read_r() indeed.
PATCH v4 6/71 tcg/tci: Remove tci_read_r8s
In reply to Richard HendersonUse explicit casts for ext8s opcodes.
--- tcg/tci.c | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-)
tcg/tci.c +4 -21
@@ -57,13 +57,6 @@ static tcg_target_ulong tci_read_reg(const tcg_target_ulong *regs, TCGReg index)return regs[index]; } -#if TCG_TARGET_HAS_ext8s_i32 || TCG_TARGET_HAS_ext8s_i64 -static int8_t tci_read_reg8s (const tcg_target_ulong *regs,TCGReg index) -{ -return (int8_t )tci_read_reg (regs, index); -} -#endif -#if TCG_TARGET_HAS_ext16s_i32 || TCG_TARGET_HAS_ext16s_i64static int16_t tci_read_reg16s (const tcg_target_ulong *regs,TCGReg index) {
@@ -164,16 +157,6 @@ tci_read_r(const tcg_target_ulong *regs, const uint8_t **tb_ptr)return value; } -#if TCG_TARGET_HAS_ext8s_i32 || TCG_TARGET_HAS_ext8s_i64 -/* Read indexed register (8 bit signed) from bytecode. */ -static int8_t tci_read_r8s (const tcg_target_ulong *regs,const uint8_t **tb_ptr) -{ -int8_t value =tci_read_reg8s (regs, **tb_ptr); - *tb_ptr +=1 ; -return value; -} -#endif -/* Read indexed register (16 bit) from bytecode. */ static uint16_t tci_read_r16 (const tcg_target_ulong *regs,const uint8_t **tb_ptr)
@@ -695,8 +678,8 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,#if TCG_TARGET_HAS_ext8s_i32case INDEX_op_ext8s_i32: t0 = *tb_ptr++; - t1 =tci_read_r8s (regs, &tb_ptr); -tci_write_reg (regs, t0, t1); + t1 =tci_read_r (regs, &tb_ptr); +tci_write_reg (regs, t0, (int8_t )t1);break ;#endif #if TCG_TARGET_HAS_ext16s_i32
@@ -910,8 +893,8 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,#if TCG_TARGET_HAS_ext8s_i64case INDEX_op_ext8s_i64: t0 = *tb_ptr++; - t1 =tci_read_r8s (regs, &tb_ptr); -tci_write_reg (regs, t0, t1); + t1 =tci_read_r (regs, &tb_ptr); +tci_write_reg (regs, t0, (int8_t )t1);break ;#endif #if TCG_TARGET_HAS_ext16s_i64
Signature · 1 line
2.25.1
Re: [PATCH v4 06/71] tcg/tci: Remove tci_read_r8s
Quoted 6 lines · Richard Henderson
Use explicit casts for ext8s opcodes.
Signed-off-by Richard Henderson <[email protected]>--- tcg/tci.c | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-)
PATCH v4 7/71 tcg/tci: Remove tci_read_r16
In reply to Richard HendersonUse explicit casts for ext16u opcodes, and allow truncation to happen with the store for st16 opcodes, and with the call for bswap16 opcodes.
--- tcg/tci.c | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-)
tcg/tci.c +7 -21
@@ -71,11 +71,6 @@ static int32_t tci_read_reg32s(const tcg_target_ulong *regs, TCGReg index) }#endif -static uint16_t tci_read_reg16 (const tcg_target_ulong *regs,TCGReg index) -{ -return (uint16_t )tci_read_reg (regs, index); -} -static uint32_t tci_read_reg32 (const tcg_target_ulong *regs,TCGReg index) {return (uint32_t )tci_read_reg (regs, index);
@@ -157,15 +152,6 @@ tci_read_r(const tcg_target_ulong *regs, const uint8_t **tb_ptr)return value; } -/* Read indexed register (16 bit) from bytecode. */ -static uint16_t tci_read_r16 (const tcg_target_ulong *regs, -const uint8_t **tb_ptr) -{ -uint16_t value =tci_read_reg16 (regs, **tb_ptr); - *tb_ptr +=1 ; -return value; -} -#if TCG_TARGET_HAS_ext16s_i32 || TCG_TARGET_HAS_ext16s_i64/* Read indexed register (16 bit signed) from bytecode. */ static int16_t tci_read_r16s(const tcg_target_ulong *regs,
@@ -509,7 +495,7 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, *(uint8_t *)(t1 + t2) = t0;break ;CASE_32_64 (st16) - t0 =tci_read_r16 (regs, &tb_ptr); + t0 =tci_read_r (regs, &tb_ptr); t1 =tci_read_r (regs, &tb_ptr); t2 =tci_read_s32 (&tb_ptr); *(uint16_t *)(t1 + t2) = t0;
@@ -699,14 +685,14 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,#if TCG_TARGET_HAS_ext16u_i32case INDEX_op_ext16u_i32: t0 = *tb_ptr++; - t1 =tci_read_r16 (regs, &tb_ptr); -tci_write_reg (regs, t0, t1); + t1 =tci_read_r (regs, &tb_ptr); +tci_write_reg (regs, t0, (uint16_t )t1);break ;#endif #if TCG_TARGET_HAS_bswap16_i32case INDEX_op_bswap16_i32: t0 = *tb_ptr++; - t1 =tci_read_r16 (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0,bswap16 (t1));break ;#endif
@@ -907,8 +893,8 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,#if TCG_TARGET_HAS_ext16u_i64case INDEX_op_ext16u_i64: t0 = *tb_ptr++; - t1 =tci_read_r16 (regs, &tb_ptr); -tci_write_reg (regs, t0, t1); + t1 =tci_read_r (regs, &tb_ptr); +tci_write_reg (regs, t0, (uint16_t )t1);break ;#endif #if TCG_TARGET_HAS_ext32s_i64
@@ -930,7 +916,7 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,#if TCG_TARGET_HAS_bswap16_i64case INDEX_op_bswap16_i64: t0 = *tb_ptr++; - t1 =tci_read_r16 (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0,bswap16 (t1));break ;#endif
Signature · 1 line
2.25.1
Re: [PATCH v4 07/71] tcg/tci: Remove tci_read_r16
Quoted 8 lines · Richard Henderson
Use explicit casts for ext16u opcodes, and allow truncation to happen with the store for st16 opcodes, and with the call for bswap16 opcodes.
Signed-off-by Richard Henderson <[email protected]>--- tcg/tci.c | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-)
PATCH v4 8/71 tcg/tci: Remove tci_read_r16s
In reply to Richard HendersonUse explicit casts for ext16s opcodes.
--- tcg/tci.c | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-)
tcg/tci.c +4 -22
@@ -57,13 +57,6 @@ static tcg_target_ulong tci_read_reg(const tcg_target_ulong *regs, TCGReg index)return regs[index]; } -#if TCG_TARGET_HAS_ext16s_i32 || TCG_TARGET_HAS_ext16s_i64 -static int16_t tci_read_reg16s (const tcg_target_ulong *regs,TCGReg index) -{ -return (int16_t )tci_read_reg (regs, index); -} -#endif -#if TCG_TARGET_REG_BITS ==64 static int32_t tci_read_reg32s (const tcg_target_ulong *regs,TCGReg index) {
@@ -152,17 +145,6 @@ tci_read_r(const tcg_target_ulong *regs, const uint8_t **tb_ptr)return value; } -#if TCG_TARGET_HAS_ext16s_i32 || TCG_TARGET_HAS_ext16s_i64 -/* Read indexed register (16 bit signed) from bytecode. */ -static int16_t tci_read_r16s (const tcg_target_ulong *regs, -const uint8_t **tb_ptr) -{ -int16_t value =tci_read_reg16s (regs, **tb_ptr); - *tb_ptr +=1 ; -return value; -} -#endif -/* Read indexed register (32 bit) from bytecode. */ static uint32_t tci_read_r32 (const tcg_target_ulong *regs,const uint8_t **tb_ptr)
@@ -671,8 +653,8 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,#if TCG_TARGET_HAS_ext16s_i32case INDEX_op_ext16s_i32: t0 = *tb_ptr++; - t1 =tci_read_r16s (regs, &tb_ptr); -tci_write_reg (regs, t0, t1); + t1 =tci_read_r (regs, &tb_ptr); +tci_write_reg (regs, t0, (int16_t )t1);break ;#endif #if TCG_TARGET_HAS_ext8u_i32
@@ -886,8 +868,8 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,#if TCG_TARGET_HAS_ext16s_i64case INDEX_op_ext16s_i64: t0 = *tb_ptr++; - t1 =tci_read_r16s (regs, &tb_ptr); -tci_write_reg (regs, t0, t1); + t1 =tci_read_r (regs, &tb_ptr); +tci_write_reg (regs, t0, (int16_t )t1);break ;#endif #if TCG_TARGET_HAS_ext16u_i64
Signature · 1 line
2.25.1
Re: [PATCH v4 08/71] tcg/tci: Remove tci_read_r16s
Quoted 6 lines · Richard Henderson
Use explicit casts for ext16s opcodes.
Signed-off-by Richard Henderson <[email protected]>--- tcg/tci.c | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-)
PATCH v4 9/71 tcg/tci: Remove tci_read_r32
In reply to Richard HendersonUse explicit casts for ext32u opcodes, and allow truncation to happen for other users.
--- tcg/tci.c | 122 ++++++++++++++++++++++++------------------------------ 1 file changed, 54 insertions(+), 68 deletions(-)
tcg/tci.c +54 -68
@@ -64,11 +64,6 @@ static int32_t tci_read_reg32s(const tcg_target_ulong *regs, TCGReg index) }#endif -static uint32_t tci_read_reg32 (const tcg_target_ulong *regs,TCGReg index) -{ -return (uint32_t )tci_read_reg (regs, index); -} -#if TCG_TARGET_REG_BITS ==64 static uint64_t tci_read_reg64 (const tcg_target_ulong *regs,TCGReg index) {
@@ -145,22 +140,13 @@ tci_read_r(const tcg_target_ulong *regs, const uint8_t **tb_ptr)return value; } -/* Read indexed register (32 bit) from bytecode. */ -static uint32_t tci_read_r32 (const tcg_target_ulong *regs, -const uint8_t **tb_ptr) -{ -uint32_t value =tci_read_reg32 (regs, **tb_ptr); - *tb_ptr +=1 ; -return value; -} -#if TCG_TARGET_REG_BITS ==32 /* Read two indexed registers (2 * 32 bit) from bytecode. */ static uint64_t tci_read_r64 (const tcg_target_ulong *regs,const uint8_t **tb_ptr) { -uint32_t low =tci_read_r32 (regs, tb_ptr); -return tci_uint64 (tci_read_r32 (regs, tb_ptr), low); +uint32_t low =tci_read_r (regs, tb_ptr); +return tci_uint64 (tci_read_r (regs, tb_ptr), low); }#elif TCG_TARGET_REG_BITS ==64 /* Read indexed register (32 bit signed) from bytecode. */
@@ -404,8 +390,8 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,continue ;case INDEX_op_setcond_i32: t0 = *tb_ptr++; - t1 =tci_read_r32 (regs, &tb_ptr); - t2 =tci_read_r32 (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr); + t2 =tci_read_r (regs, &tb_ptr); condition = *tb_ptr++;tci_write_reg (regs, t0,tci_compare32 (t1, t2, condition));break ;
@@ -428,7 +414,7 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,#endif case INDEX_op_mov_i32: t0 = *tb_ptr++; - t1 =tci_read_r32 (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, t1);break ;case INDEX_op_tci_movi_i32:
@@ -484,7 +470,7 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,break ;case INDEX_op_st_i32:CASE_64 (st32) - t0 =tci_read_r32 (regs, &tb_ptr); + t0 =tci_read_r (regs, &tb_ptr); t1 =tci_read_r (regs, &tb_ptr); t2 =tci_read_s32 (&tb_ptr); *(uint32_t *)(t1 + t2) = t0;
@@ -494,62 +480,62 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,case INDEX_op_add_i32: t0 = *tb_ptr++; - t1 =tci_read_r32 (regs, &tb_ptr); - t2 =tci_read_r32 (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr); + t2 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, t1 + t2);break ;case INDEX_op_sub_i32: t0 = *tb_ptr++; - t1 =tci_read_r32 (regs, &tb_ptr); - t2 =tci_read_r32 (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr); + t2 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, t1 - t2);break ;case INDEX_op_mul_i32: t0 = *tb_ptr++; - t1 =tci_read_r32 (regs, &tb_ptr); - t2 =tci_read_r32 (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr); + t2 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, t1 * t2);break ;case INDEX_op_div_i32: t0 = *tb_ptr++; - t1 =tci_read_r32 (regs, &tb_ptr); - t2 =tci_read_r32 (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr); + t2 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, (int32_t )t1 / (int32_t )t2);break ;case INDEX_op_divu_i32: t0 = *tb_ptr++; - t1 =tci_read_r32 (regs, &tb_ptr); - t2 =tci_read_r32 (regs, &tb_ptr); -tci_write_reg (regs, t0, t1 / t2); + t1 =tci_read_r (regs, &tb_ptr); + t2 =tci_read_r (regs, &tb_ptr); +tci_write_reg (regs, t0, (uint32_t )t1 / (uint32_t )t2);break ;case INDEX_op_rem_i32: t0 = *tb_ptr++; - t1 =tci_read_r32 (regs, &tb_ptr); - t2 =tci_read_r32 (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr); + t2 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, (int32_t )t1 % (int32_t )t2);break ;case INDEX_op_remu_i32: t0 = *tb_ptr++; - t1 =tci_read_r32 (regs, &tb_ptr); - t2 =tci_read_r32 (regs, &tb_ptr); -tci_write_reg (regs, t0, t1 % t2); + t1 =tci_read_r (regs, &tb_ptr); + t2 =tci_read_r (regs, &tb_ptr); +tci_write_reg (regs, t0, (uint32_t )t1 % (uint32_t )t2);break ;case INDEX_op_and_i32: t0 = *tb_ptr++; - t1 =tci_read_r32 (regs, &tb_ptr); - t2 =tci_read_r32 (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr); + t2 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, t1 & t2);break ;case INDEX_op_or_i32: t0 = *tb_ptr++; - t1 =tci_read_r32 (regs, &tb_ptr); - t2 =tci_read_r32 (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr); + t2 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, t1 | t2);break ;case INDEX_op_xor_i32: t0 = *tb_ptr++; - t1 =tci_read_r32 (regs, &tb_ptr); - t2 =tci_read_r32 (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr); + t2 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, t1 ^ t2);break ;
@@ -557,41 +543,41 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,case INDEX_op_shl_i32: t0 = *tb_ptr++; - t1 =tci_read_r32 (regs, &tb_ptr); - t2 =tci_read_r32 (regs, &tb_ptr); -tci_write_reg (regs, t0, t1 << (t2 &31 )); + t1 =tci_read_r (regs, &tb_ptr); + t2 =tci_read_r (regs, &tb_ptr); +tci_write_reg (regs, t0, (uint32_t )t1 << (t2 &31 ));break ;case INDEX_op_shr_i32: t0 = *tb_ptr++; - t1 =tci_read_r32 (regs, &tb_ptr); - t2 =tci_read_r32 (regs, &tb_ptr); -tci_write_reg (regs, t0, t1 >> (t2 &31 )); + t1 =tci_read_r (regs, &tb_ptr); + t2 =tci_read_r (regs, &tb_ptr); +tci_write_reg (regs, t0, (uint32_t )t1 >> (t2 &31 ));break ;case INDEX_op_sar_i32: t0 = *tb_ptr++; - t1 =tci_read_r32 (regs, &tb_ptr); - t2 =tci_read_r32 (regs, &tb_ptr); -tci_write_reg (regs, t0, ((int32_t )t1 >> (t2 &31 ))); + t1 =tci_read_r (regs, &tb_ptr); + t2 =tci_read_r (regs, &tb_ptr); +tci_write_reg (regs, t0, (int32_t )t1 >> (t2 &31 ));break ;#if TCG_TARGET_HAS_rot_i32case INDEX_op_rotl_i32: t0 = *tb_ptr++; - t1 =tci_read_r32 (regs, &tb_ptr); - t2 =tci_read_r32 (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr); + t2 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0,rol32 (t1, t2 &31 ));break ;case INDEX_op_rotr_i32: t0 = *tb_ptr++; - t1 =tci_read_r32 (regs, &tb_ptr); - t2 =tci_read_r32 (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr); + t2 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0,ror32 (t1, t2 &31 ));break ;#endif #if TCG_TARGET_HAS_deposit_i32case INDEX_op_deposit_i32: t0 = *tb_ptr++; - t1 =tci_read_r32 (regs, &tb_ptr); - t2 =tci_read_r32 (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr); + t2 =tci_read_r (regs, &tb_ptr); tmp16 = *tb_ptr++; tmp8 = *tb_ptr++; tmp32 = (((1 << tmp8) -1 ) << tmp16);
@@ -599,8 +585,8 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,break ;#endif case INDEX_op_brcond_i32: - t0 =tci_read_r32 (regs, &tb_ptr); - t1 =tci_read_r32 (regs, &tb_ptr); + t0 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr); condition = *tb_ptr++; label =tci_read_label (&tb_ptr);if (tci_compare32 (t0, t1, condition)) {
@@ -638,9 +624,9 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,case INDEX_op_mulu2_i32: t0 = *tb_ptr++; t1 = *tb_ptr++; - t2 =tci_read_r32 (regs, &tb_ptr); - tmp64 =tci_read_r32 (regs, &tb_ptr); -tci_write_reg64 (regs, t1, t0, t2 * tmp64); + t2 =tci_read_r (regs, &tb_ptr); + tmp64 = (uint32_t )tci_read_r (regs, &tb_ptr); +tci_write_reg64 (regs, t1, t0, (uint32_t )t2 * tmp64);break ;#endif /* TCG_TARGET_REG_BITS == 32 */ #if TCG_TARGET_HAS_ext8s_i32
@@ -681,21 +667,21 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,#if TCG_TARGET_HAS_bswap32_i32case INDEX_op_bswap32_i32: t0 = *tb_ptr++; - t1 =tci_read_r32 (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0,bswap32 (t1));break ;#endif #if TCG_TARGET_HAS_not_i32case INDEX_op_not_i32: t0 = *tb_ptr++; - t1 =tci_read_r32 (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, ~t1);break ;#endif #if TCG_TARGET_HAS_neg_i32case INDEX_op_neg_i32: t0 = *tb_ptr++; - t1 =tci_read_r32 (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, -t1);break ;#endif
@@ -892,8 +878,8 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,#endif case INDEX_op_extu_i32_i64: t0 = *tb_ptr++; - t1 =tci_read_r32 (regs, &tb_ptr); -tci_write_reg (regs, t0, t1); + t1 =tci_read_r (regs, &tb_ptr); +tci_write_reg (regs, t0, (uint32_t )t1);break ;#if TCG_TARGET_HAS_bswap16_i64case INDEX_op_bswap16_i64:
@@ -905,7 +891,7 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,#if TCG_TARGET_HAS_bswap32_i64case INDEX_op_bswap32_i64: t0 = *tb_ptr++; - t1 =tci_read_r32 (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0,bswap32 (t1));break ;#endif
Signature · 1 line
2.25.1
Re: [PATCH v4 09/71] tcg/tci: Remove tci_read_r32
Quoted 7 lines · Richard Henderson
Use explicit casts for ext32u opcodes, and allow truncation to happen for other users.
Signed-off-by Richard Henderson <[email protected]>--- tcg/tci.c | 122 ++++++++++++++++++++++++------------------------------ 1 file changed, 54 insertions(+), 68 deletions(-)
PATCH v4 10/71 tcg/tci: Remove tci_read_r32s
In reply to Richard HendersonUse explicit casts for ext32s opcodes.
--- tcg/tci.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-)
tcg/tci.c +2 -18
@@ -57,13 +57,6 @@ static tcg_target_ulong tci_read_reg(const tcg_target_ulong *regs, TCGReg index)return regs[index]; } -#if TCG_TARGET_REG_BITS ==64 -static int32_t tci_read_reg32s (const tcg_target_ulong *regs,TCGReg index) -{ -return (int32_t )tci_read_reg (regs, index); -} -#endif -#if TCG_TARGET_REG_BITS ==64 static uint64_t tci_read_reg64 (const tcg_target_ulong *regs,TCGReg index) {
@@ -149,15 +142,6 @@ static uint64_t tci_read_r64(const tcg_target_ulong *regs, return tci_uint64(tci_read_r(regs, tb_ptr), low); }#elif TCG_TARGET_REG_BITS == 64 -/* Read indexed register (32 bit signed) from bytecode. */ -static int32_t tci_read_r32s (const tcg_target_ulong *regs, -const uint8_t **tb_ptr) -{ -int32_t value =tci_read_reg32s (regs, **tb_ptr); - *tb_ptr +=1 ; -return value; -} -/* Read indexed register (64 bit) from bytecode. */ static uint64_t tci_read_r64 (const tcg_target_ulong *regs,const uint8_t **tb_ptr)
@@ -870,8 +854,8 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,#endif case INDEX_op_ext_i32_i64: t0 = *tb_ptr++; - t1 =tci_read_r32s (regs, &tb_ptr); -tci_write_reg (regs, t0, t1); + t1 =tci_read_r (regs, &tb_ptr); +tci_write_reg (regs, t0, (int32_t )t1);break ;#if TCG_TARGET_HAS_ext32u_i64case INDEX_op_ext32u_i64:
Signature · 1 line
2.25.1
Re: [PATCH v4 10/71] tcg/tci: Remove tci_read_r32s
Quoted 6 lines · Richard Henderson
Use explicit casts for ext32s opcodes.
Signed-off-by Richard Henderson <[email protected]>--- tcg/tci.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-)
PATCH v4 11/71 tcg/tci: Reduce use of tci_read_r64
In reply to Richard HendersonIn all cases restricted to 64-bit hosts, tcg_read_r is identical. We retain the 64-bit symbol for the single case of INDEX_op_qemu_st_i64.
--- tcg/tci.c | 93 +++++++++++++++++++++++++------------------------------ 1 file changed, 42 insertions(+), 51 deletions(-)
tcg/tci.c +42 -51
@@ -57,13 +57,6 @@ static tcg_target_ulong tci_read_reg(const tcg_target_ulong *regs, TCGReg index)return regs[index]; } -#if TCG_TARGET_REG_BITS ==64 -static uint64_t tci_read_reg64 (const tcg_target_ulong *regs,TCGReg index) -{ -return tci_read_reg (regs, index); -} -#endif -static void tci_write_reg (tcg_target_ulong *regs,TCGReg index,tcg_target_ulong value) {
@@ -146,9 +139,7 @@ static uint64_t tci_read_r64(const tcg_target_ulong *regs,static uint64_t tci_read_r64 (const tcg_target_ulong *regs,const uint8_t **tb_ptr) { -uint64_t value =tci_read_reg64 (regs, **tb_ptr); - *tb_ptr +=1 ; -return value; +return tci_read_r (regs, tb_ptr); }#endif
@@ -390,8 +381,8 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,#elif TCG_TARGET_REG_BITS ==64 case INDEX_op_setcond_i64: t0 = *tb_ptr++; - t1 =tci_read_r64 (regs, &tb_ptr); - t2 =tci_read_r64 (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr); + t2 =tci_read_r (regs, &tb_ptr); condition = *tb_ptr++;tci_write_reg (regs, t0,tci_compare64 (t1, t2, condition));break ;
@@ -672,7 +663,7 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,#if TCG_TARGET_REG_BITS ==64 case INDEX_op_mov_i64: t0 = *tb_ptr++; - t1 =tci_read_r64 (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, t1);break ;case INDEX_op_tci_movi_i64:
@@ -696,7 +687,7 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,tci_write_reg (regs, t0, *(uint64_t *)(t1 + t2));break ;case INDEX_op_st_i64: - t0 =tci_read_r64 (regs, &tb_ptr); + t0 =tci_read_r (regs, &tb_ptr); t1 =tci_read_r (regs, &tb_ptr); t2 =tci_read_s32 (&tb_ptr); *(uint64_t *)(t1 + t2) = t0;
@@ -706,62 +697,62 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,case INDEX_op_add_i64: t0 = *tb_ptr++; - t1 =tci_read_r64 (regs, &tb_ptr); - t2 =tci_read_r64 (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr); + t2 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, t1 + t2);break ;case INDEX_op_sub_i64: t0 = *tb_ptr++; - t1 =tci_read_r64 (regs, &tb_ptr); - t2 =tci_read_r64 (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr); + t2 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, t1 - t2);break ;case INDEX_op_mul_i64: t0 = *tb_ptr++; - t1 =tci_read_r64 (regs, &tb_ptr); - t2 =tci_read_r64 (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr); + t2 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, t1 * t2);break ;case INDEX_op_div_i64: t0 = *tb_ptr++; - t1 =tci_read_r64 (regs, &tb_ptr); - t2 =tci_read_r64 (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr); + t2 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, (int64_t )t1 / (int64_t )t2);break ;case INDEX_op_divu_i64: t0 = *tb_ptr++; - t1 =tci_read_r64 (regs, &tb_ptr); - t2 =tci_read_r64 (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr); + t2 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, (uint64_t )t1 / (uint64_t )t2);break ;case INDEX_op_rem_i64: t0 = *tb_ptr++; - t1 =tci_read_r64 (regs, &tb_ptr); - t2 =tci_read_r64 (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr); + t2 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, (int64_t )t1 % (int64_t )t2);break ;case INDEX_op_remu_i64: t0 = *tb_ptr++; - t1 =tci_read_r64 (regs, &tb_ptr); - t2 =tci_read_r64 (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr); + t2 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, (uint64_t )t1 % (uint64_t )t2);break ;case INDEX_op_and_i64: t0 = *tb_ptr++; - t1 =tci_read_r64 (regs, &tb_ptr); - t2 =tci_read_r64 (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr); + t2 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, t1 & t2);break ;case INDEX_op_or_i64: t0 = *tb_ptr++; - t1 =tci_read_r64 (regs, &tb_ptr); - t2 =tci_read_r64 (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr); + t2 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, t1 | t2);break ;case INDEX_op_xor_i64: t0 = *tb_ptr++; - t1 =tci_read_r64 (regs, &tb_ptr); - t2 =tci_read_r64 (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr); + t2 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, t1 ^ t2);break ;
@@ -769,41 +760,41 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,case INDEX_op_shl_i64: t0 = *tb_ptr++; - t1 =tci_read_r64 (regs, &tb_ptr); - t2 =tci_read_r64 (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr); + t2 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, t1 << (t2 &63 ));break ;case INDEX_op_shr_i64: t0 = *tb_ptr++; - t1 =tci_read_r64 (regs, &tb_ptr); - t2 =tci_read_r64 (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr); + t2 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, t1 >> (t2 &63 ));break ;case INDEX_op_sar_i64: t0 = *tb_ptr++; - t1 =tci_read_r64 (regs, &tb_ptr); - t2 =tci_read_r64 (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr); + t2 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, ((int64_t )t1 >> (t2 &63 )));break ;#if TCG_TARGET_HAS_rot_i64case INDEX_op_rotl_i64: t0 = *tb_ptr++; - t1 =tci_read_r64 (regs, &tb_ptr); - t2 =tci_read_r64 (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr); + t2 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0,rol64 (t1, t2 &63 ));break ;case INDEX_op_rotr_i64: t0 = *tb_ptr++; - t1 =tci_read_r64 (regs, &tb_ptr); - t2 =tci_read_r64 (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr); + t2 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0,ror64 (t1, t2 &63 ));break ;#endif #if TCG_TARGET_HAS_deposit_i64case INDEX_op_deposit_i64: t0 = *tb_ptr++; - t1 =tci_read_r64 (regs, &tb_ptr); - t2 =tci_read_r64 (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr); + t2 =tci_read_r (regs, &tb_ptr); tmp16 = *tb_ptr++; tmp8 = *tb_ptr++; tmp64 = (((1ULL << tmp8) -1 ) << tmp16);
@@ -811,8 +802,8 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,break ;#endif case INDEX_op_brcond_i64: - t0 =tci_read_r64 (regs, &tb_ptr); - t1 =tci_read_r64 (regs, &tb_ptr); + t0 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr); condition = *tb_ptr++; label =tci_read_label (&tb_ptr);if (tci_compare64 (t0, t1, condition)) {
@@ -882,21 +873,21 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,#if TCG_TARGET_HAS_bswap64_i64case INDEX_op_bswap64_i64: t0 = *tb_ptr++; - t1 =tci_read_r64 (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0,bswap64 (t1));break ;#endif #if TCG_TARGET_HAS_not_i64case INDEX_op_not_i64: t0 = *tb_ptr++; - t1 =tci_read_r64 (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, ~t1);break ;#endif #if TCG_TARGET_HAS_neg_i64case INDEX_op_neg_i64: t0 = *tb_ptr++; - t1 =tci_read_r64 (regs, &tb_ptr); + t1 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, -t1);break ;#endif
Signature · 1 line
2.25.1
Re: [PATCH v4 11/71] tcg/tci: Reduce use of tci_read_r64
Quoted 8 lines · Richard Henderson
In all cases restricted to 64-bit hosts,
tcg_read_ris identical. We retain the 64-bit symbol for the single case ofINDEX_op_qemu_st_i64.Signed-off-by Richard Henderson <[email protected]>--- tcg/tci.c | 93 +++++++++++++++++++++++++------------------------------ 1 file changed, 42 insertions(+), 51 deletions(-)
PATCH v4 12/71 tcg/tci: Merge basic arithmetic operations
In reply to Richard HendersonThis includes add, sub, mul, and, or, xor.
--- tcg/tci.c | 83 +++++++++++++++++-------------------------------------- 1 file changed, 25 insertions(+), 58 deletions(-)
tcg/tci.c +25 -58
@@ -451,26 +451,47 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, *(uint32_t *)(t1 + t2) = t0;break ; -/* Arithmetic operations (32 bit). */ +/* Arithmetic operations (mixed 32/64 bit). */ -case INDEX_op_add_i32: +CASE_32_64 (add) t0 = *tb_ptr++; t1 =tci_read_r (regs, &tb_ptr); t2 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, t1 + t2);break ; -case INDEX_op_sub_i32: +CASE_32_64 (sub) t0 = *tb_ptr++; t1 =tci_read_r (regs, &tb_ptr); t2 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, t1 - t2);break ; -case INDEX_op_mul_i32: +CASE_32_64 (mul) t0 = *tb_ptr++; t1 =tci_read_r (regs, &tb_ptr); t2 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, t1 * t2);break ; +CASE_32_64 (and) + t0 = *tb_ptr++; + t1 =tci_read_r (regs, &tb_ptr); + t2 =tci_read_r (regs, &tb_ptr); +tci_write_reg (regs, t0, t1 & t2); +break ; +CASE_32_64 (or) + t0 = *tb_ptr++; + t1 =tci_read_r (regs, &tb_ptr); + t2 =tci_read_r (regs, &tb_ptr); +tci_write_reg (regs, t0, t1 | t2); +break ; +CASE_32_64 (xor) + t0 = *tb_ptr++; + t1 =tci_read_r (regs, &tb_ptr); + t2 =tci_read_r (regs, &tb_ptr); +tci_write_reg (regs, t0, t1 ^ t2); +break ; + +/* Arithmetic operations (32 bit). */ +case INDEX_op_div_i32: t0 = *tb_ptr++; t1 =tci_read_r (regs, &tb_ptr);
@@ -495,24 +516,6 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, t2 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, (uint32_t )t1 % (uint32_t )t2);break ; -case INDEX_op_and_i32: - t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); - t2 =tci_read_r (regs, &tb_ptr); -tci_write_reg (regs, t0, t1 & t2); -break ; -case INDEX_op_or_i32: - t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); - t2 =tci_read_r (regs, &tb_ptr); -tci_write_reg (regs, t0, t1 | t2); -break ; -case INDEX_op_xor_i32: - t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); - t2 =tci_read_r (regs, &tb_ptr); -tci_write_reg (regs, t0, t1 ^ t2); -break ;/* Shift/rotate operations (32 bit). */
@@ -695,24 +698,6 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,/* Arithmetic operations (64 bit). */ -case INDEX_op_add_i64: - t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); - t2 =tci_read_r (regs, &tb_ptr); -tci_write_reg (regs, t0, t1 + t2); -break ; -case INDEX_op_sub_i64: - t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); - t2 =tci_read_r (regs, &tb_ptr); -tci_write_reg (regs, t0, t1 - t2); -break ; -case INDEX_op_mul_i64: - t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); - t2 =tci_read_r (regs, &tb_ptr); -tci_write_reg (regs, t0, t1 * t2); -break ;case INDEX_op_div_i64: t0 = *tb_ptr++; t1 =tci_read_r (regs, &tb_ptr);
@@ -737,24 +722,6 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, t2 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, (uint64_t )t1 % (uint64_t )t2);break ; -case INDEX_op_and_i64: - t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); - t2 =tci_read_r (regs, &tb_ptr); -tci_write_reg (regs, t0, t1 & t2); -break ; -case INDEX_op_or_i64: - t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); - t2 =tci_read_r (regs, &tb_ptr); -tci_write_reg (regs, t0, t1 | t2); -break ; -case INDEX_op_xor_i64: - t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); - t2 =tci_read_r (regs, &tb_ptr); -tci_write_reg (regs, t0, t1 ^ t2); -break ;/* Shift/rotate operations (64 bit). */
Signature · 1 line
2.25.1
Re: [PATCH v4 12/71] tcg/tci: Merge basic arithmetic operations
Quoted 6 lines · Richard Henderson
This includes add, sub, mul, and, or, xor.
Signed-off-by Richard Henderson <[email protected]>--- tcg/tci.c | 83 +++++++++++++++++-------------------------------------- 1 file changed, 25 insertions(+), 58 deletions(-)
PATCH v4 13/71 tcg/tci: Merge extension operations
In reply to Richard HendersonThis includes ext8s, ext8u, ext16s, ext16u.
--- tcg/tci.c | 44 ++++++++------------------------------------ 1 file changed, 8 insertions(+), 36 deletions(-)
tcg/tci.c +8 -36
@@ -607,29 +607,29 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,tci_write_reg64 (regs, t1, t0, (uint32_t )t2 * tmp64);break ;#endif /* TCG_TARGET_REG_BITS == 32 */ -#if TCG_TARGET_HAS_ext8s_i32 -case INDEX_op_ext8s_i32: +#if TCG_TARGET_HAS_ext8s_i32 || TCG_TARGET_HAS_ext8s_i64 +CASE_32_64 (ext8s) t0 = *tb_ptr++; t1 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, (int8_t )t1);break ;#endif -#if TCG_TARGET_HAS_ext16s_i32 -case INDEX_op_ext16s_i32: +#if TCG_TARGET_HAS_ext16s_i32 || TCG_TARGET_HAS_ext16s_i64 +CASE_32_64 (ext16s) t0 = *tb_ptr++; t1 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, (int16_t )t1);break ;#endif -#if TCG_TARGET_HAS_ext8u_i32 -case INDEX_op_ext8u_i32: +#if TCG_TARGET_HAS_ext8u_i32 || TCG_TARGET_HAS_ext8u_i64 +CASE_32_64 (ext8u) t0 = *tb_ptr++; t1 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, (uint8_t )t1);break ;#endif -#if TCG_TARGET_HAS_ext16u_i32 -case INDEX_op_ext16u_i32: +#if TCG_TARGET_HAS_ext16u_i32 || TCG_TARGET_HAS_ext16u_i64 +CASE_32_64 (ext16u) t0 = *tb_ptr++; t1 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, (uint16_t )t1);
@@ -779,34 +779,6 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,continue ; }break ; -#if TCG_TARGET_HAS_ext8u_i64 -case INDEX_op_ext8u_i64: - t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); -tci_write_reg (regs, t0, (uint8_t )t1); -break ; -#endif -#if TCG_TARGET_HAS_ext8s_i64 -case INDEX_op_ext8s_i64: - t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); -tci_write_reg (regs, t0, (int8_t )t1); -break ; -#endif -#if TCG_TARGET_HAS_ext16s_i64 -case INDEX_op_ext16s_i64: - t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); -tci_write_reg (regs, t0, (int16_t )t1); -break ; -#endif -#if TCG_TARGET_HAS_ext16u_i64 -case INDEX_op_ext16u_i64: - t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); -tci_write_reg (regs, t0, (uint16_t )t1); -break ; -#endif #if TCG_TARGET_HAS_ext32s_i64case INDEX_op_ext32s_i64:#endif
Signature · 1 line
2.25.1
Re: [PATCH v4 13/71] tcg/tci: Merge extension operations
Quoted 6 lines · Richard Henderson
This includes ext8s, ext8u, ext16s, ext16u.
Signed-off-by Richard Henderson <[email protected]>--- tcg/tci.c | 44 ++++++++------------------------------------ 1 file changed, 8 insertions(+), 36 deletions(-)
PATCH v4 14/71 tcg/tci: Remove ifdefs for TCG_TARGET_HAS_ext32[us]_i64
In reply to Richard HendersonThese operations are always available under different names:INDEX_op_ext_i32_i64 and INDEX_op_extu_i32_i64, so we remove no code with the ifdef.
--- tcg/tci.c | 4 ---- 1 file changed, 4 deletions(-)
tcg/tci.c +0 -4
@@ -779,17 +779,13 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,continue ; }break ; -#if TCG_TARGET_HAS_ext32s_i64case INDEX_op_ext32s_i64: -#endif case INDEX_op_ext_i32_i64: t0 = *tb_ptr++; t1 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, (int32_t )t1);break ; -#if TCG_TARGET_HAS_ext32u_i64case INDEX_op_ext32u_i64: -#endif case INDEX_op_extu_i32_i64: t0 = *tb_ptr++; t1 =tci_read_r (regs, &tb_ptr);
Signature · 1 line
2.25.1
PATCH v4 15/71 tcg/tci: Merge bswap operations
In reply to Richard HendersonThis includes bswap16 and bswap32.
--- tcg/tci.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-)
tcg/tci.c +4 -18
@@ -635,15 +635,15 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,tci_write_reg (regs, t0, (uint16_t )t1);break ;#endif -#if TCG_TARGET_HAS_bswap16_i32 -case INDEX_op_bswap16_i32: +#if TCG_TARGET_HAS_bswap16_i32 || TCG_TARGET_HAS_bswap16_i64 +CASE_32_64 (bswap16) t0 = *tb_ptr++; t1 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0,bswap16 (t1));break ;#endif -#if TCG_TARGET_HAS_bswap32_i32 -case INDEX_op_bswap32_i32: +#if TCG_TARGET_HAS_bswap32_i32 || TCG_TARGET_HAS_bswap32_i64 +CASE_32_64 (bswap32) t0 = *tb_ptr++; t1 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0,bswap32 (t1));
@@ -791,20 +791,6 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, t1 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, (uint32_t )t1);break ; -#if TCG_TARGET_HAS_bswap16_i64 -case INDEX_op_bswap16_i64: - t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); -tci_write_reg (regs, t0,bswap16 (t1)); -break ; -#endif -#if TCG_TARGET_HAS_bswap32_i64 -case INDEX_op_bswap32_i64: - t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); -tci_write_reg (regs, t0,bswap32 (t1)); -break ; -#endif #if TCG_TARGET_HAS_bswap64_i64case INDEX_op_bswap64_i64: t0 = *tb_ptr++;
Signature · 1 line
2.25.1
Re: [PATCH v4 15/71] tcg/tci: Merge bswap operations
Quoted 6 lines · Richard Henderson
This includes bswap16 and bswap32.
Signed-off-by Richard Henderson <[email protected]>--- tcg/tci.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-)
PATCH v4 16/71 tcg/tci: Merge mov, not and neg operations
In reply to Richard Henderson--- tcg/tci.c | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-)
tcg/tci.c +5 -24
@@ -387,7 +387,7 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,tci_write_reg (regs, t0,tci_compare64 (t1, t2, condition));break ;#endif -case INDEX_op_mov_i32: +CASE_32_64 (mov) t0 = *tb_ptr++; t1 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, t1);
@@ -649,26 +649,21 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,tci_write_reg (regs, t0,bswap32 (t1));break ;#endif -#if TCG_TARGET_HAS_not_i32 -case INDEX_op_not_i32: +#if TCG_TARGET_HAS_not_i32 || TCG_TARGET_HAS_not_i64 +CASE_32_64 (not) t0 = *tb_ptr++; t1 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, ~t1);break ;#endif -#if TCG_TARGET_HAS_neg_i32 -case INDEX_op_neg_i32: +#if TCG_TARGET_HAS_neg_i32 || TCG_TARGET_HAS_neg_i64 +CASE_32_64 (neg) t0 = *tb_ptr++; t1 =tci_read_r (regs, &tb_ptr);tci_write_reg (regs, t0, -t1);break ;#endif #if TCG_TARGET_REG_BITS ==64 -case INDEX_op_mov_i64: - t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); -tci_write_reg (regs, t0, t1); -break ;case INDEX_op_tci_movi_i64: t0 = *tb_ptr++; t1 =tci_read_i64 (&tb_ptr);
@@ -798,20 +793,6 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,tci_write_reg (regs, t0,bswap64 (t1));break ;#endif -#if TCG_TARGET_HAS_not_i64 -case INDEX_op_not_i64: - t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); -tci_write_reg (regs, t0, ~t1); -break ; -#endif -#if TCG_TARGET_HAS_neg_i64 -case INDEX_op_neg_i64: - t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); -tci_write_reg (regs, t0, -t1); -break ; -#endif #endif /* TCG_TARGET_REG_BITS == 64 */ /* QEMU specific operations. */
Signature · 1 line
2.25.1
Re: [PATCH v4 16/71] tcg/tci: Merge mov, not and neg operations
Quoted 4 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>--- tcg/tci.c | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-)
PATCH v4 17/71 tcg/tci: Rename tci_read_r to tci_read_rval
In reply to Richard HendersonIn the next patches, we want to use tci_read_r to return the raw register number. So rename the existing function, which returns the register value, to tci_read_rval.
--- tcg/tci.c | 192 +++++++++++++++++++++++++++--------------------------- 1 file changed, 96 insertions(+), 96 deletions(-)
tcg/tci.c +96 -96
@@ -119,7 +119,7 @@ static uint64_t tci_read_i64(const uint8_t **tb_ptr)/* Read indexed register (native size) from bytecode. */ static tcg_target_ulong -tci_read_r (const tcg_target_ulong *regs,const uint8_t **tb_ptr) +tci_read_rval (const tcg_target_ulong *regs,const uint8_t **tb_ptr) {tcg_target_ulong value =tci_read_reg (regs, **tb_ptr); *tb_ptr +=1 ;
@@ -131,15 +131,15 @@ tci_read_r(const tcg_target_ulong *regs, const uint8_t **tb_ptr)static uint64_t tci_read_r64 (const tcg_target_ulong *regs,const uint8_t **tb_ptr) { -uint32_t low =tci_read_r (regs, tb_ptr); -return tci_uint64 (tci_read_r (regs, tb_ptr), low); +uint32_t low =tci_read_rval (regs, tb_ptr); +return tci_uint64 (tci_read_rval (regs, tb_ptr), low); }#elif TCG_TARGET_REG_BITS ==64 /* Read indexed register (64 bit) from bytecode. */ static uint64_t tci_read_r64 (const tcg_target_ulong *regs,const uint8_t **tb_ptr) { -return tci_read_r (regs, tb_ptr); +return tci_read_rval (regs, tb_ptr); }#endif
@@ -147,9 +147,9 @@ static uint64_t tci_read_r64(const tcg_target_ulong *regs,static target_ulong tci_read_ulong (const tcg_target_ulong *regs,const uint8_t **tb_ptr) { -target_ulong taddr =tci_read_r (regs, tb_ptr); +target_ulong taddr =tci_read_rval (regs, tb_ptr);#if TARGET_LONG_BITS >TCG_TARGET_REG_BITS - taddr += (uint64_t )tci_read_r (regs, tb_ptr) <<32 ; + taddr += (uint64_t )tci_read_rval (regs, tb_ptr) <<32 ;#endif return taddr; }
@@ -365,8 +365,8 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,continue ;case INDEX_op_setcond_i32: t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); - t2 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); + t2 =tci_read_rval (regs, &tb_ptr); condition = *tb_ptr++;tci_write_reg (regs, t0,tci_compare32 (t1, t2, condition));break ;
@@ -381,15 +381,15 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,#elif TCG_TARGET_REG_BITS ==64 case INDEX_op_setcond_i64: t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); - t2 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); + t2 =tci_read_rval (regs, &tb_ptr); condition = *tb_ptr++;tci_write_reg (regs, t0,tci_compare64 (t1, t2, condition));break ;#endif CASE_32_64 (mov) t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr);tci_write_reg (regs, t0, t1);break ;case INDEX_op_tci_movi_i32:
@@ -402,51 +402,51 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,CASE_32_64 (ld8u) t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); t2 =tci_read_s32 (&tb_ptr);tci_write_reg (regs, t0, *(uint8_t *)(t1 + t2));break ;CASE_32_64 (ld8s) t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); t2 =tci_read_s32 (&tb_ptr);tci_write_reg (regs, t0, *(int8_t *)(t1 + t2));break ;CASE_32_64 (ld16u) t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); t2 =tci_read_s32 (&tb_ptr);tci_write_reg (regs, t0, *(uint16_t *)(t1 + t2));break ;CASE_32_64 (ld16s) t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); t2 =tci_read_s32 (&tb_ptr);tci_write_reg (regs, t0, *(int16_t *)(t1 + t2));break ;case INDEX_op_ld_i32:CASE_64 (ld32u) t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); t2 =tci_read_s32 (&tb_ptr);tci_write_reg (regs, t0, *(uint32_t *)(t1 + t2));break ;CASE_32_64 (st8) - t0 =tci_read_r (regs, &tb_ptr); - t1 =tci_read_r (regs, &tb_ptr); + t0 =tci_read_rval (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); t2 =tci_read_s32 (&tb_ptr); *(uint8_t *)(t1 + t2) = t0;break ;CASE_32_64 (st16) - t0 =tci_read_r (regs, &tb_ptr); - t1 =tci_read_r (regs, &tb_ptr); + t0 =tci_read_rval (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); t2 =tci_read_s32 (&tb_ptr); *(uint16_t *)(t1 + t2) = t0;break ;case INDEX_op_st_i32:CASE_64 (st32) - t0 =tci_read_r (regs, &tb_ptr); - t1 =tci_read_r (regs, &tb_ptr); + t0 =tci_read_rval (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); t2 =tci_read_s32 (&tb_ptr); *(uint32_t *)(t1 + t2) = t0;break ;
@@ -455,38 +455,38 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,CASE_32_64 (add) t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); - t2 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); + t2 =tci_read_rval (regs, &tb_ptr);tci_write_reg (regs, t0, t1 + t2);break ;CASE_32_64 (sub) t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); - t2 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); + t2 =tci_read_rval (regs, &tb_ptr);tci_write_reg (regs, t0, t1 - t2);break ;CASE_32_64 (mul) t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); - t2 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); + t2 =tci_read_rval (regs, &tb_ptr);tci_write_reg (regs, t0, t1 * t2);break ;CASE_32_64 (and) t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); - t2 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); + t2 =tci_read_rval (regs, &tb_ptr);tci_write_reg (regs, t0, t1 & t2);break ;CASE_32_64 (or) t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); - t2 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); + t2 =tci_read_rval (regs, &tb_ptr);tci_write_reg (regs, t0, t1 | t2);break ;CASE_32_64 (xor) t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); - t2 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); + t2 =tci_read_rval (regs, &tb_ptr);tci_write_reg (regs, t0, t1 ^ t2);break ;
@@ -494,26 +494,26 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,case INDEX_op_div_i32: t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); - t2 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); + t2 =tci_read_rval (regs, &tb_ptr);tci_write_reg (regs, t0, (int32_t )t1 / (int32_t )t2);break ;case INDEX_op_divu_i32: t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); - t2 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); + t2 =tci_read_rval (regs, &tb_ptr);tci_write_reg (regs, t0, (uint32_t )t1 / (uint32_t )t2);break ;case INDEX_op_rem_i32: t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); - t2 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); + t2 =tci_read_rval (regs, &tb_ptr);tci_write_reg (regs, t0, (int32_t )t1 % (int32_t )t2);break ;case INDEX_op_remu_i32: t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); - t2 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); + t2 =tci_read_rval (regs, &tb_ptr);tci_write_reg (regs, t0, (uint32_t )t1 % (uint32_t )t2);break ;
@@ -521,41 +521,41 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,case INDEX_op_shl_i32: t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); - t2 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); + t2 =tci_read_rval (regs, &tb_ptr);tci_write_reg (regs, t0, (uint32_t )t1 << (t2 &31 ));break ;case INDEX_op_shr_i32: t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); - t2 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); + t2 =tci_read_rval (regs, &tb_ptr);tci_write_reg (regs, t0, (uint32_t )t1 >> (t2 &31 ));break ;case INDEX_op_sar_i32: t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); - t2 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); + t2 =tci_read_rval (regs, &tb_ptr);tci_write_reg (regs, t0, (int32_t )t1 >> (t2 &31 ));break ;#if TCG_TARGET_HAS_rot_i32case INDEX_op_rotl_i32: t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); - t2 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); + t2 =tci_read_rval (regs, &tb_ptr);tci_write_reg (regs, t0,rol32 (t1, t2 &31 ));break ;case INDEX_op_rotr_i32: t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); - t2 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); + t2 =tci_read_rval (regs, &tb_ptr);tci_write_reg (regs, t0,ror32 (t1, t2 &31 ));break ;#endif #if TCG_TARGET_HAS_deposit_i32case INDEX_op_deposit_i32: t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); - t2 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); + t2 =tci_read_rval (regs, &tb_ptr); tmp16 = *tb_ptr++; tmp8 = *tb_ptr++; tmp32 = (((1 << tmp8) -1 ) << tmp16);
@@ -563,8 +563,8 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,break ;#endif case INDEX_op_brcond_i32: - t0 =tci_read_r (regs, &tb_ptr); - t1 =tci_read_r (regs, &tb_ptr); + t0 =tci_read_rval (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); condition = *tb_ptr++; label =tci_read_label (&tb_ptr);if (tci_compare32 (t0, t1, condition)) {
@@ -602,64 +602,64 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,case INDEX_op_mulu2_i32: t0 = *tb_ptr++; t1 = *tb_ptr++; - t2 =tci_read_r (regs, &tb_ptr); - tmp64 = (uint32_t )tci_read_r (regs, &tb_ptr); + t2 =tci_read_rval (regs, &tb_ptr); + tmp64 = (uint32_t )tci_read_rval (regs, &tb_ptr);tci_write_reg64 (regs, t1, t0, (uint32_t )t2 * tmp64);break ;#endif /* TCG_TARGET_REG_BITS == 32 */ #if TCG_TARGET_HAS_ext8s_i32 || TCG_TARGET_HAS_ext8s_i64CASE_32_64 (ext8s) t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr);tci_write_reg (regs, t0, (int8_t )t1);break ;#endif #if TCG_TARGET_HAS_ext16s_i32 || TCG_TARGET_HAS_ext16s_i64CASE_32_64 (ext16s) t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr);tci_write_reg (regs, t0, (int16_t )t1);break ;#endif #if TCG_TARGET_HAS_ext8u_i32 || TCG_TARGET_HAS_ext8u_i64CASE_32_64 (ext8u) t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr);tci_write_reg (regs, t0, (uint8_t )t1);break ;#endif #if TCG_TARGET_HAS_ext16u_i32 || TCG_TARGET_HAS_ext16u_i64CASE_32_64 (ext16u) t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr);tci_write_reg (regs, t0, (uint16_t )t1);break ;#endif #if TCG_TARGET_HAS_bswap16_i32 || TCG_TARGET_HAS_bswap16_i64CASE_32_64 (bswap16) t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr);tci_write_reg (regs, t0,bswap16 (t1));break ;#endif #if TCG_TARGET_HAS_bswap32_i32 || TCG_TARGET_HAS_bswap32_i64CASE_32_64 (bswap32) t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr);tci_write_reg (regs, t0,bswap32 (t1));break ;#endif #if TCG_TARGET_HAS_not_i32 || TCG_TARGET_HAS_not_i64CASE_32_64 (not) t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr);tci_write_reg (regs, t0, ~t1);break ;#endif #if TCG_TARGET_HAS_neg_i32 || TCG_TARGET_HAS_neg_i64CASE_32_64 (neg) t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr);tci_write_reg (regs, t0, -t1);break ;#endif
@@ -674,19 +674,19 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,case INDEX_op_ld32s_i64: t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); t2 =tci_read_s32 (&tb_ptr);tci_write_reg (regs, t0, *(int32_t *)(t1 + t2));break ;case INDEX_op_ld_i64: t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); t2 =tci_read_s32 (&tb_ptr);tci_write_reg (regs, t0, *(uint64_t *)(t1 + t2));break ;case INDEX_op_st_i64: - t0 =tci_read_r (regs, &tb_ptr); - t1 =tci_read_r (regs, &tb_ptr); + t0 =tci_read_rval (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); t2 =tci_read_s32 (&tb_ptr); *(uint64_t *)(t1 + t2) = t0;break ;
@@ -695,26 +695,26 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,case INDEX_op_div_i64: t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); - t2 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); + t2 =tci_read_rval (regs, &tb_ptr);tci_write_reg (regs, t0, (int64_t )t1 / (int64_t )t2);break ;case INDEX_op_divu_i64: t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); - t2 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); + t2 =tci_read_rval (regs, &tb_ptr);tci_write_reg (regs, t0, (uint64_t )t1 / (uint64_t )t2);break ;case INDEX_op_rem_i64: t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); - t2 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); + t2 =tci_read_rval (regs, &tb_ptr);tci_write_reg (regs, t0, (int64_t )t1 % (int64_t )t2);break ;case INDEX_op_remu_i64: t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); - t2 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); + t2 =tci_read_rval (regs, &tb_ptr);tci_write_reg (regs, t0, (uint64_t )t1 % (uint64_t )t2);break ;
@@ -722,41 +722,41 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,case INDEX_op_shl_i64: t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); - t2 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); + t2 =tci_read_rval (regs, &tb_ptr);tci_write_reg (regs, t0, t1 << (t2 &63 ));break ;case INDEX_op_shr_i64: t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); - t2 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); + t2 =tci_read_rval (regs, &tb_ptr);tci_write_reg (regs, t0, t1 >> (t2 &63 ));break ;case INDEX_op_sar_i64: t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); - t2 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); + t2 =tci_read_rval (regs, &tb_ptr);tci_write_reg (regs, t0, ((int64_t )t1 >> (t2 &63 )));break ;#if TCG_TARGET_HAS_rot_i64case INDEX_op_rotl_i64: t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); - t2 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); + t2 =tci_read_rval (regs, &tb_ptr);tci_write_reg (regs, t0,rol64 (t1, t2 &63 ));break ;case INDEX_op_rotr_i64: t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); - t2 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); + t2 =tci_read_rval (regs, &tb_ptr);tci_write_reg (regs, t0,ror64 (t1, t2 &63 ));break ;#endif #if TCG_TARGET_HAS_deposit_i64case INDEX_op_deposit_i64: t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); - t2 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); + t2 =tci_read_rval (regs, &tb_ptr); tmp16 = *tb_ptr++; tmp8 = *tb_ptr++; tmp64 = (((1ULL << tmp8) -1 ) << tmp16);
@@ -764,8 +764,8 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,break ;#endif case INDEX_op_brcond_i64: - t0 =tci_read_r (regs, &tb_ptr); - t1 =tci_read_r (regs, &tb_ptr); + t0 =tci_read_rval (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr); condition = *tb_ptr++; label =tci_read_label (&tb_ptr);if (tci_compare64 (t0, t1, condition)) {
@@ -777,19 +777,19 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,case INDEX_op_ext32s_i64:case INDEX_op_ext_i32_i64: t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr);tci_write_reg (regs, t0, (int32_t )t1);break ;case INDEX_op_ext32u_i64:case INDEX_op_extu_i32_i64: t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr);tci_write_reg (regs, t0, (uint32_t )t1);break ;#if TCG_TARGET_HAS_bswap64_i64case INDEX_op_bswap64_i64: t0 = *tb_ptr++; - t1 =tci_read_r (regs, &tb_ptr); + t1 =tci_read_rval (regs, &tb_ptr);tci_write_reg (regs, t0,bswap64 (t1));break ;#endif
@@ -896,7 +896,7 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, }break ;case INDEX_op_qemu_st_i32: - t0 =tci_read_r (regs, &tb_ptr); + t0 =tci_read_rval (regs, &tb_ptr); taddr =tci_read_ulong (regs, &tb_ptr); oi =tci_read_i (&tb_ptr);switch (get_memop (oi) & (MO_BSWAP |MO_SIZE )) {
Signature · 1 line
2.25.1
PATCH v4 18/71 tcg/tci: Split out tci_args_rrs
In reply to Richard HendersonBegin splitting out functions that do pure argument decode, without actually loading values from the register set.
This means that decoding need not concern itself between input and output registers. We can assert that the register number is in range during decode, so that it is safe to simply dereference from regs[] later.
--- tcg/tci.c | 111 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 67 insertions(+), 44 deletions(-)
tcg/tci.c +67 -44
@@ -83,6 +83,20 @@ static uint64_t tci_uint64(uint32_t high, uint32_t low) }#endif +/* Read constant byte from bytecode. */ +static uint8_t tci_read_b (const uint8_t **tb_ptr) +{ +return *(tb_ptr[0 ]++); +} + +/* Read register number from bytecode. */ +static TCGReg tci_read_r (const uint8_t **tb_ptr) +{ +uint8_t regno =tci_read_b (tb_ptr); +tci_assert (regno <TCG_TARGET_NB_REGS ); +return regno; +} +/* Read constant (native size) from bytecode. */ static tcg_target_ulong tci_read_i (const uint8_t **tb_ptr) {
@@ -161,6 +175,23 @@ static tcg_target_ulong tci_read_label(const uint8_t **tb_ptr)return label; } +/* +* Load sets of arguments all at once. The naming convention is: +* tci_args_<arguments> +* where arguments is a sequence of +* +* r = register +* s = signed ldst offset +*/ + +static void tci_args_rrs (const uint8_t **tb_ptr, +TCGReg *r0,TCGReg *r1,int32_t *i2) +{ + *r0 =tci_read_r (tb_ptr); + *r1 =tci_read_r (tb_ptr); + *i2 =tci_read_s32 (tb_ptr); +} +static bool tci_compare32 (uint32_t u0,uint32_t u1,TCGCond condition) {bool result = false;
@@ -311,6 +342,7 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,uint8_t op_size = tb_ptr[1 ];const uint8_t *old_code_ptr = tb_ptr;#endif +TCGReg r0, r1;tcg_target_ulong t0;tcg_target_ulong t1;tcg_target_ulong t2;
@@ -325,6 +357,8 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,uint64_t v64;#endif TCGMemOpIdx oi; +int32_t ofs; +void *ptr;/* Skip opcode and size entry. */ tb_ptr +=2 ;
@@ -401,54 +435,46 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,/* Load/store operations (32 bit). */ CASE_32_64(ld8u) - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); - t2 =tci_read_s32 (&tb_ptr); -tci_write_reg (regs, t0, *(uint8_t *)(t1 + t2)); + tci_args_rrs(&tb_ptr, &r0, &r1, &ofs); + ptr = (void *)(regs[r1] + ofs); + regs[r0] = *(uint8_t *)ptr;break ; CASE_32_64(ld8s) - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); - t2 =tci_read_s32 (&tb_ptr); -tci_write_reg (regs, t0, *(int8_t *)(t1 + t2)); + tci_args_rrs(&tb_ptr, &r0, &r1, &ofs); + ptr = (void *)(regs[r1] + ofs); + regs[r0] = *(int8_t *)ptr;break ; CASE_32_64(ld16u) - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); - t2 =tci_read_s32 (&tb_ptr); -tci_write_reg (regs, t0, *(uint16_t *)(t1 + t2)); + tci_args_rrs(&tb_ptr, &r0, &r1, &ofs); + ptr = (void *)(regs[r1] + ofs); + regs[r0] = *(uint16_t *)ptr;break ; CASE_32_64(ld16s) - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); - t2 =tci_read_s32 (&tb_ptr); -tci_write_reg (regs, t0, *(int16_t *)(t1 + t2)); + tci_args_rrs(&tb_ptr, &r0, &r1, &ofs); + ptr = (void *)(regs[r1] + ofs); + regs[r0] = *(int16_t *)ptr;break ;case INDEX_op_ld_i32: CASE_64(ld32u) - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); - t2 =tci_read_s32 (&tb_ptr); -tci_write_reg (regs, t0, *(uint32_t *)(t1 + t2)); + tci_args_rrs(&tb_ptr, &r0, &r1, &ofs); + ptr = (void *)(regs[r1] + ofs); + regs[r0] = *(uint32_t *)ptr;break ; CASE_32_64(st8) - t0 =tci_read_rval (regs, &tb_ptr); - t1 =tci_read_rval (regs, &tb_ptr); - t2 =tci_read_s32 (&tb_ptr); - *(uint8_t *)(t1 + t2) = t0; + tci_args_rrs(&tb_ptr, &r0, &r1, &ofs); + ptr = (void *)(regs[r1] + ofs); + *(uint8_t *)ptr = regs[r0];break ; CASE_32_64(st16) - t0 =tci_read_rval (regs, &tb_ptr); - t1 =tci_read_rval (regs, &tb_ptr); - t2 =tci_read_s32 (&tb_ptr); - *(uint16_t *)(t1 + t2) = t0; + tci_args_rrs(&tb_ptr, &r0, &r1, &ofs); + ptr = (void *)(regs[r1] + ofs); + *(uint16_t *)ptr = regs[r0];break ;case INDEX_op_st_i32: CASE_64(st32) - t0 =tci_read_rval (regs, &tb_ptr); - t1 =tci_read_rval (regs, &tb_ptr); - t2 =tci_read_s32 (&tb_ptr); - *(uint32_t *)(t1 + t2) = t0; + tci_args_rrs(&tb_ptr, &r0, &r1, &ofs); + ptr = (void *)(regs[r1] + ofs); + *(uint32_t *)ptr = regs[r0];break ;/* Arithmetic operations (mixed 32/64 bit). */
@@ -673,22 +699,19 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,/* Load/store operations (64 bit). */ case INDEX_op_ld32s_i64: - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); - t2 =tci_read_s32 (&tb_ptr); -tci_write_reg (regs, t0, *(int32_t *)(t1 + t2)); +tci_args_rrs (&tb_ptr, &r0, &r1, &ofs); + ptr = (void *)(regs[r1] + ofs); + regs[r0] = *(int32_t *)ptr;break ;case INDEX_op_ld_i64: - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); - t2 =tci_read_s32 (&tb_ptr); -tci_write_reg (regs, t0, *(uint64_t *)(t1 + t2)); +tci_args_rrs (&tb_ptr, &r0, &r1, &ofs); + ptr = (void *)(regs[r1] + ofs); + regs[r0] = *(uint64_t *)ptr;break ;case INDEX_op_st_i64: - t0 =tci_read_rval (regs, &tb_ptr); - t1 =tci_read_rval (regs, &tb_ptr); - t2 =tci_read_s32 (&tb_ptr); - *(uint64_t *)(t1 + t2) = t0; +tci_args_rrs (&tb_ptr, &r0, &r1, &ofs); + ptr = (void *)(regs[r1] + ofs); + *(uint64_t *)ptr = regs[r0];break ;/* Arithmetic operations (64 bit). */
Signature · 1 line
2.25.1
PATCH v4 19/71 tcg/tci: Split out tci_args_rr
In reply to Richard Henderson--- tcg/tci.c | 67 +++++++++++++++++++++++++------------------------------ 1 file changed, 31 insertions(+), 36 deletions(-)
tcg/tci.c +31 -36
@@ -184,6 +184,13 @@ static tcg_target_ulong tci_read_label(const uint8_t **tb_ptr)* s = signed ldst offset */ +static void tci_args_rr (const uint8_t **tb_ptr, +TCGReg *r0,TCGReg *r1) +{ + *r0 =tci_read_r (tb_ptr); + *r1 =tci_read_r (tb_ptr); +} +static void tci_args_rrs (const uint8_t **tb_ptr,TCGReg *r0,TCGReg *r1,int32_t *i2) {
@@ -422,9 +429,8 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,break ;#endif CASE_32_64(mov) - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); -tci_write_reg (regs, t0, t1); + tci_args_rr(&tb_ptr, &r0, &r1); + regs[r0] = regs[r1];break ;case INDEX_op_tci_movi_i32: t0 = *tb_ptr++;
@@ -635,58 +641,50 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,#endif /* TCG_TARGET_REG_BITS == 32 */ #if TCG_TARGET_HAS_ext8s_i32 || TCG_TARGET_HAS_ext8s_i64 CASE_32_64(ext8s) - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); -tci_write_reg (regs, t0, (int8_t )t1); + tci_args_rr(&tb_ptr, &r0, &r1); + regs[r0] = (int8_t )regs[r1];break ;#endif #if TCG_TARGET_HAS_ext16s_i32 || TCG_TARGET_HAS_ext16s_i64 CASE_32_64(ext16s) - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); -tci_write_reg (regs, t0, (int16_t )t1); + tci_args_rr(&tb_ptr, &r0, &r1); + regs[r0] = (int16_t )regs[r1];break ;#endif #if TCG_TARGET_HAS_ext8u_i32 || TCG_TARGET_HAS_ext8u_i64 CASE_32_64(ext8u) - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); -tci_write_reg (regs, t0, (uint8_t )t1); + tci_args_rr(&tb_ptr, &r0, &r1); + regs[r0] = (uint8_t )regs[r1];break ;#endif #if TCG_TARGET_HAS_ext16u_i32 || TCG_TARGET_HAS_ext16u_i64 CASE_32_64(ext16u) - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); -tci_write_reg (regs, t0, (uint16_t )t1); + tci_args_rr(&tb_ptr, &r0, &r1); + regs[r0] = (uint16_t )regs[r1];break ;#endif #if TCG_TARGET_HAS_bswap16_i32 || TCG_TARGET_HAS_bswap16_i64 CASE_32_64(bswap16) - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); -tci_write_reg (regs, t0,bswap16 (t1)); + tci_args_rr(&tb_ptr, &r0, &r1); + regs[r0] =bswap16 (regs[r1]);break ;#endif #if TCG_TARGET_HAS_bswap32_i32 || TCG_TARGET_HAS_bswap32_i64 CASE_32_64(bswap32) - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); -tci_write_reg (regs, t0,bswap32 (t1)); + tci_args_rr(&tb_ptr, &r0, &r1); + regs[r0] =bswap32 (regs[r1]);break ;#endif #if TCG_TARGET_HAS_not_i32 || TCG_TARGET_HAS_not_i64 CASE_32_64(not) - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); -tci_write_reg (regs, t0, ~t1); + tci_args_rr(&tb_ptr, &r0, &r1); + regs[r0] = ~regs[r1];break ;#endif #if TCG_TARGET_HAS_neg_i32 || TCG_TARGET_HAS_neg_i64 CASE_32_64(neg) - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); -tci_write_reg (regs, t0, -t1); + tci_args_rr(&tb_ptr, &r0, &r1); + regs[r0] = -regs[r1];break ;#endif #if TCG_TARGET_REG_BITS ==64
@@ -799,21 +797,18 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,break ;case INDEX_op_ext32s_i64:case INDEX_op_ext_i32_i64: - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); -tci_write_reg (regs, t0, (int32_t )t1); +tci_args_rr (&tb_ptr, &r0, &r1); + regs[r0] = (int32_t )regs[r1];break ;case INDEX_op_ext32u_i64:case INDEX_op_extu_i32_i64: - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); -tci_write_reg (regs, t0, (uint32_t )t1); +tci_args_rr (&tb_ptr, &r0, &r1); + regs[r0] = (uint32_t )regs[r1];break ;#if TCG_TARGET_HAS_bswap64_i64case INDEX_op_bswap64_i64: - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); -tci_write_reg (regs, t0,bswap64 (t1)); +tci_args_rr (&tb_ptr, &r0, &r1); + regs[r0] =bswap64 (regs[r1]);break ;#endif #endif /* TCG_TARGET_REG_BITS == 64 */
Signature · 1 line
2.25.1
PATCH v4 20/71 tcg/tci: Split out tci_args_rrr
In reply to Richard Henderson--- tcg/tci.c | 154 ++++++++++++++++++++---------------------------------- 1 file changed, 57 insertions(+), 97 deletions(-)
tcg/tci.c +57 -97
@@ -191,6 +191,14 @@ static void tci_args_rr(const uint8_t **tb_ptr, *r1 =tci_read_r (tb_ptr); } +static void tci_args_rrr (const uint8_t **tb_ptr, +TCGReg *r0,TCGReg *r1,TCGReg *r2) +{ + *r0 =tci_read_r (tb_ptr); + *r1 =tci_read_r (tb_ptr); + *r2 =tci_read_r (tb_ptr); +} +static void tci_args_rrs (const uint8_t **tb_ptr,TCGReg *r0,TCGReg *r1,int32_t *i2) {
@@ -349,7 +357,7 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,uint8_t op_size = tb_ptr[1 ];const uint8_t *old_code_ptr = tb_ptr;#endif -TCGReg r0, r1; +TCGReg r0, r1, r2;tcg_target_ulong t0;tcg_target_ulong t1;tcg_target_ulong t2;
@@ -486,101 +494,71 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,/* Arithmetic operations (mixed 32/64 bit). */ CASE_32_64(add) - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); - t2 =tci_read_rval (regs, &tb_ptr); -tci_write_reg (regs, t0, t1 + t2); + tci_args_rrr(&tb_ptr, &r0, &r1, &r2); + regs[r0] = regs[r1] + regs[r2];break ; CASE_32_64(sub) - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); - t2 =tci_read_rval (regs, &tb_ptr); -tci_write_reg (regs, t0, t1 - t2); + tci_args_rrr(&tb_ptr, &r0, &r1, &r2); + regs[r0] = regs[r1] - regs[r2];break ; CASE_32_64(mul) - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); - t2 =tci_read_rval (regs, &tb_ptr); -tci_write_reg (regs, t0, t1 * t2); + tci_args_rrr(&tb_ptr, &r0, &r1, &r2); + regs[r0] = regs[r1] * regs[r2];break ; CASE_32_64(and) - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); - t2 =tci_read_rval (regs, &tb_ptr); -tci_write_reg (regs, t0, t1 & t2); + tci_args_rrr(&tb_ptr, &r0, &r1, &r2); + regs[r0] = regs[r1] & regs[r2];break ; CASE_32_64(or) - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); - t2 =tci_read_rval (regs, &tb_ptr); -tci_write_reg (regs, t0, t1 | t2); + tci_args_rrr(&tb_ptr, &r0, &r1, &r2); + regs[r0] = regs[r1] | regs[r2];break ; CASE_32_64(xor) - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); - t2 =tci_read_rval (regs, &tb_ptr); -tci_write_reg (regs, t0, t1 ^ t2); + tci_args_rrr(&tb_ptr, &r0, &r1, &r2); + regs[r0] = regs[r1] ^ regs[r2];break ;/* Arithmetic operations (32 bit). */ case INDEX_op_div_i32: - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); - t2 =tci_read_rval (regs, &tb_ptr); -tci_write_reg (regs, t0, (int32_t )t1 / (int32_t )t2); +tci_args_rrr (&tb_ptr, &r0, &r1, &r2); + regs[r0] = (int32_t )regs[r1] / (int32_t )regs[r2];break ;case INDEX_op_divu_i32: - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); - t2 =tci_read_rval (regs, &tb_ptr); -tci_write_reg (regs, t0, (uint32_t )t1 / (uint32_t )t2); +tci_args_rrr (&tb_ptr, &r0, &r1, &r2); + regs[r0] = (uint32_t )regs[r1] / (uint32_t )regs[r2];break ;case INDEX_op_rem_i32: - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); - t2 =tci_read_rval (regs, &tb_ptr); -tci_write_reg (regs, t0, (int32_t )t1 % (int32_t )t2); +tci_args_rrr (&tb_ptr, &r0, &r1, &r2); + regs[r0] = (int32_t )regs[r1] % (int32_t )regs[r2];break ;case INDEX_op_remu_i32: - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); - t2 =tci_read_rval (regs, &tb_ptr); -tci_write_reg (regs, t0, (uint32_t )t1 % (uint32_t )t2); +tci_args_rrr (&tb_ptr, &r0, &r1, &r2); + regs[r0] = (uint32_t )regs[r1] % (uint32_t )regs[r2];break ;/* Shift/rotate operations (32 bit). */ case INDEX_op_shl_i32: - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); - t2 =tci_read_rval (regs, &tb_ptr); -tci_write_reg (regs, t0, (uint32_t )t1 << (t2 &31 )); +tci_args_rrr (&tb_ptr, &r0, &r1, &r2); + regs[r0] = (uint32_t )regs[r1] << (regs[r2] &31 );break ;case INDEX_op_shr_i32: - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); - t2 =tci_read_rval (regs, &tb_ptr); -tci_write_reg (regs, t0, (uint32_t )t1 >> (t2 &31 )); +tci_args_rrr (&tb_ptr, &r0, &r1, &r2); + regs[r0] = (uint32_t )regs[r1] >> (regs[r2] &31 );break ;case INDEX_op_sar_i32: - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); - t2 =tci_read_rval (regs, &tb_ptr); -tci_write_reg (regs, t0, (int32_t )t1 >> (t2 &31 )); +tci_args_rrr (&tb_ptr, &r0, &r1, &r2); + regs[r0] = (int32_t )regs[r1] >> (regs[r2] &31 );break ;#if TCG_TARGET_HAS_rot_i32case INDEX_op_rotl_i32: - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); - t2 =tci_read_rval (regs, &tb_ptr); -tci_write_reg (regs, t0,rol32 (t1, t2 &31 )); +tci_args_rrr (&tb_ptr, &r0, &r1, &r2); + regs[r0] =rol32 (regs[r1], regs[r2] &31 );break ;case INDEX_op_rotr_i32: - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); - t2 =tci_read_rval (regs, &tb_ptr); -tci_write_reg (regs, t0,ror32 (t1, t2 &31 )); +tci_args_rrr (&tb_ptr, &r0, &r1, &r2); + regs[r0] =ror32 (regs[r1], regs[r2] &31 );break ;#endif #if TCG_TARGET_HAS_deposit_i32
@@ -715,62 +693,44 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,/* Arithmetic operations (64 bit). */ case INDEX_op_div_i64: - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); - t2 =tci_read_rval (regs, &tb_ptr); -tci_write_reg (regs, t0, (int64_t )t1 / (int64_t )t2); +tci_args_rrr (&tb_ptr, &r0, &r1, &r2); + regs[r0] = (int64_t )regs[r1] / (int64_t )regs[r2];break ;case INDEX_op_divu_i64: - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); - t2 =tci_read_rval (regs, &tb_ptr); -tci_write_reg (regs, t0, (uint64_t )t1 / (uint64_t )t2); +tci_args_rrr (&tb_ptr, &r0, &r1, &r2); + regs[r0] = (uint64_t )regs[r1] / (uint64_t )regs[r2];break ;case INDEX_op_rem_i64: - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); - t2 =tci_read_rval (regs, &tb_ptr); -tci_write_reg (regs, t0, (int64_t )t1 % (int64_t )t2); +tci_args_rrr (&tb_ptr, &r0, &r1, &r2); + regs[r0] = (int64_t )regs[r1] % (int64_t )regs[r2];break ;case INDEX_op_remu_i64: - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); - t2 =tci_read_rval (regs, &tb_ptr); -tci_write_reg (regs, t0, (uint64_t )t1 % (uint64_t )t2); +tci_args_rrr (&tb_ptr, &r0, &r1, &r2); + regs[r0] = (uint64_t )regs[r1] % (uint64_t )regs[r2];break ;/* Shift/rotate operations (64 bit). */ case INDEX_op_shl_i64: - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); - t2 =tci_read_rval (regs, &tb_ptr); -tci_write_reg (regs, t0, t1 << (t2 &63 )); +tci_args_rrr (&tb_ptr, &r0, &r1, &r2); + regs[r0] = regs[r1] << (regs[r2] &63 );break ;case INDEX_op_shr_i64: - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); - t2 =tci_read_rval (regs, &tb_ptr); -tci_write_reg (regs, t0, t1 >> (t2 &63 )); +tci_args_rrr (&tb_ptr, &r0, &r1, &r2); + regs[r0] = regs[r1] >> (regs[r2] &63 );break ;case INDEX_op_sar_i64: - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); - t2 =tci_read_rval (regs, &tb_ptr); -tci_write_reg (regs, t0, ((int64_t )t1 >> (t2 &63 ))); +tci_args_rrr (&tb_ptr, &r0, &r1, &r2); + regs[r0] = (int64_t )regs[r1] >> (regs[r2] &63 );break ;#if TCG_TARGET_HAS_rot_i64case INDEX_op_rotl_i64: - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); - t2 =tci_read_rval (regs, &tb_ptr); -tci_write_reg (regs, t0,rol64 (t1, t2 &63 )); +tci_args_rrr (&tb_ptr, &r0, &r1, &r2); + regs[r0] =rol64 (regs[r1], regs[r2] &63 );break ;case INDEX_op_rotr_i64: - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); - t2 =tci_read_rval (regs, &tb_ptr); -tci_write_reg (regs, t0,ror64 (t1, t2 &63 )); +tci_args_rrr (&tb_ptr, &r0, &r1, &r2); + regs[r0] =ror64 (regs[r1], regs[r2] &63 );break ;#endif #if TCG_TARGET_HAS_deposit_i64
Signature · 1 line
2.25.1
PATCH v4 21/71 tcg/tci: Split out tci_args_rrrc
In reply to Richard Henderson--- tcg/tci.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
tcg/tci.c +13 -10
@@ -207,6 +207,15 @@ static void tci_args_rrs(const uint8_t **tb_ptr, *i2 =tci_read_s32 (tb_ptr); } +static void tci_args_rrrc (const uint8_t **tb_ptr, +TCGReg *r0,TCGReg *r1,TCGReg *r2,TCGCond *c3) +{ + *r0 =tci_read_r (tb_ptr); + *r1 =tci_read_r (tb_ptr); + *r2 =tci_read_r (tb_ptr); + *c3 =tci_read_b (tb_ptr); +} +static bool tci_compare32 (uint32_t u0,uint32_t u1,TCGCond condition) {bool result = false;
@@ -413,11 +422,8 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, tb_ptr = (uint8_t *)label;continue ;case INDEX_op_setcond_i32: - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); - t2 =tci_read_rval (regs, &tb_ptr); - condition = *tb_ptr++; -tci_write_reg (regs, t0,tci_compare32 (t1, t2, condition)); +tci_args_rrrc (&tb_ptr, &r0, &r1, &r2, &condition); + regs[r0] =tci_compare32 (regs[r1], regs[r2], condition);break ;#if TCG_TARGET_REG_BITS ==32 case INDEX_op_setcond2_i32:
@@ -429,11 +435,8 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,break ;#elif TCG_TARGET_REG_BITS ==64 case INDEX_op_setcond_i64: - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); - t2 =tci_read_rval (regs, &tb_ptr); - condition = *tb_ptr++; -tci_write_reg (regs, t0,tci_compare64 (t1, t2, condition)); +tci_args_rrrc (&tb_ptr, &r0, &r1, &r2, &condition); + regs[r0] =tci_compare64 (regs[r1], regs[r2], condition);break ;#endif CASE_32_64 (mov)
Signature · 1 line
2.25.1
PATCH v4 22/71 tcg/tci: Split out tci_args_l
In reply to Richard Henderson--- tcg/tci.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
tcg/tci.c +7 -2
@@ -184,6 +184,11 @@ static tcg_target_ulong tci_read_label(const uint8_t **tb_ptr)* s = signed ldst offset */ +static void tci_args_l (const uint8_t **tb_ptr,void **l0) +{ + *l0 = (void *)tci_read_label (tb_ptr); +} +static void tci_args_rr (const uint8_t **tb_ptr,TCGReg *r0,TCGReg *r1) {
@@ -417,9 +422,9 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,#endif break ;case INDEX_op_br: - label =tci_read_label (&tb_ptr); +tci_args_l (&tb_ptr, &ptr);tci_assert (tb_ptr == old_code_ptr + op_size); - tb_ptr = (uint8_t *)label; + tb_ptr = ptr;continue ;case INDEX_op_setcond_i32:tci_args_rrrc (&tb_ptr, &r0, &r1, &r2, &condition);
Signature · 1 line
2.25.1
PATCH v4 23/71 tcg/tci: Split out tci_args_rrrrrc
In reply to Richard Henderson--- tcg/tci.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)
tcg/tci.c +19 -6
@@ -221,6 +221,19 @@ static void tci_args_rrrc(const uint8_t **tb_ptr, *c3 =tci_read_b (tb_ptr); } +#if TCG_TARGET_REG_BITS ==32 +static void tci_args_rrrrrc (const uint8_t **tb_ptr,TCGReg *r0,TCGReg *r1, +TCGReg *r2,TCGReg *r3,TCGReg *r4,TCGCond *c5) +{ + *r0 =tci_read_r (tb_ptr); + *r1 =tci_read_r (tb_ptr); + *r2 =tci_read_r (tb_ptr); + *r3 =tci_read_r (tb_ptr); + *r4 =tci_read_r (tb_ptr); + *c5 =tci_read_b (tb_ptr); +} +#endif +static bool tci_compare32 (uint32_t u0,uint32_t u1,TCGCond condition) {bool result = false;
@@ -383,7 +396,8 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,uint32_t tmp32;uint64_t tmp64;#if TCG_TARGET_REG_BITS ==32 -uint64_t v64; +TCGReg r3, r4; +uint64_t v64,T1 ,T2 ;#endif TCGMemOpIdx oi;int32_t ofs;
@@ -432,11 +446,10 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,break ;#if TCG_TARGET_REG_BITS ==32 case INDEX_op_setcond2_i32: - t0 = *tb_ptr++; - tmp64 =tci_read_r64 (regs, &tb_ptr); - v64 =tci_read_r64 (regs, &tb_ptr); - condition = *tb_ptr++; -tci_write_reg (regs, t0,tci_compare64 (tmp64, v64, condition)); +tci_args_rrrrrc (&tb_ptr, &r0, &r1, &r2, &r3, &r4, &condition); +T1 =tci_uint64 (regs[r2], regs[r1]); +T2 =tci_uint64 (regs[r4], regs[r3]); + regs[r0] =tci_compare64 (T1 ,T2 , condition);break ;#elif TCG_TARGET_REG_BITS ==64 case INDEX_op_setcond_i64:
Signature · 1 line
2.25.1
PATCH v4 24/71 tcg/tci: Split out tci_args_rrcl and tci_args_rrrrcl
In reply to Richard Henderson--- tcg/tci.c | 52 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 20 deletions(-)
tcg/tci.c +32 -20
@@ -212,6 +212,15 @@ static void tci_args_rrs(const uint8_t **tb_ptr, *i2 =tci_read_s32 (tb_ptr); } +static void tci_args_rrcl (const uint8_t **tb_ptr, +TCGReg *r0,TCGReg *r1,TCGCond *c2,void **l3) +{ + *r0 =tci_read_r (tb_ptr); + *r1 =tci_read_r (tb_ptr); + *c2 =tci_read_b (tb_ptr); + *l3 = (void *)tci_read_label (tb_ptr); +} +static void tci_args_rrrc (const uint8_t **tb_ptr,TCGReg *r0,TCGReg *r1,TCGReg *r2,TCGCond *c3) {
@@ -222,6 +231,17 @@ static void tci_args_rrrc(const uint8_t **tb_ptr, }#if TCG_TARGET_REG_BITS ==32 +static void tci_args_rrrrcl (const uint8_t **tb_ptr,TCGReg *r0,TCGReg *r1, +TCGReg *r2,TCGReg *r3,TCGCond *c4,void **l5) +{ + *r0 =tci_read_r (tb_ptr); + *r1 =tci_read_r (tb_ptr); + *r2 =tci_read_r (tb_ptr); + *r3 =tci_read_r (tb_ptr); + *c4 =tci_read_b (tb_ptr); + *l5 = (void *)tci_read_label (tb_ptr); +} +static void tci_args_rrrrrc (const uint8_t **tb_ptr,TCGReg *r0,TCGReg *r1,TCGReg *r2,TCGReg *r3,TCGReg *r4,TCGCond *c5) {
@@ -388,7 +408,6 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,tcg_target_ulong t0;tcg_target_ulong t1;tcg_target_ulong t2; -tcg_target_ulong label;TCGCond condition;target_ulong taddr;uint8_t tmp8;
@@ -397,7 +416,7 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,uint64_t tmp64;#if TCG_TARGET_REG_BITS ==32 TCGReg r3, r4; -uint64_t v64,T1 ,T2 ; +uint64_t T1 ,T2 ;#endif TCGMemOpIdx oi;int32_t ofs;
@@ -594,13 +613,10 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,break ;#endif case INDEX_op_brcond_i32: - t0 =tci_read_rval (regs, &tb_ptr); - t1 =tci_read_rval (regs, &tb_ptr); - condition = *tb_ptr++; - label =tci_read_label (&tb_ptr); -if (tci_compare32 (t0, t1, condition)) { +tci_args_rrcl (&tb_ptr, &r0, &r1, &condition, &ptr); +if (tci_compare32 (regs[r0], regs[r1], condition)) {tci_assert (tb_ptr == old_code_ptr + op_size); - tb_ptr = (uint8_t *)label; + tb_ptr = ptr;continue ; }break ;
@@ -620,13 +636,12 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,tci_write_reg64 (regs, t1, t0, tmp64);break ;case INDEX_op_brcond2_i32: - tmp64 =tci_read_r64 (regs, &tb_ptr); - v64 =tci_read_r64 (regs, &tb_ptr); - condition = *tb_ptr++; - label =tci_read_label (&tb_ptr); -if (tci_compare64 (tmp64, v64, condition)) { +tci_args_rrrrcl (&tb_ptr, &r0, &r1, &r2, &r3, &condition, &ptr); +T1 =tci_uint64 (regs[r1], regs[r0]); +T2 =tci_uint64 (regs[r3], regs[r2]); +if (tci_compare64 (T1 ,T2 , condition)) {tci_assert (tb_ptr == old_code_ptr + op_size); - tb_ptr = (uint8_t *)label; + tb_ptr = ptr;continue ; }break ;
@@ -766,13 +781,10 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,break ;#endif case INDEX_op_brcond_i64: - t0 =tci_read_rval (regs, &tb_ptr); - t1 =tci_read_rval (regs, &tb_ptr); - condition = *tb_ptr++; - label =tci_read_label (&tb_ptr); -if (tci_compare64 (t0, t1, condition)) { +tci_args_rrcl (&tb_ptr, &r0, &r1, &condition, &ptr); +if (tci_compare64 (regs[r0], regs[r1], condition)) {tci_assert (tb_ptr == old_code_ptr + op_size); - tb_ptr = (uint8_t *)label; + tb_ptr = ptr;continue ; }break ;
Signature · 1 line
2.25.1
PATCH v4 25/71 tcg/tci: Split out tci_args_ri and tci_args_rI
In reply to Richard Henderson--- tcg/tci.c | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-)
tcg/tci.c +22 -16
@@ -121,16 +121,6 @@ static int32_t tci_read_s32(const uint8_t **tb_ptr)return value; } -#if TCG_TARGET_REG_BITS ==64 -/* Read constant (64 bit) from bytecode. */ -static uint64_t tci_read_i64 (const uint8_t **tb_ptr) -{ -uint64_t value = *(const uint64_t *)(*tb_ptr); - *tb_ptr +=sizeof (value); -return value; -} -#endif -/* Read indexed register (native size) from bytecode. */ static tcg_target_ulong tci_read_rval (const tcg_target_ulong *regs,const uint8_t **tb_ptr)
@@ -180,6 +170,8 @@ static tcg_target_ulong tci_read_label(const uint8_t **tb_ptr)* tci_args_<arguments> * where arguments is a sequence of * +* i = immediate (uint32_t) +* I = immediate (tcg_target_ulong) * r = register * s = signed ldst offset */
@@ -196,6 +188,22 @@ static void tci_args_rr(const uint8_t **tb_ptr, *r1 =tci_read_r (tb_ptr); } +static void tci_args_ri (const uint8_t **tb_ptr, +TCGReg *r0,tcg_target_ulong *i1) +{ + *r0 =tci_read_r (tb_ptr); + *i1 =tci_read_i32 (tb_ptr); +} + +#if TCG_TARGET_REG_BITS ==64 +static void tci_args_rI (const uint8_t **tb_ptr, +TCGReg *r0,tcg_target_ulong *i1) +{ + *r0 =tci_read_r (tb_ptr); + *i1 =tci_read_i (tb_ptr); +} +#endif +static void tci_args_rrr (const uint8_t **tb_ptr,TCGReg *r0,TCGReg *r1,TCGReg *r2) {
@@ -481,9 +489,8 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, regs[r0] = regs[r1];break ;case INDEX_op_tci_movi_i32: - t0 = *tb_ptr++; - t1 =tci_read_i32 (&tb_ptr); -tci_write_reg (regs, t0, t1); +tci_args_ri (&tb_ptr, &r0, &t1); + regs[r0] = t1;break ;/* Load/store operations (32 bit). */
@@ -703,9 +710,8 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,#endif #if TCG_TARGET_REG_BITS ==64 case INDEX_op_tci_movi_i64: - t0 = *tb_ptr++; - t1 =tci_read_i64 (&tb_ptr); -tci_write_reg (regs, t0, t1); +tci_args_rI (&tb_ptr, &r0, &t1); + regs[r0] = t1;break ;/* Load/store operations (64 bit). */
Signature · 1 line
2.25.1
PATCH v4 26/71 tcg/tci: Reuse tci_args_l for calls.
In reply to Richard Henderson--- tcg/tci.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-)
tcg/tci.c +19 -19
@@ -435,30 +435,30 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,switch (opc) {case INDEX_op_call: - t0 =tci_read_i (&tb_ptr); +tci_args_l (&tb_ptr, &ptr); tci_tb_ptr = (uintptr_t )tb_ptr;#if TCG_TARGET_REG_BITS ==32 - tmp64 = ((helper_function )t0)(tci_read_reg (regs,TCG_REG_R0 ), -tci_read_reg (regs,TCG_REG_R1 ), -tci_read_reg (regs,TCG_REG_R2 ), -tci_read_reg (regs,TCG_REG_R3 ), -tci_read_reg (regs,TCG_REG_R4 ), -tci_read_reg (regs,TCG_REG_R5 ), -tci_read_reg (regs,TCG_REG_R6 ), -tci_read_reg (regs,TCG_REG_R7 ), -tci_read_reg (regs,TCG_REG_R8 ), -tci_read_reg (regs,TCG_REG_R9 ), -tci_read_reg (regs,TCG_REG_R10 ), -tci_read_reg (regs,TCG_REG_R11 )); + tmp64 = ((helper_function )ptr)(tci_read_reg (regs,TCG_REG_R0 ), +tci_read_reg (regs,TCG_REG_R1 ), +tci_read_reg (regs,TCG_REG_R2 ), +tci_read_reg (regs,TCG_REG_R3 ), +tci_read_reg (regs,TCG_REG_R4 ), +tci_read_reg (regs,TCG_REG_R5 ), +tci_read_reg (regs,TCG_REG_R6 ), +tci_read_reg (regs,TCG_REG_R7 ), +tci_read_reg (regs,TCG_REG_R8 ), +tci_read_reg (regs,TCG_REG_R9 ), +tci_read_reg (regs,TCG_REG_R10 ), +tci_read_reg (regs,TCG_REG_R11 ));tci_write_reg (regs,TCG_REG_R0 , tmp64);tci_write_reg (regs,TCG_REG_R1 , tmp64 >>32 );#else - tmp64 = ((helper_function )t0)(tci_read_reg (regs,TCG_REG_R0 ), -tci_read_reg (regs,TCG_REG_R1 ), -tci_read_reg (regs,TCG_REG_R2 ), -tci_read_reg (regs,TCG_REG_R3 ), -tci_read_reg (regs,TCG_REG_R4 ), -tci_read_reg (regs,TCG_REG_R5 )); + tmp64 = ((helper_function )ptr)(tci_read_reg (regs,TCG_REG_R0 ), +tci_read_reg (regs,TCG_REG_R1 ), +tci_read_reg (regs,TCG_REG_R2 ), +tci_read_reg (regs,TCG_REG_R3 ), +tci_read_reg (regs,TCG_REG_R4 ), +tci_read_reg (regs,TCG_REG_R5 ));tci_write_reg (regs,TCG_REG_R0 , tmp64);#endif break ;
Signature · 1 line
2.25.1
PATCH v4 27/71 tcg/tci: Reuse tci_args_l for exit_tb
In reply to Richard HendersonDo not emit a uint64_t, but a tcg_target_ulong, aka uintptr_t. This reduces the size of the constant on 32-bit hosts. The assert for label != NULL has to be removed because that is a valid value for exit_tb.
--- tcg/tci.c | 13 ++++--------- tcg/tci/tcg-target.c.inc | 2 +- 2 files changed, 5 insertions(+), 10 deletions(-)
tcg/tci.c +4 -9
@@ -160,9 +160,7 @@ tci_read_ulong(const tcg_target_ulong *regs, const uint8_t **tb_ptr)static tcg_target_ulong tci_read_label (const uint8_t **tb_ptr) { -tcg_target_ulong label =tci_read_i (tb_ptr); -tci_assert (label !=0 ); -return label; +return tci_read_i (tb_ptr); }/*
@@ -400,7 +398,6 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,tcg_target_ulong regs[TCG_TARGET_NB_REGS ];long tcg_temps[CPU_TEMP_BUF_NLONGS ];uintptr_t sp_value = (uintptr_t )(tcg_temps +CPU_TEMP_BUF_NLONGS ); -uintptr_t ret =0 ; regs[TCG_AREG0 ] = (tcg_target_ulong )env; regs[TCG_REG_CALL_STACK ] = sp_value;
@@ -815,9 +812,9 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,/* QEMU specific operations. */ case INDEX_op_exit_tb: - ret = *(uint64_t *)tb_ptr; - goto exit; -break ; +tci_args_l (&tb_ptr, &ptr); +return (uintptr_t )ptr; +case INDEX_op_goto_tb:/* Jump address is aligned */ tb_ptr =QEMU_ALIGN_PTR_UP (tb_ptr,4 );
@@ -975,6 +972,4 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, }tci_assert (tb_ptr == old_code_ptr + op_size); } -exit: -return ret; }
tcg/tci/tcg-target.c.inc +1 -1
@@ -401,7 +401,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, switch (opc) { case INDEX_op_exit_tb: - tcg_out64(s, args[0]); + tcg_out_i(s, args[0]); break; case INDEX_op_goto_tb:
Signature · 1 line
2.25.1
PATCH v4 28/71 tcg/tci: Reuse tci_args_l for goto_tb
In reply to Richard HendersonConvert to indirect jumps, as it's less complicated. Then we just have a pointer to the tb address at which the chain is stored, from which we read.
--- tcg/tci/tcg-target.h | 11 +++-------- tcg/tci.c | 8 +++----- tcg/tci/tcg-target.c.inc | 13 +++---------- 3 files changed, 9 insertions(+), 23 deletions(-)
tcg/tci/tcg-target.h +3 -8
@@ -87,7 +87,7 @@#define TCG_TARGET_HAS_muluh_i32 0#define TCG_TARGET_HAS_mulsh_i32 0#define TCG_TARGET_HAS_goto_ptr 0 -#define TCG_TARGET_HAS_direct_jump 1 +#define TCG_TARGET_HAS_direct_jump 0#define TCG_TARGET_HAS_qemu_st8_i32 0#if TCG_TARGET_REG_BITS ==64
@@ -174,12 +174,7 @@ void tci_disas(uint8_t opc);#define TCG_TARGET_HAS_MEMORY_BSWAP 1 -static inline void tb_target_set_jmp_target (uintptr_t tc_ptr,uintptr_t jmp_rx, -uintptr_t jmp_rw,uintptr_t addr) -{ -/* patch the branch destination */ -qatomic_set ((int32_t *)jmp_rw, addr - (jmp_rx +4 )); -/* no need to flush icache explicitly */ -} +/* not defined -- call should be eliminated at compile time */ +void tb_target_set_jmp_target (uintptr_t ,uintptr_t ,uintptr_t ,uintptr_t );#endif /* TCG_TARGET_H */
tcg/tci.c +3 -5
@@ -816,13 +816,11 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,return (uintptr_t )ptr;case INDEX_op_goto_tb: -/* Jump address is aligned */ - tb_ptr =QEMU_ALIGN_PTR_UP (tb_ptr,4 ); - t0 =qatomic_read ((int32_t *)tb_ptr); - tb_ptr +=sizeof (int32_t ); +tci_args_l (&tb_ptr, &ptr);tci_assert (tb_ptr == old_code_ptr + op_size); - tb_ptr += (int32_t )t0; + tb_ptr = *(void **)ptr;continue ; +case INDEX_op_qemu_ld_i32: t0 = *tb_ptr++; taddr =tci_read_ulong (regs, &tb_ptr);
tcg/tci/tcg-target.c.inc +3 -10
@@ -405,16 +405,9 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, break; case INDEX_op_goto_tb: - if (s->tb_jmp_insn_offset) { - /* Direct jump method. */ - /* Align for atomic patching and thread safety */ - s->code_ptr = QEMU_ALIGN_PTR_UP(s->code_ptr, 4); - s->tb_jmp_insn_offset[args[0]] = tcg_current_code_size(s); - tcg_out32(s, 0); - } else { - /* Indirect jump method. */ - TODO(); - } + tcg_debug_assert(s->tb_jmp_insn_offset == 0); + /* indirect jump method. */ + tcg_out_i(s, (uintptr_t)(s->tb_jmp_target_addr + args[0])); set_jmp_reset_offset(s, args[0]); break;
Signature · 1 line
2.25.1
PATCH v4 29/71 tcg/tci: Split out tci_args_rrrrrr
In reply to Richard Henderson--- tcg/tci.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-)
tcg/tci.c +20 -11
@@ -258,6 +258,17 @@ static void tci_args_rrrrrc(const uint8_t **tb_ptr, TCGReg *r0, TCGReg *r1, *r4 =tci_read_r (tb_ptr); *c5 = tci_read_b(tb_ptr); } + +static void tci_args_rrrrrr (const uint8_t **tb_ptr,TCGReg *r0,TCGReg *r1, +TCGReg *r2,TCGReg *r3,TCGReg *r4,TCGReg *r5) +{ + *r0 =tci_read_r (tb_ptr); + *r1 =tci_read_r (tb_ptr); + *r2 =tci_read_r (tb_ptr); + *r3 =tci_read_r (tb_ptr); + *r4 =tci_read_r (tb_ptr); + *r5 =tci_read_r (tb_ptr); +}#endif static bool tci_compare32 (uint32_t u0,uint32_t u1,TCGCond condition)
@@ -420,7 +431,7 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,uint32_t tmp32;uint64_t tmp64;#if TCG_TARGET_REG_BITS ==32 -TCGReg r3, r4; +TCGReg r3, r4, r5;uint64_t T1 ,T2 ;#endif TCGMemOpIdx oi;
@@ -626,18 +637,16 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,break ;#if TCG_TARGET_REG_BITS ==32 case INDEX_op_add2_i32: - t0 = *tb_ptr++; - t1 = *tb_ptr++; - tmp64 =tci_read_r64 (regs, &tb_ptr); - tmp64 +=tci_read_r64 (regs, &tb_ptr); -tci_write_reg64 (regs, t1, t0, tmp64); +tci_args_rrrrrr (&tb_ptr, &r0, &r1, &r2, &r3, &r4, &r5); +T1 =tci_uint64 (regs[r3], regs[r2]); +T2 =tci_uint64 (regs[r5], regs[r4]); +tci_write_reg64 (regs, r1, r0,T1 +T2 );break ;case INDEX_op_sub2_i32: - t0 = *tb_ptr++; - t1 = *tb_ptr++; - tmp64 =tci_read_r64 (regs, &tb_ptr); - tmp64 -=tci_read_r64 (regs, &tb_ptr); -tci_write_reg64 (regs, t1, t0, tmp64); +tci_args_rrrrrr (&tb_ptr, &r0, &r1, &r2, &r3, &r4, &r5); +T1 =tci_uint64 (regs[r3], regs[r2]); +T2 =tci_uint64 (regs[r5], regs[r4]); +tci_write_reg64 (regs, r1, r0,T1 -T2 );break ;case INDEX_op_brcond2_i32:tci_args_rrrrcl (&tb_ptr, &r0, &r1, &r2, &r3, &condition, &ptr);
Signature · 1 line
2.25.1
PATCH v4 30/71 tcg/tci: Split out tci_args_rrrr
In reply to Richard Henderson--- tcg/tci.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
tcg/tci.c +11 -5
@@ -237,6 +237,15 @@ static void tci_args_rrrc(const uint8_t **tb_ptr, }#if TCG_TARGET_REG_BITS ==32 +static void tci_args_rrrr (const uint8_t **tb_ptr, +TCGReg *r0,TCGReg *r1,TCGReg *r2,TCGReg *r3) +{ + *r0 =tci_read_r (tb_ptr); + *r1 =tci_read_r (tb_ptr); + *r2 =tci_read_r (tb_ptr); + *r3 =tci_read_r (tb_ptr); +} +static void tci_args_rrrrcl (const uint8_t **tb_ptr,TCGReg *r0,TCGReg *r1,TCGReg *r2,TCGReg *r3,TCGCond *c4,void **l5) {
@@ -659,11 +668,8 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, }break ;case INDEX_op_mulu2_i32: - t0 = *tb_ptr++; - t1 = *tb_ptr++; - t2 =tci_read_rval (regs, &tb_ptr); - tmp64 = (uint32_t )tci_read_rval (regs, &tb_ptr); -tci_write_reg64 (regs, t1, t0, (uint32_t )t2 * tmp64); +tci_args_rrrr (&tb_ptr, &r0, &r1, &r2, &r3); +tci_write_reg64 (regs, r1, r0, (uint64_t )regs[r2] * regs[r3]);break ;#endif /* TCG_TARGET_REG_BITS == 32 */ #if TCG_TARGET_HAS_ext8s_i32 || TCG_TARGET_HAS_ext8s_i64
Signature · 1 line
2.25.1
PATCH v4 31/71 tcg/tci: Clean up deposit operations
In reply to Richard HendersonUse the correct set of asserts during code generation. We do not require the first input to overlap the output; the existing interpreter already supported that.
Split out tci_args_rrrbb in the translator.
Use the deposit32/64 functions rather than inline expansion.
--- tcg/tci/tcg-target-con-set.h | 1 - tcg/tci.c | 33 ++++++++++++++++----------------- tcg/tci/tcg-target.c.inc | 24 ++++++++++++++---------- 3 files changed, 30 insertions(+), 28 deletions(-)
tcg/tci/tcg-target-con-set.h +0 -1
@@ -13,7 +13,6 @@ C_O0_I2(r, r) C_O0_I3(r, r, r) C_O0_I4(r, r, r, r) C_O1_I1(r, r) -C_O1_I2(r, 0, r) C_O1_I2(r, r, r) C_O1_I4(r, r, r, r, r)C_O2_I1 (r, r, r)
tcg/tci.c +16 -17
@@ -168,6 +168,7 @@ static tcg_target_ulong tci_read_label(const uint8_t **tb_ptr)* tci_args_<arguments> * where arguments is a sequence of * +* b = immediate (bit position) * i = immediate (uint32_t) * I = immediate (tcg_target_ulong) * r = register
@@ -236,6 +237,16 @@ static void tci_args_rrrc(const uint8_t **tb_ptr, *c3 =tci_read_b (tb_ptr); } +static void tci_args_rrrbb (const uint8_t **tb_ptr,TCGReg *r0,TCGReg *r1, +TCGReg *r2,uint8_t *i3,uint8_t *i4) +{ + *r0 =tci_read_r (tb_ptr); + *r1 =tci_read_r (tb_ptr); + *r2 =tci_read_r (tb_ptr); + *i3 =tci_read_b (tb_ptr); + *i4 =tci_read_b (tb_ptr); +} +#if TCG_TARGET_REG_BITS ==32 static void tci_args_rrrr (const uint8_t **tb_ptr,TCGReg *r0,TCGReg *r1,TCGReg *r2,TCGReg *r3)
@@ -432,11 +443,9 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,TCGReg r0, r1, r2;tcg_target_ulong t0;tcg_target_ulong t1; -tcg_target_ulong t2;TCGCond condition;target_ulong taddr; -uint8_t tmp8; -uint16_t tmp16; +uint8_t pos, len;uint32_t tmp32;uint64_t tmp64;#if TCG_TARGET_REG_BITS ==32
@@ -627,13 +636,8 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,#endif #if TCG_TARGET_HAS_deposit_i32case INDEX_op_deposit_i32: - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); - t2 =tci_read_rval (regs, &tb_ptr); - tmp16 = *tb_ptr++; - tmp8 = *tb_ptr++; - tmp32 = (((1 << tmp8) -1 ) << tmp16); -tci_write_reg (regs, t0, (t1 & ~tmp32) | ((t2 << tmp16) & tmp32)); +tci_args_rrrbb (&tb_ptr, &r0, &r1, &r2, &pos, &len); + regs[r0] =deposit32 (regs[r1], pos, len, regs[r2]);break ;#endif case INDEX_op_brcond_i32:
@@ -789,13 +793,8 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,#endif #if TCG_TARGET_HAS_deposit_i64case INDEX_op_deposit_i64: - t0 = *tb_ptr++; - t1 =tci_read_rval (regs, &tb_ptr); - t2 =tci_read_rval (regs, &tb_ptr); - tmp16 = *tb_ptr++; - tmp8 = *tb_ptr++; - tmp64 = (((1ULL << tmp8) -1 ) << tmp16); -tci_write_reg (regs, t0, (t1 & ~tmp64) | ((t2 << tmp16) & tmp64)); +tci_args_rrrbb (&tb_ptr, &r0, &r1, &r2, &pos, &len); + regs[r0] =deposit64 (regs[r1], pos, len, regs[r2]);break ;#endif case INDEX_op_brcond_i64:
tcg/tci/tcg-target.c.inc +14 -10
@@ -126,11 +126,9 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) case INDEX_op_rotr_i64: case INDEX_op_setcond_i32: case INDEX_op_setcond_i64: - return C_O1_I2(r, r, r); - case INDEX_op_deposit_i32: case INDEX_op_deposit_i64: - return C_O1_I2(r, 0, r); + return C_O1_I2(r, r, r); case INDEX_op_brcond_i32: case INDEX_op_brcond_i64:
@@ -480,13 +478,19 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, break; CASE_32_64(deposit) /* Optional (TCG_TARGET_HAS_deposit_*). */ - tcg_out_r(s, args[0]); - tcg_out_r(s, args[1]); - tcg_out_r(s, args[2]); - tcg_debug_assert(args[3] <= UINT8_MAX); - tcg_out8(s, args[3]); - tcg_debug_assert(args[4] <= UINT8_MAX); - tcg_out8(s, args[4]); + { + TCGArg pos = args[3], len = args[4]; + TCGArg max = opc == INDEX_op_deposit_i32 ? 32 : 64; + + tcg_debug_assert(pos < max); + tcg_debug_assert(pos + len <= max); + + tcg_out_r(s, args[0]); + tcg_out_r(s, args[1]); + tcg_out_r(s, args[2]); + tcg_out8(s, pos); + tcg_out8(s, len); + } break; CASE_32_64(brcond)
Signature · 1 line
2.25.1
PATCH v4 32/71 tcg/tci: Reduce qemu_ld/st TCGMemOpIdx operand to 32-bits
In reply to Richard HendersonWe are currently using the "natural" size routine, which uses 64-bits on a 64-bit host. The TCGMemOpIdx operand has 11 bits, so we can safely reduce to 32-bits.
--- tcg/tci.c | 8 ++++---- tcg/tci/tcg-target.c.inc | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-)
tcg/tci.c +4 -4
@@ -838,7 +838,7 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,case INDEX_op_qemu_ld_i32: t0 = *tb_ptr++; taddr =tci_read_ulong (regs, &tb_ptr); - oi =tci_read_i (&tb_ptr); + oi =tci_read_i32 (&tb_ptr);switch (get_memop (oi) & (MO_BSWAP |MO_SSIZE )) {case MO_UB : tmp32 = qemu_ld_ub;
@@ -875,7 +875,7 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, t1 = *tb_ptr++; } taddr =tci_read_ulong (regs, &tb_ptr); - oi =tci_read_i (&tb_ptr); + oi =tci_read_i32 (&tb_ptr);switch (get_memop (oi) & (MO_BSWAP |MO_SSIZE )) {case MO_UB : tmp64 = qemu_ld_ub;
@@ -924,7 +924,7 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,case INDEX_op_qemu_st_i32: t0 =tci_read_rval (regs, &tb_ptr); taddr =tci_read_ulong (regs, &tb_ptr); - oi =tci_read_i (&tb_ptr); + oi =tci_read_i32 (&tb_ptr);switch (get_memop (oi) & (MO_BSWAP |MO_SIZE )) {case MO_UB :qemu_st_b (t0);
@@ -948,7 +948,7 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,case INDEX_op_qemu_st_i64: tmp64 =tci_read_r64 (regs, &tb_ptr); taddr =tci_read_ulong (regs, &tb_ptr); - oi =tci_read_i (&tb_ptr); + oi =tci_read_i32 (&tb_ptr);switch (get_memop (oi) & (MO_BSWAP |MO_SIZE )) {case MO_UB :qemu_st_b (tmp64);
tcg/tci/tcg-target.c.inc +2 -2
@@ -550,7 +550,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, if (TARGET_LONG_BITS > TCG_TARGET_REG_BITS) { tcg_out_r(s, *args++); } - tcg_out_i(s, *args++); + tcg_out32(s, *args++); break; case INDEX_op_qemu_ld_i64:
@@ -563,7 +563,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, if (TARGET_LONG_BITS > TCG_TARGET_REG_BITS) { tcg_out_r(s, *args++); } - tcg_out_i(s, *args++); + tcg_out32(s, *args++); break; case INDEX_op_mb:
Signature · 1 line
2.25.1
PATCH v4 33/71 tcg/tci: Split out tci_args_{rrm,rrrm,rrrrm}
In reply to Richard Henderson--- tcg/tci.c | 147 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 81 insertions(+), 66 deletions(-)
tcg/tci.c +81 -66
@@ -66,22 +66,18 @@ tci_write_reg(tcg_target_ulong *regs, TCGReg index, tcg_target_ulong value) regs[index] = value; } -#if TCG_TARGET_REG_BITS ==32 static void tci_write_reg64 (tcg_target_ulong *regs,uint32_t high_index,uint32_t low_index,uint64_t value) {tci_write_reg (regs, low_index, value);tci_write_reg (regs, high_index, value >>32 ); } -#endif -#if TCG_TARGET_REG_BITS ==32 /* Create a 64 bit value from two 32 bit values. */ static uint64_t tci_uint64 (uint32_t high,uint32_t low) {return ((uint64_t )high <<32 ) + low; } -#endif /* Read constant byte from bytecode. */ static uint8_t tci_read_b (const uint8_t **tb_ptr)
@@ -121,43 +117,6 @@ static int32_t tci_read_s32(const uint8_t **tb_ptr)return value; } -/* Read indexed register (native size) from bytecode. */ -static tcg_target_ulong -tci_read_rval (const tcg_target_ulong *regs,const uint8_t **tb_ptr) -{ -tcg_target_ulong value =tci_read_reg (regs, **tb_ptr); - *tb_ptr +=1 ; -return value; -} - -#if TCG_TARGET_REG_BITS ==32 -/* Read two indexed registers (2 * 32 bit) from bytecode. */ -static uint64_t tci_read_r64 (const tcg_target_ulong *regs, -const uint8_t **tb_ptr) -{ -uint32_t low =tci_read_rval (regs, tb_ptr); -return tci_uint64 (tci_read_rval (regs, tb_ptr), low); -} -#elif TCG_TARGET_REG_BITS ==64 -/* Read indexed register (64 bit) from bytecode. */ -static uint64_t tci_read_r64 (const tcg_target_ulong *regs, -const uint8_t **tb_ptr) -{ -return tci_read_rval (regs, tb_ptr); -} -#endif - -/* Read indexed register(s) with target address from bytecode. */ -static target_ulong -tci_read_ulong (const tcg_target_ulong *regs,const uint8_t **tb_ptr) -{ -target_ulong taddr =tci_read_rval (regs, tb_ptr); -#if TARGET_LONG_BITS >TCG_TARGET_REG_BITS - taddr += (uint64_t )tci_read_rval (regs, tb_ptr) <<32 ; -#endif -return taddr; -} -static tcg_target_ulong tci_read_label (const uint8_t **tb_ptr) {return tci_read_i (tb_ptr);
@@ -171,6 +130,7 @@ static tcg_target_ulong tci_read_label(const uint8_t **tb_ptr)* b = immediate (bit position) * i = immediate (uint32_t) * I = immediate (tcg_target_ulong) +* m = immediate (TCGMemOpIdx) * r = register * s = signed ldst offset */
@@ -203,6 +163,14 @@ static void tci_args_rI(const uint8_t **tb_ptr, }#endif +static void tci_args_rrm (const uint8_t **tb_ptr, +TCGReg *r0,TCGReg *r1,TCGMemOpIdx *m2) +{ + *r0 =tci_read_r (tb_ptr); + *r1 =tci_read_r (tb_ptr); + *m2 =tci_read_i32 (tb_ptr); +} +static void tci_args_rrr (const uint8_t **tb_ptr,TCGReg *r0,TCGReg *r1,TCGReg *r2) {
@@ -237,6 +205,15 @@ static void tci_args_rrrc(const uint8_t **tb_ptr, *c3 =tci_read_b (tb_ptr); } +static void tci_args_rrrm (const uint8_t **tb_ptr, +TCGReg *r0,TCGReg *r1,TCGReg *r2,TCGMemOpIdx *m3) +{ + *r0 =tci_read_r (tb_ptr); + *r1 =tci_read_r (tb_ptr); + *r2 =tci_read_r (tb_ptr); + *m3 =tci_read_i32 (tb_ptr); +} +static void tci_args_rrrbb (const uint8_t **tb_ptr,TCGReg *r0,TCGReg *r1,TCGReg *r2,uint8_t *i3,uint8_t *i4) {
@@ -247,6 +224,16 @@ static void tci_args_rrrbb(const uint8_t **tb_ptr, TCGReg *r0, TCGReg *r1, *i4 =tci_read_b (tb_ptr); } +static void tci_args_rrrrm (const uint8_t **tb_ptr,TCGReg *r0,TCGReg *r1, +TCGReg *r2,TCGReg *r3,TCGMemOpIdx *m4) +{ + *r0 =tci_read_r (tb_ptr); + *r1 =tci_read_r (tb_ptr); + *r2 =tci_read_r (tb_ptr); + *r3 =tci_read_r (tb_ptr); + *m4 =tci_read_i32 (tb_ptr); +} +#if TCG_TARGET_REG_BITS ==32 static void tci_args_rrrr (const uint8_t **tb_ptr,TCGReg *r0,TCGReg *r1,TCGReg *r2,TCGReg *r3)
@@ -440,8 +427,7 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,uint8_t op_size = tb_ptr[1 ];const uint8_t *old_code_ptr = tb_ptr;#endif -TCGReg r0, r1, r2; -tcg_target_ulong t0; +TCGReg r0, r1, r2, r3;tcg_target_ulong t1;TCGCond condition;target_ulong taddr;
@@ -449,7 +435,7 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,uint32_t tmp32;uint64_t tmp64;#if TCG_TARGET_REG_BITS ==32 -TCGReg r3, r4, r5; +TCGReg r4, r5;uint64_t T1 ,T2 ;#endif TCGMemOpIdx oi;
@@ -836,9 +822,13 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,continue ;case INDEX_op_qemu_ld_i32: - t0 = *tb_ptr++; - taddr =tci_read_ulong (regs, &tb_ptr); - oi =tci_read_i32 (&tb_ptr); +if (TARGET_LONG_BITS <=TCG_TARGET_REG_BITS ) { +tci_args_rrm (&tb_ptr, &r0, &r1, &oi); + taddr = regs[r1]; + }else { +tci_args_rrrm (&tb_ptr, &r0, &r1, &r2, &oi); + taddr =tci_uint64 (regs[r2], regs[r1]); + }switch (get_memop (oi) & (MO_BSWAP |MO_SSIZE )) {case MO_UB : tmp32 = qemu_ld_ub;
@@ -867,15 +857,20 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,default :g_assert_not_reached (); } -tci_write_reg (regs, t0, tmp32); + regs[r0] = tmp32;break ; +case INDEX_op_qemu_ld_i64: - t0 = *tb_ptr++; -if (TCG_TARGET_REG_BITS ==32 ) { - t1 = *tb_ptr++; +if (TCG_TARGET_REG_BITS ==64 ) { +tci_args_rrm (&tb_ptr, &r0, &r1, &oi); + taddr = regs[r1]; + }else if (TARGET_LONG_BITS <=TCG_TARGET_REG_BITS ) { +tci_args_rrrm (&tb_ptr, &r0, &r1, &r2, &oi); + taddr = regs[r2]; + }else { +tci_args_rrrrm (&tb_ptr, &r0, &r1, &r2, &r3, &oi); + taddr =tci_uint64 (regs[r3], regs[r2]); } - taddr =tci_read_ulong (regs, &tb_ptr); - oi =tci_read_i32 (&tb_ptr);switch (get_memop (oi) & (MO_BSWAP |MO_SSIZE )) {case MO_UB : tmp64 = qemu_ld_ub;
@@ -916,39 +911,58 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,default :g_assert_not_reached (); } -tci_write_reg (regs, t0, tmp64);if (TCG_TARGET_REG_BITS ==32 ) { -tci_write_reg (regs, t1, tmp64 >>32 ); +tci_write_reg64 (regs, r1, r0, tmp64); + }else { + regs[r0] = tmp64; }break ; +case INDEX_op_qemu_st_i32: - t0 =tci_read_rval (regs, &tb_ptr); - taddr =tci_read_ulong (regs, &tb_ptr); - oi =tci_read_i32 (&tb_ptr); +if (TARGET_LONG_BITS <=TCG_TARGET_REG_BITS ) { +tci_args_rrm (&tb_ptr, &r0, &r1, &oi); + taddr = regs[r1]; + }else { +tci_args_rrrm (&tb_ptr, &r0, &r1, &r2, &oi); + taddr =tci_uint64 (regs[r2], regs[r1]); + } + tmp32 = regs[r0];switch (get_memop (oi) & (MO_BSWAP |MO_SIZE )) {case MO_UB : -qemu_st_b (t0); +qemu_st_b (tmp32);break ;case MO_LEUW : -qemu_st_lew (t0); +qemu_st_lew (tmp32);break ;case MO_LEUL : -qemu_st_lel (t0); +qemu_st_lel (tmp32);break ;case MO_BEUW : -qemu_st_bew (t0); +qemu_st_bew (tmp32);break ;case MO_BEUL : -qemu_st_bel (t0); +qemu_st_bel (tmp32);break ;default :g_assert_not_reached (); }break ; +case INDEX_op_qemu_st_i64: - tmp64 =tci_read_r64 (regs, &tb_ptr); - taddr =tci_read_ulong (regs, &tb_ptr); - oi =tci_read_i32 (&tb_ptr); +if (TCG_TARGET_REG_BITS ==64 ) { +tci_args_rrm (&tb_ptr, &r0, &r1, &oi); + taddr = regs[r1]; + tmp64 = regs[r0]; + }else { +if (TARGET_LONG_BITS <=TCG_TARGET_REG_BITS ) { +tci_args_rrrm (&tb_ptr, &r0, &r1, &r2, &oi); + taddr = regs[r2]; + }else { +tci_args_rrrrm (&tb_ptr, &r0, &r1, &r2, &r3, &oi); + taddr =tci_uint64 (regs[r3], regs[r2]); + } + tmp64 =tci_uint64 (regs[r1], regs[r0]); + }switch (get_memop (oi) & (MO_BSWAP |MO_SIZE )) {case MO_UB :qemu_st_b (tmp64);
@@ -975,6 +989,7 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,g_assert_not_reached (); }break ; +case INDEX_op_mb:/* Ensure ordering for all kinds */ smp_mb ();
Signature · 1 line
2.25.1
PATCH v4 34/71 tcg/tci: Hoist op_size checking into tci_args_*
In reply to Richard HendersonThis performs the size check while reading the arguments, which means that we don't have to arrange for it to be done after the operation. Which tidies all of the branches.
--- tcg/tci.c | 87 ++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 73 insertions(+), 14 deletions(-)
tcg/tci.c +73 -14
@@ -24,7 +24,7 @@#if defined(CONFIG_DEBUG_TCG )# define tci_assert (cond) assert(cond)#else -# define tci_assert (cond) ((void)0) +# define tci_assert (cond) ((void)(cond))#endif #include "qemu-common.h"
@@ -135,146 +135,217 @@ static tcg_target_ulong tci_read_label(const uint8_t **tb_ptr)* s = signed ldst offset */ +static void check_size (const uint8_t *start,const uint8_t **tb_ptr) +{ +const uint8_t *old_code_ptr = start -2 ; +uint8_t op_size = old_code_ptr[1 ]; +tci_assert (*tb_ptr == old_code_ptr + op_size); +} +static void tci_args_l (const uint8_t **tb_ptr,void **l0) { +const uint8_t *start = *tb_ptr; + *l0 = (void *)tci_read_label (tb_ptr); + +check_size (start, tb_ptr); }static void tci_args_rr (const uint8_t **tb_ptr,TCGReg *r0,TCGReg *r1) { +const uint8_t *start = *tb_ptr; + *r0 =tci_read_r (tb_ptr); *r1 =tci_read_r (tb_ptr); + +check_size (start, tb_ptr); }static void tci_args_ri (const uint8_t **tb_ptr,TCGReg *r0,tcg_target_ulong *i1) { +const uint8_t *start = *tb_ptr; + *r0 =tci_read_r (tb_ptr); *i1 =tci_read_i32 (tb_ptr); + +check_size (start, tb_ptr); }#if TCG_TARGET_REG_BITS ==64 static void tci_args_rI (const uint8_t **tb_ptr,TCGReg *r0,tcg_target_ulong *i1) { +const uint8_t *start = *tb_ptr; + *r0 =tci_read_r (tb_ptr); *i1 =tci_read_i (tb_ptr); + +check_size (start, tb_ptr); }#endif static void tci_args_rrm (const uint8_t **tb_ptr,TCGReg *r0,TCGReg *r1,TCGMemOpIdx *m2) { +const uint8_t *start = *tb_ptr; + *r0 =tci_read_r (tb_ptr); *r1 =tci_read_r (tb_ptr); *m2 =tci_read_i32 (tb_ptr); + +check_size (start, tb_ptr); }static void tci_args_rrr (const uint8_t **tb_ptr,TCGReg *r0,TCGReg *r1,TCGReg *r2) { +const uint8_t *start = *tb_ptr; + *r0 =tci_read_r (tb_ptr); *r1 =tci_read_r (tb_ptr); *r2 =tci_read_r (tb_ptr); + +check_size (start, tb_ptr); }static void tci_args_rrs (const uint8_t **tb_ptr,TCGReg *r0,TCGReg *r1,int32_t *i2) { +const uint8_t *start = *tb_ptr; + *r0 =tci_read_r (tb_ptr); *r1 =tci_read_r (tb_ptr); *i2 =tci_read_s32 (tb_ptr); + +check_size (start, tb_ptr); }static void tci_args_rrcl (const uint8_t **tb_ptr,TCGReg *r0,TCGReg *r1,TCGCond *c2,void **l3) { +const uint8_t *start = *tb_ptr; + *r0 =tci_read_r (tb_ptr); *r1 =tci_read_r (tb_ptr); *c2 =tci_read_b (tb_ptr); *l3 = (void *)tci_read_label (tb_ptr); + +check_size (start, tb_ptr); }static void tci_args_rrrc (const uint8_t **tb_ptr,TCGReg *r0,TCGReg *r1,TCGReg *r2,TCGCond *c3) { +const uint8_t *start = *tb_ptr; + *r0 =tci_read_r (tb_ptr); *r1 =tci_read_r (tb_ptr); *r2 =tci_read_r (tb_ptr); *c3 =tci_read_b (tb_ptr); + +check_size (start, tb_ptr); }static void tci_args_rrrm (const uint8_t **tb_ptr,TCGReg *r0,TCGReg *r1,TCGReg *r2,TCGMemOpIdx *m3) { +const uint8_t *start = *tb_ptr; + *r0 =tci_read_r (tb_ptr); *r1 =tci_read_r (tb_ptr); *r2 =tci_read_r (tb_ptr); *m3 =tci_read_i32 (tb_ptr); + +check_size (start, tb_ptr); }static void tci_args_rrrbb (const uint8_t **tb_ptr,TCGReg *r0,TCGReg *r1,TCGReg *r2,uint8_t *i3,uint8_t *i4) { +const uint8_t *start = *tb_ptr; + *r0 =tci_read_r (tb_ptr); *r1 =tci_read_r (tb_ptr); *r2 =tci_read_r (tb_ptr); *i3 =tci_read_b (tb_ptr); *i4 =tci_read_b (tb_ptr); + +check_size (start, tb_ptr); }static void tci_args_rrrrm (const uint8_t **tb_ptr,TCGReg *r0,TCGReg *r1,TCGReg *r2,TCGReg *r3,TCGMemOpIdx *m4) { +const uint8_t *start = *tb_ptr; + *r0 =tci_read_r (tb_ptr); *r1 =tci_read_r (tb_ptr); *r2 =tci_read_r (tb_ptr); *r3 =tci_read_r (tb_ptr); *m4 =tci_read_i32 (tb_ptr); + +check_size (start, tb_ptr); }#if TCG_TARGET_REG_BITS ==32 static void tci_args_rrrr (const uint8_t **tb_ptr,TCGReg *r0,TCGReg *r1,TCGReg *r2,TCGReg *r3) { +const uint8_t *start = *tb_ptr; + *r0 =tci_read_r (tb_ptr); *r1 =tci_read_r (tb_ptr); *r2 =tci_read_r (tb_ptr); *r3 =tci_read_r (tb_ptr); + +check_size (start, tb_ptr); }static void tci_args_rrrrcl (const uint8_t **tb_ptr,TCGReg *r0,TCGReg *r1,TCGReg *r2,TCGReg *r3,TCGCond *c4,void **l5) { +const uint8_t *start = *tb_ptr; + *r0 =tci_read_r (tb_ptr); *r1 =tci_read_r (tb_ptr); *r2 =tci_read_r (tb_ptr); *r3 =tci_read_r (tb_ptr); *c4 =tci_read_b (tb_ptr); *l5 = (void *)tci_read_label (tb_ptr); + +check_size (start, tb_ptr); }static void tci_args_rrrrrc (const uint8_t **tb_ptr,TCGReg *r0,TCGReg *r1,TCGReg *r2,TCGReg *r3,TCGReg *r4,TCGCond *c5) { +const uint8_t *start = *tb_ptr; + *r0 =tci_read_r (tb_ptr); *r1 =tci_read_r (tb_ptr); *r2 =tci_read_r (tb_ptr); *r3 =tci_read_r (tb_ptr); *r4 =tci_read_r (tb_ptr); *c5 =tci_read_b (tb_ptr); + +check_size (start, tb_ptr); }static void tci_args_rrrrrr (const uint8_t **tb_ptr,TCGReg *r0,TCGReg *r1,TCGReg *r2,TCGReg *r3,TCGReg *r4,TCGReg *r5) { +const uint8_t *start = *tb_ptr; + *r0 =tci_read_r (tb_ptr); *r1 =tci_read_r (tb_ptr); *r2 =tci_read_r (tb_ptr); *r3 =tci_read_r (tb_ptr); *r4 =tci_read_r (tb_ptr); *r5 =tci_read_r (tb_ptr); + +check_size (start, tb_ptr); }#endif
@@ -423,10 +494,6 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,for (;;) {TCGOpcode opc = tb_ptr[0 ]; -#if defined(CONFIG_DEBUG_TCG ) && !defined(NDEBUG ) -uint8_t op_size = tb_ptr[1 ]; -const uint8_t *old_code_ptr = tb_ptr; -#endif TCGReg r0, r1, r2, r3;tcg_target_ulong t1;TCGCond condition;
@@ -476,7 +543,6 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,break ;case INDEX_op_br:tci_args_l (&tb_ptr, &ptr); -tci_assert (tb_ptr == old_code_ptr + op_size); tb_ptr = ptr;continue ;case INDEX_op_setcond_i32:
@@ -629,9 +695,7 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,case INDEX_op_brcond_i32:tci_args_rrcl (&tb_ptr, &r0, &r1, &condition, &ptr);if (tci_compare32 (regs[r0], regs[r1], condition)) { -tci_assert (tb_ptr == old_code_ptr + op_size); tb_ptr = ptr; -continue ; }break ;#if TCG_TARGET_REG_BITS ==32
@@ -652,7 +716,6 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,T1 =tci_uint64 (regs[r1], regs[r0]);T2 =tci_uint64 (regs[r3], regs[r2]);if (tci_compare64 (T1 ,T2 , condition)) { -tci_assert (tb_ptr == old_code_ptr + op_size); tb_ptr = ptr;continue ; }
@@ -786,9 +849,7 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,case INDEX_op_brcond_i64:tci_args_rrcl (&tb_ptr, &r0, &r1, &condition, &ptr);if (tci_compare64 (regs[r0], regs[r1], condition)) { -tci_assert (tb_ptr == old_code_ptr + op_size); tb_ptr = ptr; -continue ; }break ;case INDEX_op_ext32s_i64:
@@ -817,9 +878,8 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,case INDEX_op_goto_tb:tci_args_l (&tb_ptr, &ptr); -tci_assert (tb_ptr == old_code_ptr + op_size); tb_ptr = *(void **)ptr; -continue ; +break ;case INDEX_op_qemu_ld_i32:if (TARGET_LONG_BITS <=TCG_TARGET_REG_BITS ) {
@@ -997,6 +1057,5 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,default :g_assert_not_reached (); } -tci_assert (tb_ptr == old_code_ptr + op_size); } }
Signature · 1 line
2.25.1
PATCH v4 35/71 tcg/tci: Remove tci_disas
In reply to Richard HendersonThis function is unused. It's not even the disassembler, which is print_insn_tci, located in disas/tci.c.
--- tcg/tci/tcg-target.h | 2 -- tcg/tci/tcg-target.c.inc | 10 ---------- 2 files changed, 12 deletions(-)
tcg/tci/tcg-target.h +0 -2
@@ -163,8 +163,6 @@ typedef enum {#define TCG_TARGET_CALL_STACK_OFFSET 0#define TCG_TARGET_STACK_ALIGN 16 -void tci_disas (uint8_t opc); -#define HAVE_TCG_QEMU_TB_EXEC /* We could notice __i386__ or __s390x__ and reduce the barriers depending
tcg/tci/tcg-target.c.inc +0 -10
@@ -253,16 +253,6 @@ static bool patch_reloc(tcg_insn_unit *code_ptr, int type, return true; } -#if defined(CONFIG_DEBUG_TCG_INTERPRETER) -/* Show current bytecode. Used by tcg interpreter. */ -void tci_disas(uint8_t opc) -{ - const TCGOpDef *def = &tcg_op_defs[opc]; - fprintf(stderr, "TCG %s %u, %u, %u\n", - def->name, def->nb_oargs, def->nb_iargs, def->nb_cargs); -} -#endif - /* Write value (native size). */ static void tcg_out_i(TCGContext *s, tcg_target_ulong v) {
Signature · 1 line
2.25.1
PATCH v4 36/71 tcg/tci: Implement the disassembler properly
In reply to Richard HendersonActually print arguments as opposed to simply the opcodes and, uselessly, the argument counts. Reuse all of the helpers developed as part of the interpreter.
--- meson.build | 2 +- include/tcg/tcg-opc.h | 2 - disas/tci.c | 61 --------- tcg/tci.c | 283 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 284 insertions(+), 64 deletions(-) delete mode 100644 disas/tci.c
meson.build +1 -1
@@ -1925,7 +1925,7 @@ specific_ss.add(when: 'CONFIG_TCG', if_true: files( 'tcg/tcg-op.c', 'tcg/tcg.c', )) -specific_ss.add(when: 'CONFIG_TCG_INTERPRETER', if_true: files('disas/tci.c', 'tcg/tci.c')) +specific_ss.add(when: 'CONFIG_TCG_INTERPRETER', if_true: files('tcg/tci.c')) subdir('backends') subdir('disas')
include/tcg/tcg-opc.h +0 -2
@@ -278,10 +278,8 @@ DEF(last_generic, 0, 0, 0, TCG_OPF_NOT_PRESENT)#ifdef TCG_TARGET_INTERPRETER /* These opcodes are only for use between the tci generator and interpreter. */ DEF(tci_movi_i32, 1, 0, 1, TCG_OPF_NOT_PRESENT) -#if TCG_TARGET_REG_BITS ==64 DEF(tci_movi_i64, 1, 0, 1, TCG_OPF_64BIT | TCG_OPF_NOT_PRESENT)#endif -#endif #undef TLADDR_ARGS#undef DATA64_ARGS
disas/tci.c deleted +0 -61
61 lines not on this page · raw message
tcg/tci.c +283 -0
286 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v4 37/71 tcg: Build ffi data structures for helpers
In reply to Richard HendersonWe will shortly use libffi for tci, as that is the only portable way of calling arbitrary functions.
--- meson.build | 9 +- include/exec/helper-ffi.h | 115 +++++++++++++++++++++++++ include/exec/helper-tcg.h | 24 ++++-- target/hppa/helper.h | 2 + target/i386/ops_sse_header.h | 6 ++ target/m68k/helper.h | 1 + target/ppc/helper.h | 3 + tcg/tcg.c | 20 +++++ tests/docker/dockerfiles/fedora.docker | 1 + 9 files changed, 172 insertions(+), 9 deletions(-) create mode 100644 include/exec/helper-ffi.h
meson.build +8 -1
@@ -1925,7 +1925,14 @@ specific_ss.add(when: 'CONFIG_TCG', if_true: files( 'tcg/tcg-op.c', 'tcg/tcg.c', )) -specific_ss.add(when: 'CONFIG_TCG_INTERPRETER', if_true: files('tcg/tci.c')) + +if get_option('tcg_interpreter') + libffi = dependency('libffi', version: '>=3.0', + static: enable_static, method: 'pkg-config', + required: true) + specific_ss.add(libffi) + specific_ss.add(files('tcg/tci.c')) +endif subdir('backends') subdir('disas')
include/exec/helper-ffi.h new file +115 -0
115 lines not on this page · raw message
include/exec/helper-tcg.h +16 -8
@@ -10,50 +10,57 @@to get all the macros expanded first. */ #define str (s) #s +#ifdef CONFIG_TCG_INTERPRETER +# define DO_CIF (NAME ) .cif = &cif_##NAME, +#else +# define DO_CIF (NAME ) +#endif +#define DEF_HELPER_FLAGS_0 (NAME ,FLAGS , ret) \ - { .func = HELPER(NAME), .name = str(NAME), \ + { .func = HELPER(NAME), DO_CIF(NAME) .name = str(NAME), \ .flags = FLAGS | dh_callflag(ret), \ .sizemask = dh_sizemask(ret, 0) },#define DEF_HELPER_FLAGS_1 (NAME ,FLAGS , ret, t1) \ - { .func = HELPER(NAME), .name = str(NAME), \ + { .func = HELPER(NAME), DO_CIF(NAME) .name = str(NAME), \ .flags = FLAGS | dh_callflag(ret), \ .sizemask = dh_sizemask(ret, 0) | dh_sizemask(t1, 1) },#define DEF_HELPER_FLAGS_2 (NAME ,FLAGS , ret, t1, t2) \ - { .func = HELPER(NAME), .name = str(NAME), \ + { .func = HELPER(NAME), DO_CIF(NAME) .name = str(NAME), \ .flags = FLAGS | dh_callflag(ret), \ .sizemask = dh_sizemask(ret, 0) | dh_sizemask(t1, 1) \ | dh_sizemask(t2, 2) },#define DEF_HELPER_FLAGS_3 (NAME ,FLAGS , ret, t1, t2, t3) \ - { .func = HELPER(NAME), .name = str(NAME), \ + { .func = HELPER(NAME), DO_CIF(NAME) .name = str(NAME), \ .flags = FLAGS | dh_callflag(ret), \ .sizemask = dh_sizemask(ret, 0) | dh_sizemask(t1, 1) \ | dh_sizemask(t2, 2) | dh_sizemask(t3, 3) },#define DEF_HELPER_FLAGS_4 (NAME ,FLAGS , ret, t1, t2, t3, t4) \ - { .func = HELPER(NAME), .name = str(NAME), \ + { .func = HELPER(NAME), DO_CIF(NAME) .name = str(NAME), \ .flags = FLAGS | dh_callflag(ret), \ .sizemask = dh_sizemask(ret, 0) | dh_sizemask(t1, 1) \ | dh_sizemask(t2, 2) | dh_sizemask(t3, 3) | dh_sizemask(t4, 4) },#define DEF_HELPER_FLAGS_5 (NAME ,FLAGS , ret, t1, t2, t3, t4, t5) \ - { .func = HELPER(NAME), .name = str(NAME), \ + { .func = HELPER(NAME), DO_CIF(NAME) .name = str(NAME), \ .flags = FLAGS | dh_callflag(ret), \ .sizemask = dh_sizemask(ret, 0) | dh_sizemask(t1, 1) \ | dh_sizemask(t2, 2) | dh_sizemask(t3, 3) | dh_sizemask(t4, 4) \ | dh_sizemask(t5, 5) },#define DEF_HELPER_FLAGS_6 (NAME ,FLAGS , ret, t1, t2, t3, t4, t5, t6) \ - { .func = HELPER(NAME), .name = str(NAME), \ + { .func = HELPER(NAME), DO_CIF(NAME) .name = str(NAME), \ .flags = FLAGS | dh_callflag(ret), \ .sizemask = dh_sizemask(ret, 0) | dh_sizemask(t1, 1) \ | dh_sizemask(t2, 2) | dh_sizemask(t3, 3) | dh_sizemask(t4, 4) \ | dh_sizemask(t5, 5) | dh_sizemask(t6, 6) },#define DEF_HELPER_FLAGS_7 (NAME ,FLAGS , ret, t1, t2, t3, t4, t5, t6, t7) \ - { .func = HELPER(NAME), .name = str(NAME), .flags = FLAGS, \ + { .func = HELPER(NAME), DO_CIF(NAME) .name = str(NAME), \ + .flags = FLAGS | dh_callflag(ret), \ .sizemask = dh_sizemask(ret, 0) | dh_sizemask(t1, 1) \ | dh_sizemask(t2, 2) | dh_sizemask(t3, 3) | dh_sizemask(t4, 4) \ | dh_sizemask(t5, 5) | dh_sizemask(t6, 6) | dh_sizemask(t7, 7) },
@@ -64,6 +71,7 @@#include "plugin-helpers.h" #undef str +#undef DO_CIF#undef DEF_HELPER_FLAGS_0#undef DEF_HELPER_FLAGS_1#undef DEF_HELPER_FLAGS_2
target/hppa/helper.h +2 -0
@@ -1,9 +1,11 @@#if TARGET_REGISTER_BITS ==64 # define dh_alias_tr i64# define dh_is_64bit_tr 1 +# define dh_ffitype_tr dh_ffitype_i64#else # define dh_alias_tr i32# define dh_is_64bit_tr 0 +# define dh_ffitype_tr dh_ffitype_i32#endif #define dh_ctype_tr target_ureg#define dh_is_signed_tr 0
target/i386/ops_sse_header.h +6 -0
@@ -27,13 +27,19 @@#define dh_alias_Reg ptr#define dh_alias_ZMMReg ptr#define dh_alias_MMXReg ptr +#define dh_ctype_Reg Reg *#define dh_ctype_ZMMReg ZMMReg *#define dh_ctype_MMXReg MMXReg * +#define dh_is_signed_Reg dh_is_signed_ptr#define dh_is_signed_ZMMReg dh_is_signed_ptr#define dh_is_signed_MMXReg dh_is_signed_ptr +#define dh_ffitype_Reg dh_ffitype_ptr +#define dh_ffitype_ZMMReg dh_ffitype_ptr +#define dh_ffitype_MMXReg dh_ffitype_ptr + DEF_HELPER_3(glue(psrlw, SUFFIX), void, env, Reg, Reg) DEF_HELPER_3(glue(psraw, SUFFIX), void, env, Reg, Reg)DEF_HELPER_3 (glue (psllw,SUFFIX ), void, env, Reg, Reg)
target/m68k/helper.h +1 -0
@@ -18,6 +18,7 @@ DEF_HELPER_4(cas2l_parallel, void, env, i32, i32, i32)#define dh_alias_fp ptr#define dh_ctype_fp FPReg *#define dh_is_signed_fp dh_is_signed_ptr +#define dh_ffitype_fp dh_ffitype_ptr DEF_HELPER_3(exts32, void, env, fp, s32)DEF_HELPER_3 (extf32, void, env, fp, f32)
target/ppc/helper.h +3 -0
@@ -108,10 +108,12 @@ DEF_HELPER_FLAGS_1(ftsqrt, TCG_CALL_NO_RWG_SE, i32, i64)#define dh_alias_avr ptr#define dh_ctype_avr ppc_avr_t *#define dh_is_signed_avr dh_is_signed_ptr +#define dh_ffitype_avr dh_ffitype_ptr#define dh_alias_vsr ptr#define dh_ctype_vsr ppc_vsr_t *#define dh_is_signed_vsr dh_is_signed_ptr +#define dh_ffitype_vsr dh_ffitype_ptr DEF_HELPER_3(vavgub, void, avr, avr, avr)DEF_HELPER_3 (vavguh, void, avr, avr, avr)
@@ -696,6 +698,7 @@ DEF_HELPER_3(store_601_batu, void, env, i32, tl)#define dh_alias_fprp ptr#define dh_ctype_fprp ppc_fprp_t *#define dh_is_signed_fprp dh_is_signed_ptr +#define dh_ffitype_fprp dh_ffitype_ptr DEF_HELPER_4(dadd, void, env, fprp, fprp, fprp)DEF_HELPER_4 (daddq, void, env, fprp, fprp, fprp)
tcg/tcg.c +20 -0
@@ -66,6 +66,10 @@#include "exec/log.h" #include "sysemu/sysemu.h" +#ifdef CONFIG_TCG_INTERPRETER +#include <ffi.h> +#endif +/* Forward declarations for functions declared in tcg-target.c.inc and used here. */ static void tcg_target_init (TCGContext *s);
@@ -1082,6 +1086,9 @@ void tcg_pool_reset(TCGContext *s) typedef struct TCGHelperInfo { void *func; +#ifdef CONFIG_TCG_INTERPRETER + ffi_cif *cif; +#endif const char *name; unsigned flags; unsigned sizemask;
@@ -1089,6 +1096,10 @@ typedef struct TCGHelperInfo {#include "exec/helper-proto.h" +#ifdef CONFIG_TCG_INTERPRETER +#include "exec/helper-ffi.h" +#endif +static const TCGHelperInfo all_helpers[] = { #include "exec/helper-tcg.h" };
@@ -1136,6 +1147,15 @@ void tcg_context_init(TCGContext *s) (gpointer)&all_helpers[i]); } +#ifdef CONFIG_TCG_INTERPRETER +for (i =0 ; i <ARRAY_SIZE (all_helpers); ++i) { +ffi_cif *cif = all_helpers[i].cif; +ffi_status ok =ffi_prep_cif (cif,FFI_DEFAULT_ABI , cif->nargs, + cif->rtype, cif->arg_types); +tcg_debug_assert (ok ==FFI_OK ); + } +#endif +tcg_target_init (s);process_op_defs (s);
tests/docker/dockerfiles/fedora.docker +1 -0
@@ -32,6 +32,7 @@ ENV PACKAGES \ libcurl-devel \ libepoxy-devel \ libfdt-devel \ + libffi-devel \ libiscsi-devel \ libjpeg-devel \ libpmem-devel \
Signature · 1 line
2.25.1
PATCH v4 38/71 tcg/tci: Use ffi for calls
In reply to Richard HendersonThis requires adjusting where arguments are stored. Place them on the stack at left-aligned positions. Adjust the stack frame to be at entirely positive offsets.
--- include/tcg/tcg.h | 1 + tcg/tci/tcg-target.h | 2 +- tcg/tcg.c | 72 ++++++++++++-------- tcg/tci.c | 138 +++++++++++++++++++++++---------------- tcg/tci/tcg-target.c.inc | 50 +++++++------- 5 files changed, 150 insertions(+), 113 deletions(-)
include/tcg/tcg.h +1 -0
@@ -53,6 +53,7 @@#define MAX_OPC_PARAM (4 + (MAX_OPC_PARAM_PER_ARG * MAX_OPC_PARAM_ARGS))#define CPU_TEMP_BUF_NLONGS 128 +#define TCG_STATIC_FRAME_SIZE (CPU_TEMP_BUF_NLONGS * sizeof(long))/* Default target word size to pointer size. */ #ifndef TCG_TARGET_REG_BITS
tcg/tci/tcg-target.h +1 -1
@@ -161,7 +161,7 @@ typedef enum {/* Used for function call generation. */ #define TCG_TARGET_CALL_STACK_OFFSET 0 -#define TCG_TARGET_STACK_ALIGN 16 +#define TCG_TARGET_STACK_ALIGN 8#define HAVE_TCG_QEMU_TB_EXEC
tcg/tcg.c +43 -29
97 lines not on this page · raw message
tcg/tci.c +81 -57
198 lines not on this page · raw message
tcg/tci/tcg-target.c.inc +24 -26
77 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v4 39/71 tcg/tci: Improve tcg_target_call_clobber_regs
In reply to Richard HendersonThe current setting is much too pessimistic. Indicating only the one or two registers that are actually assigned after a call should avoid unnecessary movement between the register array and the stack array.
--- tcg/tci/tcg-target.c.inc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
tcg/tci/tcg-target.c.inc +8 -2
@@ -623,8 +623,14 @@ static void tcg_target_init(TCGContext *s) tcg_target_available_regs[TCG_TYPE_I32] = BIT(TCG_TARGET_NB_REGS) - 1; /* Registers available for 64 bit operations. */ tcg_target_available_regs[TCG_TYPE_I64] = BIT(TCG_TARGET_NB_REGS) - 1; - /* TODO: Which registers should be set here? */ - tcg_target_call_clobber_regs = BIT(TCG_TARGET_NB_REGS) - 1; + /* + * The interpreter "registers" are in the local stack frame and + * cannot be clobbered by the called helper functions. However, + * the interpreter assumes a 64-bit return value and assigns to + * the return value registers. + */ + tcg_target_call_clobber_regs = + MAKE_64BIT_MASK(TCG_REG_R0, 64 / TCG_TARGET_REG_BITS); s->reserved_regs = 0; tcg_regset_set_reg(s->reserved_regs, TCG_REG_CALL_STACK);
Signature · 1 line
2.25.1
PATCH v4 40/71 tcg/tci: Move call-return regs to end of tcg_target_reg_alloc_order
In reply to Richard HendersonAs the only call-clobbered regs for TCI, these should receive the least priority.
--- tcg/tci/tcg-target.c.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tcg/tci/tcg-target.c.inc +2 -2
@@ -170,8 +170,6 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) } static const int tcg_target_reg_alloc_order[] = { - TCG_REG_R0, - TCG_REG_R1, TCG_REG_R2, TCG_REG_R3, TCG_REG_R4,
@@ -186,6 +184,8 @@ static const int tcg_target_reg_alloc_order[] = { TCG_REG_R13, TCG_REG_R14, TCG_REG_R15, + TCG_REG_R1, + TCG_REG_R0, }; #if MAX_OPC_PARAM_IARGS != 6
Signature · 1 line
2.25.1
PATCH v4 41/71 tcg/tci: Push opcode emit into each case
In reply to Richard HendersonWe're about to split out bytecode output into helpers, but we can't do that one at a time if tcg_out_op_t is being done outside of the switch.
--- tcg/tci/tcg-target.c.inc | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-)
tcg/tci/tcg-target.c.inc +32 -3
@@ -385,40 +385,48 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, { uint8_t *old_code_ptr = s->code_ptr; - tcg_out_op_t(s, opc); - switch (opc) { case INDEX_op_exit_tb: + tcg_out_op_t(s, opc); tcg_out_i(s, args[0]); + old_code_ptr[1] = s->code_ptr - old_code_ptr; break; case INDEX_op_goto_tb: tcg_debug_assert(s->tb_jmp_insn_offset == 0); /* indirect jump method. */ + tcg_out_op_t(s, opc); tcg_out_i(s, (uintptr_t)(s->tb_jmp_target_addr + args[0])); + old_code_ptr[1] = s->code_ptr - old_code_ptr; set_jmp_reset_offset(s, args[0]); break; case INDEX_op_br: + tcg_out_op_t(s, opc); tci_out_label(s, arg_label(args[0])); + old_code_ptr[1] = s->code_ptr - old_code_ptr; break; CASE_32_64(setcond) + tcg_out_op_t(s, opc); tcg_out_r(s, args[0]); tcg_out_r(s, args[1]); tcg_out_r(s, args[2]); tcg_out8(s, args[3]); /* condition */ + old_code_ptr[1] = s->code_ptr - old_code_ptr; break; #if TCG_TARGET_REG_BITS == 32 case INDEX_op_setcond2_i32: /* setcond2_i32 cond, t0, t1_low, t1_high, t2_low, t2_high */ + tcg_out_op_t(s, opc); tcg_out_r(s, args[0]); tcg_out_r(s, args[1]); tcg_out_r(s, args[2]); tcg_out_r(s, args[3]); tcg_out_r(s, args[4]); tcg_out8(s, args[5]); /* condition */ + old_code_ptr[1] = s->code_ptr - old_code_ptr; break; #endif
@@ -436,10 +444,12 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, CASE_64(st32) CASE_64(st) stack_bounds_check(args[1], args[2]); + tcg_out_op_t(s, opc); tcg_out_r(s, args[0]); tcg_out_r(s, args[1]); tcg_debug_assert(args[2] == (int32_t)args[2]); tcg_out32(s, args[2]); + old_code_ptr[1] = s->code_ptr - old_code_ptr; break; CASE_32_64(add)
@@ -462,12 +472,15 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, CASE_32_64(divu) /* Optional (TCG_TARGET_HAS_div_*). */ CASE_32_64(rem) /* Optional (TCG_TARGET_HAS_div_*). */ CASE_32_64(remu) /* Optional (TCG_TARGET_HAS_div_*). */ + tcg_out_op_t(s, opc); tcg_out_r(s, args[0]); tcg_out_r(s, args[1]); tcg_out_r(s, args[2]); + old_code_ptr[1] = s->code_ptr - old_code_ptr; break; CASE_32_64(deposit) /* Optional (TCG_TARGET_HAS_deposit_*). */ + tcg_out_op_t(s, opc); { TCGArg pos = args[3], len = args[4]; TCGArg max = opc == INDEX_op_deposit_i32 ? 32 : 64;
@@ -481,13 +494,16 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, tcg_out8(s, pos); tcg_out8(s, len); } + old_code_ptr[1] = s->code_ptr - old_code_ptr; break; CASE_32_64(brcond) + tcg_out_op_t(s, opc); tcg_out_r(s, args[0]); tcg_out_r(s, args[1]); tcg_out8(s, args[2]); /* condition */ tci_out_label(s, arg_label(args[3])); + old_code_ptr[1] = s->code_ptr - old_code_ptr; break; CASE_32_64(neg) /* Optional (TCG_TARGET_HAS_neg_*). */
@@ -503,48 +519,59 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, CASE_32_64(bswap16) /* Optional (TCG_TARGET_HAS_bswap16_*). */ CASE_32_64(bswap32) /* Optional (TCG_TARGET_HAS_bswap32_*). */ CASE_64(bswap64) /* Optional (TCG_TARGET_HAS_bswap64_i64). */ + tcg_out_op_t(s, opc); tcg_out_r(s, args[0]); tcg_out_r(s, args[1]); + old_code_ptr[1] = s->code_ptr - old_code_ptr; break; #if TCG_TARGET_REG_BITS == 32 case INDEX_op_add2_i32: case INDEX_op_sub2_i32: + tcg_out_op_t(s, opc); tcg_out_r(s, args[0]); tcg_out_r(s, args[1]); tcg_out_r(s, args[2]); tcg_out_r(s, args[3]); tcg_out_r(s, args[4]); tcg_out_r(s, args[5]); + old_code_ptr[1] = s->code_ptr - old_code_ptr; break; case INDEX_op_brcond2_i32: + tcg_out_op_t(s, opc); tcg_out_r(s, args[0]); tcg_out_r(s, args[1]); tcg_out_r(s, args[2]); tcg_out_r(s, args[3]); tcg_out8(s, args[4]); /* condition */ tci_out_label(s, arg_label(args[5])); + old_code_ptr[1] = s->code_ptr - old_code_ptr; break; case INDEX_op_mulu2_i32: + tcg_out_op_t(s, opc); tcg_out_r(s, args[0]); tcg_out_r(s, args[1]); tcg_out_r(s, args[2]); tcg_out_r(s, args[3]); + old_code_ptr[1] = s->code_ptr - old_code_ptr; break; #endif case INDEX_op_qemu_ld_i32: case INDEX_op_qemu_st_i32: + tcg_out_op_t(s, opc); tcg_out_r(s, *args++); tcg_out_r(s, *args++); if (TARGET_LONG_BITS > TCG_TARGET_REG_BITS) { tcg_out_r(s, *args++); } tcg_out32(s, *args++); + old_code_ptr[1] = s->code_ptr - old_code_ptr; break; case INDEX_op_qemu_ld_i64: case INDEX_op_qemu_st_i64: + tcg_out_op_t(s, opc); tcg_out_r(s, *args++); if (TCG_TARGET_REG_BITS == 32) { tcg_out_r(s, *args++);
@@ -554,9 +581,12 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, tcg_out_r(s, *args++); } tcg_out32(s, *args++); + old_code_ptr[1] = s->code_ptr - old_code_ptr; break; case INDEX_op_mb: + tcg_out_op_t(s, opc); + old_code_ptr[1] = s->code_ptr - old_code_ptr; break; case INDEX_op_mov_i32: /* Always emitted via tcg_out_mov. */
@@ -565,7 +595,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, default: tcg_abort(); } - old_code_ptr[1] = s->code_ptr - old_code_ptr; } static void tcg_out_st(TCGContext *s, TCGType type, TCGReg arg, TCGReg arg1,
Signature · 1 line
2.25.1
PATCH v4 42/71 tcg/tci: Split out tcg_out_op_rrs
In reply to Richard Henderson--- tcg/tci/tcg-target.c.inc | 84 +++++++++++++++++++--------------------- 1 file changed, 39 insertions(+), 45 deletions(-)
tcg/tci/tcg-target.c.inc +39 -45
@@ -283,32 +283,38 @@ static void stack_bounds_check(TCGReg base, target_long offset) } } -static void tcg_out_ld(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg1, - intptr_t arg2) +static void tcg_out_op_rrs(TCGContext *s, TCGOpcode op, + TCGReg r0, TCGReg r1, intptr_t i2) { uint8_t *old_code_ptr = s->code_ptr; - stack_bounds_check(arg1, arg2); - if (type == TCG_TYPE_I32) { - tcg_out_op_t(s, INDEX_op_ld_i32); - tcg_out_r(s, ret); - tcg_out_r(s, arg1); - tcg_out32(s, arg2); - } else { - tcg_debug_assert(type == TCG_TYPE_I64); -#if TCG_TARGET_REG_BITS == 64 - tcg_out_op_t(s, INDEX_op_ld_i64); - tcg_out_r(s, ret); - tcg_out_r(s, arg1); - tcg_debug_assert(arg2 == (int32_t)arg2); - tcg_out32(s, arg2); -#else - TODO(); -#endif - } + tcg_out_op_t(s, op); + tcg_out_r(s, r0); + tcg_out_r(s, r1); + tcg_debug_assert(i2 == (int32_t)i2); + tcg_out32(s, i2); + old_code_ptr[1] = s->code_ptr - old_code_ptr; } +static void tcg_out_ld(TCGContext *s, TCGType type, TCGReg val, TCGReg base, + intptr_t offset) +{ + stack_bounds_check(base, offset); + switch (type) { + case TCG_TYPE_I32: + tcg_out_op_rrs(s, INDEX_op_ld_i32, val, base, offset); + break; +#if TCG_TARGET_REG_BITS == 64 + case TCG_TYPE_I64: + tcg_out_op_rrs(s, INDEX_op_ld_i64, val, base, offset); + break; +#endif + default: + g_assert_not_reached(); + } +} + static bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg) { uint8_t *old_code_ptr = s->code_ptr;
@@ -444,12 +450,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, CASE_64(st32) CASE_64(st) stack_bounds_check(args[1], args[2]); - tcg_out_op_t(s, opc); - tcg_out_r(s, args[0]); - tcg_out_r(s, args[1]); - tcg_debug_assert(args[2] == (int32_t)args[2]); - tcg_out32(s, args[2]); - old_code_ptr[1] = s->code_ptr - old_code_ptr; + tcg_out_op_rrs(s, opc, args[0], args[1], args[2]); break; CASE_32_64(add)
@@ -597,29 +598,22 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, } } -static void tcg_out_st(TCGContext *s, TCGType type, TCGReg arg, TCGReg arg1, - intptr_t arg2) +static void tcg_out_st(TCGContext *s, TCGType type, TCGReg val, TCGReg base, + intptr_t offset) { - uint8_t *old_code_ptr = s->code_ptr; - - stack_bounds_check(arg1, arg2); - if (type == TCG_TYPE_I32) { - tcg_out_op_t(s, INDEX_op_st_i32); - tcg_out_r(s, arg); - tcg_out_r(s, arg1); - tcg_out32(s, arg2); - } else { - tcg_debug_assert(type == TCG_TYPE_I64); + stack_bounds_check(base, offset); + switch (type) { + case TCG_TYPE_I32: + tcg_out_op_rrs(s, INDEX_op_st_i32, val, base, offset); + break; #if TCG_TARGET_REG_BITS == 64 - tcg_out_op_t(s, INDEX_op_st_i64); - tcg_out_r(s, arg); - tcg_out_r(s, arg1); - tcg_out32(s, arg2); -#else - TODO(); + case TCG_TYPE_I64: + tcg_out_op_rrs(s, INDEX_op_st_i64, val, base, offset); + break; #endif + default: + g_assert_not_reached(); } - old_code_ptr[1] = s->code_ptr - old_code_ptr; } static inline bool tcg_out_sti(TCGContext *s, TCGType type, TCGArg val,
Signature · 1 line
2.25.1
PATCH v4 43/71 tcg/tci: Split out tcg_out_op_l
In reply to Richard Henderson--- tcg/tci/tcg-target.c.inc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
tcg/tci/tcg-target.c.inc +11 -3
@@ -283,6 +283,16 @@ static void stack_bounds_check(TCGReg base, target_long offset) } } +static void tcg_out_op_l(TCGContext *s, TCGOpcode op, TCGLabel *l0) +{ + uint8_t *old_code_ptr = s->code_ptr; + + tcg_out_op_t(s, op); + tci_out_label(s, l0); + + old_code_ptr[1] = s->code_ptr - old_code_ptr; +} + static void tcg_out_op_rrs(TCGContext *s, TCGOpcode op, TCGReg r0, TCGReg r1, intptr_t i2) {
@@ -408,9 +418,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, break; case INDEX_op_br: - tcg_out_op_t(s, opc); - tci_out_label(s, arg_label(args[0])); - old_code_ptr[1] = s->code_ptr - old_code_ptr; + tcg_out_op_l(s, opc, arg_label(args[0])); break; CASE_32_64(setcond)
Signature · 1 line
2.25.1
PATCH v4 44/71 tcg/tci: Split out tcg_out_op_p
In reply to Richard Henderson--- tcg/tci/tcg-target.c.inc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
tcg/tci/tcg-target.c.inc +12 -6
@@ -293,6 +293,16 @@ static void tcg_out_op_l(TCGContext *s, TCGOpcode op, TCGLabel *l0) old_code_ptr[1] = s->code_ptr - old_code_ptr; } +static void tcg_out_op_p(TCGContext *s, TCGOpcode op, void *p0) +{ + uint8_t *old_code_ptr = s->code_ptr; + + tcg_out_op_t(s, op); + tcg_out_i(s, (uintptr_t)p0); + + old_code_ptr[1] = s->code_ptr - old_code_ptr; +} + static void tcg_out_op_rrs(TCGContext *s, TCGOpcode op, TCGReg r0, TCGReg r1, intptr_t i2) {
@@ -403,17 +413,13 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, switch (opc) { case INDEX_op_exit_tb: - tcg_out_op_t(s, opc); - tcg_out_i(s, args[0]); - old_code_ptr[1] = s->code_ptr - old_code_ptr; + tcg_out_op_p(s, opc, (void *)args[0]); break; case INDEX_op_goto_tb: tcg_debug_assert(s->tb_jmp_insn_offset == 0); /* indirect jump method. */ - tcg_out_op_t(s, opc); - tcg_out_i(s, (uintptr_t)(s->tb_jmp_target_addr + args[0])); - old_code_ptr[1] = s->code_ptr - old_code_ptr; + tcg_out_op_p(s, opc, s->tb_jmp_target_addr + args[0]); set_jmp_reset_offset(s, args[0]); break;
Signature · 1 line
2.25.1
PATCH v4 45/71 tcg/tci: Split out tcg_out_op_rr
In reply to Richard HendersonAt the same time, validate the type argument in tcg_out_mov.
--- tcg/tci/tcg-target.c.inc | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-)
tcg/tci/tcg-target.c.inc +23 -13
@@ -303,6 +303,17 @@ static void tcg_out_op_p(TCGContext *s, TCGOpcode op, void *p0) old_code_ptr[1] = s->code_ptr - old_code_ptr; } +static void tcg_out_op_rr(TCGContext *s, TCGOpcode op, TCGReg r0, TCGReg r1) +{ + uint8_t *old_code_ptr = s->code_ptr; + + tcg_out_op_t(s, op); + tcg_out_r(s, r0); + tcg_out_r(s, r1); + + old_code_ptr[1] = s->code_ptr - old_code_ptr; +} + static void tcg_out_op_rrs(TCGContext *s, TCGOpcode op, TCGReg r0, TCGReg r1, intptr_t i2) {
@@ -337,16 +348,18 @@ static void tcg_out_ld(TCGContext *s, TCGType type, TCGReg val, TCGReg base, static bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg) { - uint8_t *old_code_ptr = s->code_ptr; - tcg_debug_assert(ret != arg); -#if TCG_TARGET_REG_BITS == 32 - tcg_out_op_t(s, INDEX_op_mov_i32); -#else - tcg_out_op_t(s, INDEX_op_mov_i64); + switch (type) { + case TCG_TYPE_I32: + tcg_out_op_rr(s, INDEX_op_mov_i32, ret, arg); + break; +#if TCG_TARGET_REG_BITS == 64 + case TCG_TYPE_I64: + tcg_out_op_rr(s, INDEX_op_mov_i64, ret, arg); + break; #endif - tcg_out_r(s, ret); - tcg_out_r(s, arg); - old_code_ptr[1] = s->code_ptr - old_code_ptr; + default: + g_assert_not_reached(); + } return true; }
@@ -534,10 +547,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, CASE_32_64(bswap16) /* Optional (TCG_TARGET_HAS_bswap16_*). */ CASE_32_64(bswap32) /* Optional (TCG_TARGET_HAS_bswap32_*). */ CASE_64(bswap64) /* Optional (TCG_TARGET_HAS_bswap64_i64). */ - tcg_out_op_t(s, opc); - tcg_out_r(s, args[0]); - tcg_out_r(s, args[1]); - old_code_ptr[1] = s->code_ptr - old_code_ptr; + tcg_out_op_rr(s, opc, args[0], args[1]); break; #if TCG_TARGET_REG_BITS == 32
Signature · 1 line
2.25.1
PATCH v4 46/71 tcg/tci: Split out tcg_out_op_rrr
In reply to Richard Henderson--- tcg/tci/tcg-target.c.inc | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
tcg/tci/tcg-target.c.inc +14 -5
@@ -314,6 +314,19 @@ static void tcg_out_op_rr(TCGContext *s, TCGOpcode op, TCGReg r0, TCGReg r1) old_code_ptr[1] = s->code_ptr - old_code_ptr; } +static void tcg_out_op_rrr(TCGContext *s, TCGOpcode op, + TCGReg r0, TCGReg r1, TCGReg r2) +{ + uint8_t *old_code_ptr = s->code_ptr; + + tcg_out_op_t(s, op); + tcg_out_r(s, r0); + tcg_out_r(s, r1); + tcg_out_r(s, r2); + + old_code_ptr[1] = s->code_ptr - old_code_ptr; +} + static void tcg_out_op_rrs(TCGContext *s, TCGOpcode op, TCGReg r0, TCGReg r1, intptr_t i2) {
@@ -500,11 +513,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, CASE_32_64(divu) /* Optional (TCG_TARGET_HAS_div_*). */ CASE_32_64(rem) /* Optional (TCG_TARGET_HAS_div_*). */ CASE_32_64(remu) /* Optional (TCG_TARGET_HAS_div_*). */ - tcg_out_op_t(s, opc); - tcg_out_r(s, args[0]); - tcg_out_r(s, args[1]); - tcg_out_r(s, args[2]); - old_code_ptr[1] = s->code_ptr - old_code_ptr; + tcg_out_op_rrr(s, opc, args[0], args[1], args[2]); break; CASE_32_64(deposit) /* Optional (TCG_TARGET_HAS_deposit_*). */
Signature · 1 line
2.25.1
PATCH v4 47/71 tcg/tci: Split out tcg_out_op_rrrc
In reply to Richard Henderson--- tcg/tci/tcg-target.c.inc | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)
tcg/tci/tcg-target.c.inc +15 -6
@@ -341,6 +341,20 @@ static void tcg_out_op_rrs(TCGContext *s, TCGOpcode op, old_code_ptr[1] = s->code_ptr - old_code_ptr; } +static void tcg_out_op_rrrc(TCGContext *s, TCGOpcode op, + TCGReg r0, TCGReg r1, TCGReg r2, TCGCond c3) +{ + uint8_t *old_code_ptr = s->code_ptr; + + tcg_out_op_t(s, op); + tcg_out_r(s, r0); + tcg_out_r(s, r1); + tcg_out_r(s, r2); + tcg_out8(s, c3); + + old_code_ptr[1] = s->code_ptr - old_code_ptr; +} + static void tcg_out_ld(TCGContext *s, TCGType type, TCGReg val, TCGReg base, intptr_t offset) {
@@ -454,12 +468,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, break; CASE_32_64(setcond) - tcg_out_op_t(s, opc); - tcg_out_r(s, args[0]); - tcg_out_r(s, args[1]); - tcg_out_r(s, args[2]); - tcg_out8(s, args[3]); /* condition */ - old_code_ptr[1] = s->code_ptr - old_code_ptr; + tcg_out_op_rrrc(s, opc, args[0], args[1], args[2], args[3]); break; #if TCG_TARGET_REG_BITS == 32
Signature · 1 line
2.25.1
PATCH v4 48/71 tcg/tci: Split out tcg_out_op_rrrrrc
In reply to Richard Henderson--- tcg/tci/tcg-target.c.inc | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-)
tcg/tci/tcg-target.c.inc +21 -9
@@ -355,6 +355,25 @@ static void tcg_out_op_rrrc(TCGContext *s, TCGOpcode op, old_code_ptr[1] = s->code_ptr - old_code_ptr; } +#if TCG_TARGET_REG_BITS == 32 +static void tcg_out_op_rrrrrc(TCGContext *s, TCGOpcode op, + TCGReg r0, TCGReg r1, TCGReg r2, + TCGReg r3, TCGReg r4, TCGCond c5) +{ + uint8_t *old_code_ptr = s->code_ptr; + + tcg_out_op_t(s, op); + tcg_out_r(s, r0); + tcg_out_r(s, r1); + tcg_out_r(s, r2); + tcg_out_r(s, r3); + tcg_out_r(s, r4); + tcg_out8(s, c5); + + old_code_ptr[1] = s->code_ptr - old_code_ptr; +} +#endif + static void tcg_out_ld(TCGContext *s, TCGType type, TCGReg val, TCGReg base, intptr_t offset) {
@@ -473,15 +492,8 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, #if TCG_TARGET_REG_BITS == 32 case INDEX_op_setcond2_i32: - /* setcond2_i32 cond, t0, t1_low, t1_high, t2_low, t2_high */ - tcg_out_op_t(s, opc); - tcg_out_r(s, args[0]); - tcg_out_r(s, args[1]); - tcg_out_r(s, args[2]); - tcg_out_r(s, args[3]); - tcg_out_r(s, args[4]); - tcg_out8(s, args[5]); /* condition */ - old_code_ptr[1] = s->code_ptr - old_code_ptr; + tcg_out_op_rrrrrc(s, opc, args[0], args[1], args[2], + args[3], args[4], args[5]); break; #endif
Signature · 1 line
2.25.1
PATCH v4 49/71 tcg/tci: Split out tcg_out_op_rrrbb
In reply to Richard Henderson--- tcg/tci/tcg-target.c.inc | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)
tcg/tci/tcg-target.c.inc +16 -7
@@ -355,6 +355,21 @@ static void tcg_out_op_rrrc(TCGContext *s, TCGOpcode op, old_code_ptr[1] = s->code_ptr - old_code_ptr; } +static void tcg_out_op_rrrbb(TCGContext *s, TCGOpcode op, TCGReg r0, + TCGReg r1, TCGReg r2, uint8_t b3, uint8_t b4) +{ + uint8_t *old_code_ptr = s->code_ptr; + + tcg_out_op_t(s, op); + tcg_out_r(s, r0); + tcg_out_r(s, r1); + tcg_out_r(s, r2); + tcg_out8(s, b3); + tcg_out8(s, b4); + + old_code_ptr[1] = s->code_ptr - old_code_ptr; +} + #if TCG_TARGET_REG_BITS == 32 static void tcg_out_op_rrrrrc(TCGContext *s, TCGOpcode op, TCGReg r0, TCGReg r1, TCGReg r2,
@@ -538,7 +553,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, break; CASE_32_64(deposit) /* Optional (TCG_TARGET_HAS_deposit_*). */ - tcg_out_op_t(s, opc); { TCGArg pos = args[3], len = args[4]; TCGArg max = opc == INDEX_op_deposit_i32 ? 32 : 64;
@@ -546,13 +560,8 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, tcg_debug_assert(pos < max); tcg_debug_assert(pos + len <= max); - tcg_out_r(s, args[0]); - tcg_out_r(s, args[1]); - tcg_out_r(s, args[2]); - tcg_out8(s, pos); - tcg_out8(s, len); + tcg_out_op_rrrbb(s, opc, args[0], args[1], args[2], pos, len); } - old_code_ptr[1] = s->code_ptr - old_code_ptr; break; CASE_32_64(brcond)
Signature · 1 line
2.25.1
PATCH v4 50/71 tcg/tci: Split out tcg_out_op_rrcl
In reply to Richard Henderson--- tcg/tci/tcg-target.c.inc | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)
tcg/tci/tcg-target.c.inc +15 -6
@@ -341,6 +341,20 @@ static void tcg_out_op_rrs(TCGContext *s, TCGOpcode op, old_code_ptr[1] = s->code_ptr - old_code_ptr; } +static void tcg_out_op_rrcl(TCGContext *s, TCGOpcode op, + TCGReg r0, TCGReg r1, TCGCond c2, TCGLabel *l3) +{ + uint8_t *old_code_ptr = s->code_ptr; + + tcg_out_op_t(s, op); + tcg_out_r(s, r0); + tcg_out_r(s, r1); + tcg_out8(s, c2); + tci_out_label(s, l3); + + old_code_ptr[1] = s->code_ptr - old_code_ptr; +} + static void tcg_out_op_rrrc(TCGContext *s, TCGOpcode op, TCGReg r0, TCGReg r1, TCGReg r2, TCGCond c3) {
@@ -565,12 +579,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, break; CASE_32_64(brcond) - tcg_out_op_t(s, opc); - tcg_out_r(s, args[0]); - tcg_out_r(s, args[1]); - tcg_out8(s, args[2]); /* condition */ - tci_out_label(s, arg_label(args[3])); - old_code_ptr[1] = s->code_ptr - old_code_ptr; + tcg_out_op_rrcl(s, opc, args[0], args[1], args[2], arg_label(args[3])); break; CASE_32_64(neg) /* Optional (TCG_TARGET_HAS_neg_*). */
Signature · 1 line
2.25.1
PATCH v4 51/71 tcg/tci: Split out tcg_out_op_rrrrrr
In reply to Richard Henderson--- tcg/tci/tcg-target.c.inc | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-)
tcg/tci/tcg-target.c.inc +19 -8
@@ -401,6 +401,23 @@ static void tcg_out_op_rrrrrc(TCGContext *s, TCGOpcode op, old_code_ptr[1] = s->code_ptr - old_code_ptr; } + +static void tcg_out_op_rrrrrr(TCGContext *s, TCGOpcode op, + TCGReg r0, TCGReg r1, TCGReg r2, + TCGReg r3, TCGReg r4, TCGReg r5) +{ + uint8_t *old_code_ptr = s->code_ptr; + + tcg_out_op_t(s, op); + tcg_out_r(s, r0); + tcg_out_r(s, r1); + tcg_out_r(s, r2); + tcg_out_r(s, r3); + tcg_out_r(s, r4); + tcg_out_r(s, r5); + + old_code_ptr[1] = s->code_ptr - old_code_ptr; +} #endif static void tcg_out_ld(TCGContext *s, TCGType type, TCGReg val, TCGReg base,
@@ -601,14 +618,8 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, #if TCG_TARGET_REG_BITS == 32 case INDEX_op_add2_i32: case INDEX_op_sub2_i32: - tcg_out_op_t(s, opc); - tcg_out_r(s, args[0]); - tcg_out_r(s, args[1]); - tcg_out_r(s, args[2]); - tcg_out_r(s, args[3]); - tcg_out_r(s, args[4]); - tcg_out_r(s, args[5]); - old_code_ptr[1] = s->code_ptr - old_code_ptr; + tcg_out_op_rrrrrr(s, opc, args[0], args[1], args[2], + args[3], args[4], args[5]); break; case INDEX_op_brcond2_i32: tcg_out_op_t(s, opc);
Signature · 1 line
2.25.1
PATCH v4 52/71 tcg/tci: Split out tcg_out_op_rrrr
In reply to Richard Henderson--- tcg/tci/tcg-target.c.inc | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)
tcg/tci/tcg-target.c.inc +15 -6
@@ -385,6 +385,20 @@ static void tcg_out_op_rrrbb(TCGContext *s, TCGOpcode op, TCGReg r0, } #if TCG_TARGET_REG_BITS == 32 +static void tcg_out_op_rrrr(TCGContext *s, TCGOpcode op, + TCGReg r0, TCGReg r1, TCGReg r2, TCGReg r3) +{ + uint8_t *old_code_ptr = s->code_ptr; + + tcg_out_op_t(s, op); + tcg_out_r(s, r0); + tcg_out_r(s, r1); + tcg_out_r(s, r2); + tcg_out_r(s, r3); + + old_code_ptr[1] = s->code_ptr - old_code_ptr; +} + static void tcg_out_op_rrrrrc(TCGContext *s, TCGOpcode op, TCGReg r0, TCGReg r1, TCGReg r2, TCGReg r3, TCGReg r4, TCGCond c5)
@@ -632,12 +646,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, old_code_ptr[1] = s->code_ptr - old_code_ptr; break; case INDEX_op_mulu2_i32: - tcg_out_op_t(s, opc); - tcg_out_r(s, args[0]); - tcg_out_r(s, args[1]); - tcg_out_r(s, args[2]); - tcg_out_r(s, args[3]); - old_code_ptr[1] = s->code_ptr - old_code_ptr; + tcg_out_op_rrrr(s, opc, args[0], args[1], args[2], args[3]); break; #endif
Signature · 1 line
2.25.1
PATCH v4 53/71 tcg/tci: Split out tcg_out_op_rrrrcl
In reply to Richard Henderson--- tcg/tci/tcg-target.c.inc | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-)
tcg/tci/tcg-target.c.inc +19 -8
@@ -399,6 +399,23 @@ static void tcg_out_op_rrrr(TCGContext *s, TCGOpcode op, old_code_ptr[1] = s->code_ptr - old_code_ptr; } +static void tcg_out_op_rrrrcl(TCGContext *s, TCGOpcode op, + TCGReg r0, TCGReg r1, TCGReg r2, TCGReg r3, + TCGCond c4, TCGLabel *l5) +{ + uint8_t *old_code_ptr = s->code_ptr; + + tcg_out_op_t(s, op); + tcg_out_r(s, r0); + tcg_out_r(s, r1); + tcg_out_r(s, r2); + tcg_out_r(s, r3); + tcg_out8(s, c4); + tci_out_label(s, l5); + + old_code_ptr[1] = s->code_ptr - old_code_ptr; +} + static void tcg_out_op_rrrrrc(TCGContext *s, TCGOpcode op, TCGReg r0, TCGReg r1, TCGReg r2, TCGReg r3, TCGReg r4, TCGCond c5)
@@ -636,14 +653,8 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, args[3], args[4], args[5]); break; case INDEX_op_brcond2_i32: - tcg_out_op_t(s, opc); - tcg_out_r(s, args[0]); - tcg_out_r(s, args[1]); - tcg_out_r(s, args[2]); - tcg_out_r(s, args[3]); - tcg_out8(s, args[4]); /* condition */ - tci_out_label(s, arg_label(args[5])); - old_code_ptr[1] = s->code_ptr - old_code_ptr; + tcg_out_op_rrrrcl(s, opc, args[0], args[1], args[2], + args[3], args[4], arg_label(args[5])); break; case INDEX_op_mulu2_i32: tcg_out_op_rrrr(s, opc, args[0], args[1], args[2], args[3]);
Signature · 1 line
2.25.1
PATCH v4 54/71 tcg/tci: Split out tcg_out_op_{rrm,rrrm,rrrrm}
In reply to Richard Henderson--- tcg/tci/tcg-target.c.inc | 70 ++++++++++++++++++++++++++++++---------- 1 file changed, 53 insertions(+), 17 deletions(-)
tcg/tci/tcg-target.c.inc +53 -17
@@ -314,6 +314,19 @@ static void tcg_out_op_rr(TCGContext *s, TCGOpcode op, TCGReg r0, TCGReg r1) old_code_ptr[1] = s->code_ptr - old_code_ptr; } +static void tcg_out_op_rrm(TCGContext *s, TCGOpcode op, + TCGReg r0, TCGReg r1, TCGArg m2) +{ + uint8_t *old_code_ptr = s->code_ptr; + + tcg_out_op_t(s, op); + tcg_out_r(s, r0); + tcg_out_r(s, r1); + tcg_out32(s, m2); + + old_code_ptr[1] = s->code_ptr - old_code_ptr; +} + static void tcg_out_op_rrr(TCGContext *s, TCGOpcode op, TCGReg r0, TCGReg r1, TCGReg r2) {
@@ -369,6 +382,20 @@ static void tcg_out_op_rrrc(TCGContext *s, TCGOpcode op, old_code_ptr[1] = s->code_ptr - old_code_ptr; } +static void tcg_out_op_rrrm(TCGContext *s, TCGOpcode op, + TCGReg r0, TCGReg r1, TCGReg r2, TCGArg m3) +{ + uint8_t *old_code_ptr = s->code_ptr; + + tcg_out_op_t(s, op); + tcg_out_r(s, r0); + tcg_out_r(s, r1); + tcg_out_r(s, r2); + tcg_out32(s, m3); + + old_code_ptr[1] = s->code_ptr - old_code_ptr; +} + static void tcg_out_op_rrrbb(TCGContext *s, TCGOpcode op, TCGReg r0, TCGReg r1, TCGReg r2, uint8_t b3, uint8_t b4) {
@@ -384,6 +411,21 @@ static void tcg_out_op_rrrbb(TCGContext *s, TCGOpcode op, TCGReg r0, old_code_ptr[1] = s->code_ptr - old_code_ptr; } +static void tcg_out_op_rrrrm(TCGContext *s, TCGOpcode op, TCGReg r0, + TCGReg r1, TCGReg r2, TCGReg r3, TCGArg m4) +{ + uint8_t *old_code_ptr = s->code_ptr; + + tcg_out_op_t(s, op); + tcg_out_r(s, r0); + tcg_out_r(s, r1); + tcg_out_r(s, r2); + tcg_out_r(s, r3); + tcg_out32(s, m4); + + old_code_ptr[1] = s->code_ptr - old_code_ptr; +} + #if TCG_TARGET_REG_BITS == 32 static void tcg_out_op_rrrr(TCGContext *s, TCGOpcode op, TCGReg r0, TCGReg r1, TCGReg r2, TCGReg r3)
@@ -663,29 +705,23 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, case INDEX_op_qemu_ld_i32: case INDEX_op_qemu_st_i32: - tcg_out_op_t(s, opc); - tcg_out_r(s, *args++); - tcg_out_r(s, *args++); - if (TARGET_LONG_BITS > TCG_TARGET_REG_BITS) { - tcg_out_r(s, *args++); + if (TARGET_LONG_BITS <= TCG_TARGET_REG_BITS) { + tcg_out_op_rrm(s, opc, args[0], args[1], args[2]); + } else { + tcg_out_op_rrrm(s, opc, args[0], args[1], args[2], args[3]); } - tcg_out32(s, *args++); - old_code_ptr[1] = s->code_ptr - old_code_ptr; break; case INDEX_op_qemu_ld_i64: case INDEX_op_qemu_st_i64: - tcg_out_op_t(s, opc); - tcg_out_r(s, *args++); - if (TCG_TARGET_REG_BITS == 32) { - tcg_out_r(s, *args++); + if (TCG_TARGET_REG_BITS == 64) { + tcg_out_op_rrm(s, opc, args[0], args[1], args[2]); + } else if (TARGET_LONG_BITS <= TCG_TARGET_REG_BITS) { + tcg_out_op_rrrm(s, opc, args[0], args[1], args[2], args[3]); + } else { + tcg_out_op_rrrrm(s, opc, args[0], args[1], + args[2], args[3], args[4]); } - tcg_out_r(s, *args++); - if (TARGET_LONG_BITS > TCG_TARGET_REG_BITS) { - tcg_out_r(s, *args++); - } - tcg_out32(s, *args++); - old_code_ptr[1] = s->code_ptr - old_code_ptr; break; case INDEX_op_mb:
Signature · 1 line
2.25.1
PATCH v4 55/71 tcg/tci: Split out tcg_out_op_v
In reply to Richard Henderson--- tcg/tci/tcg-target.c.inc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
tcg/tci/tcg-target.c.inc +10 -4
@@ -303,6 +303,15 @@ static void tcg_out_op_p(TCGContext *s, TCGOpcode op, void *p0) old_code_ptr[1] = s->code_ptr - old_code_ptr; } +static void tcg_out_op_v(TCGContext *s, TCGOpcode op) +{ + uint8_t *old_code_ptr = s->code_ptr; + + tcg_out_op_t(s, op); + + old_code_ptr[1] = s->code_ptr - old_code_ptr; +} + static void tcg_out_op_rr(TCGContext *s, TCGOpcode op, TCGReg r0, TCGReg r1) { uint8_t *old_code_ptr = s->code_ptr;
@@ -587,8 +596,6 @@ static void tcg_out_call(TCGContext *s, const tcg_insn_unit *arg) static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, const int *const_args) { - uint8_t *old_code_ptr = s->code_ptr; - switch (opc) { case INDEX_op_exit_tb: tcg_out_op_p(s, opc, (void *)args[0]);
@@ -725,8 +732,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, break; case INDEX_op_mb: - tcg_out_op_t(s, opc); - old_code_ptr[1] = s->code_ptr - old_code_ptr; + tcg_out_op_v(s, opc); break; case INDEX_op_mov_i32: /* Always emitted via tcg_out_mov. */
Signature · 1 line
2.25.1
PATCH v4 56/71 tcg/tci: Split out tcg_out_op_np
In reply to Richard Henderson--- tcg/tci/tcg-target.c.inc | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
tcg/tci/tcg-target.c.inc +13 -5
@@ -312,6 +312,18 @@ static void tcg_out_op_v(TCGContext *s, TCGOpcode op) old_code_ptr[1] = s->code_ptr - old_code_ptr; } +static void tcg_out_op_np(TCGContext *s, TCGOpcode op, + uint8_t n0, const void *p1) +{ + uint8_t *old_code_ptr = s->code_ptr; + + tcg_out_op_t(s, op); + tcg_out8(s, n0); + tcg_out_i(s, (uintptr_t)p1); + + old_code_ptr[1] = s->code_ptr - old_code_ptr; +} + static void tcg_out_op_rr(TCGContext *s, TCGOpcode op, TCGReg r0, TCGReg r1) { uint8_t *old_code_ptr = s->code_ptr;
@@ -561,7 +573,6 @@ static void tcg_out_movi(TCGContext *s, TCGType type, static void tcg_out_call(TCGContext *s, const tcg_insn_unit *arg) { - uint8_t *old_code_ptr = s->code_ptr; const TCGHelperInfo *info; uint8_t which;
@@ -574,11 +585,8 @@ static void tcg_out_call(TCGContext *s, const tcg_insn_unit *arg) tcg_debug_assert(info->cif->rtype->size == 8); which = 2; } - tcg_out_op_t(s, INDEX_op_call); - tcg_out8(s, which); - tcg_out_i(s, (uintptr_t)info); - old_code_ptr[1] = s->code_ptr - old_code_ptr; + tcg_out_op_np(s, INDEX_op_call, which, info); } #if TCG_TARGET_REG_BITS == 64
Signature · 1 line
2.25.1
PATCH v4 57/71 tcg/tci: Split out tcg_out_op_r[iI]
In reply to Richard Henderson--- tcg/tci/tcg-target.c.inc | 50 ++++++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 15 deletions(-)
tcg/tci/tcg-target.c.inc +35 -15
@@ -324,6 +324,31 @@ static void tcg_out_op_np(TCGContext *s, TCGOpcode op, old_code_ptr[1] = s->code_ptr - old_code_ptr; } +static void tcg_out_op_ri(TCGContext *s, TCGOpcode op, TCGReg r0, int32_t i1) +{ + uint8_t *old_code_ptr = s->code_ptr; + + tcg_out_op_t(s, op); + tcg_out_r(s, r0); + tcg_out32(s, i1); + + old_code_ptr[1] = s->code_ptr - old_code_ptr; +} + +#if TCG_TARGET_REG_BITS == 64 +static void tcg_out_op_rI(TCGContext *s, TCGOpcode op, + TCGReg r0, uint64_t i1) +{ + uint8_t *old_code_ptr = s->code_ptr; + + tcg_out_op_t(s, op); + tcg_out_r(s, r0); + tcg_out64(s, i1); + + old_code_ptr[1] = s->code_ptr - old_code_ptr; +} +#endif + static void tcg_out_op_rr(TCGContext *s, TCGOpcode op, TCGReg r0, TCGReg r1) { uint8_t *old_code_ptr = s->code_ptr;
@@ -550,25 +575,20 @@ static bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg) } static void tcg_out_movi(TCGContext *s, TCGType type, - TCGReg t0, tcg_target_long arg) + TCGReg ret, tcg_target_long arg) { - uint8_t *old_code_ptr = s->code_ptr; - uint32_t arg32 = arg; - if (type == TCG_TYPE_I32 || arg == arg32) { - tcg_out_op_t(s, INDEX_op_tci_movi_i32); - tcg_out_r(s, t0); - tcg_out32(s, arg32); - } else { - tcg_debug_assert(type == TCG_TYPE_I64); + switch (type) { + case TCG_TYPE_I32: + tcg_out_op_ri(s, INDEX_op_tci_movi_i32, ret, arg); + break; #if TCG_TARGET_REG_BITS == 64 - tcg_out_op_t(s, INDEX_op_tci_movi_i64); - tcg_out_r(s, t0); - tcg_out64(s, arg); -#else - TODO(); + case TCG_TYPE_I64: + tcg_out_op_rI(s, INDEX_op_tci_movi_i64, ret, arg); + break; #endif + default: + g_assert_not_reached(); } - old_code_ptr[1] = s->code_ptr - old_code_ptr; } static void tcg_out_call(TCGContext *s, const tcg_insn_unit *arg)
Signature · 1 line
2.25.1
PATCH v4 58/71 tcg/tci: Reserve r13 for a temporary
In reply to Richard HendersonWe're about to adjust the offset range on host memory ops, and the format of branches. Both will require a temporary.
--- tcg/tci/tcg-target.h | 1 + tcg/tci/tcg-target.c.inc | 1 + 2 files changed, 2 insertions(+)
tcg/tci/tcg-target.h +1 -0
@@ -155,6 +155,7 @@ typedef enum {TCG_REG_R14 ,TCG_REG_R15 , +TCG_REG_TMP =TCG_REG_R13 ,TCG_AREG0 =TCG_REG_R14 ,TCG_REG_CALL_STACK =TCG_REG_R15 , } TCGReg;
tcg/tci/tcg-target.c.inc +1 -0
@@ -829,6 +829,7 @@ static void tcg_target_init(TCGContext *s) MAKE_64BIT_MASK(TCG_REG_R0, 64 / TCG_TARGET_REG_BITS); s->reserved_regs = 0; + tcg_regset_set_reg(s->reserved_regs, TCG_REG_TMP); tcg_regset_set_reg(s->reserved_regs, TCG_REG_CALL_STACK); /* The call arguments come first, followed by the temp storage. */
Signature · 1 line
2.25.1
PATCH v4 59/71 tcg/tci: Emit setcond before brcond
In reply to Richard HendersonThe encoding planned for tci does not have enough room for brcond2, with 4 registers and a condition as input as well as the label. Resolve the condition into TCG_REG_TMP, and relax brcond to one register plus a label, considering the condition to always be reg != 0.
--- tcg/tci.c | 68 ++++++++++------------------------------ tcg/tci/tcg-target.c.inc | 52 +++++++++++------------------- 2 files changed, 35 insertions(+), 85 deletions(-)
tcg/tci.c +17 -51
@@ -141,6 +141,16 @@ static void tci_args_nl(const uint8_t **tb_ptr, uint8_t *n0, void **l1)check_size (start, tb_ptr); } +static void tci_args_rl (const uint8_t **tb_ptr,TCGReg *r0,void **l1) +{ +const uint8_t *start = *tb_ptr; + + *r0 =tci_read_r (tb_ptr); + *l1 = (void *)tci_read_label (tb_ptr); + +check_size (start, tb_ptr); +} +static void tci_args_rr (const uint8_t **tb_ptr,TCGReg *r0,TCGReg *r1) {
@@ -212,19 +222,6 @@ static void tci_args_rrs(const uint8_t **tb_ptr,check_size (start, tb_ptr); } -static void tci_args_rrcl (const uint8_t **tb_ptr, -TCGReg *r0,TCGReg *r1,TCGCond *c2,void **l3) -{ -const uint8_t *start = *tb_ptr; - - *r0 =tci_read_r (tb_ptr); - *r1 =tci_read_r (tb_ptr); - *c2 =tci_read_b (tb_ptr); - *l3 = (void *)tci_read_label (tb_ptr); - -check_size (start, tb_ptr); -} -static void tci_args_rrrc (const uint8_t **tb_ptr,TCGReg *r0,TCGReg *r1,TCGReg *r2,TCGCond *c3) {
@@ -293,21 +290,6 @@ static void tci_args_rrrr(const uint8_t **tb_ptr,check_size (start, tb_ptr); } -static void tci_args_rrrrcl (const uint8_t **tb_ptr,TCGReg *r0,TCGReg *r1, -TCGReg *r2,TCGReg *r3,TCGCond *c4,void **l5) -{ -const uint8_t *start = *tb_ptr; - - *r0 =tci_read_r (tb_ptr); - *r1 =tci_read_r (tb_ptr); - *r2 =tci_read_r (tb_ptr); - *r3 =tci_read_r (tb_ptr); - *c4 =tci_read_b (tb_ptr); - *l5 = (void *)tci_read_label (tb_ptr); - -check_size (start, tb_ptr); -} -static void tci_args_rrrrrc (const uint8_t **tb_ptr,TCGReg *r0,TCGReg *r1,TCGReg *r2,TCGReg *r3,TCGReg *r4,TCGCond *c5) {
@@ -713,8 +695,8 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,break ;#endif case INDEX_op_brcond_i32: -tci_args_rrcl (&tb_ptr, &r0, &r1, &condition, &ptr); -if (tci_compare32 (regs[r0], regs[r1], condition)) { +tci_args_rl (&tb_ptr, &r0, &ptr); +if ((uint32_t )regs[r0]) { tb_ptr = ptr; }break ;
@@ -731,15 +713,6 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,T2 =tci_uint64 (regs[r5], regs[r4]);tci_write_reg64 (regs, r1, r0,T1 -T2 );break ; -case INDEX_op_brcond2_i32: -tci_args_rrrrcl (&tb_ptr, &r0, &r1, &r2, &r3, &condition, &ptr); -T1 =tci_uint64 (regs[r1], regs[r0]); -T2 =tci_uint64 (regs[r3], regs[r2]); -if (tci_compare64 (T1 ,T2 , condition)) { - tb_ptr = ptr; -continue ; - } -break ;case INDEX_op_mulu2_i32:tci_args_rrrr (&tb_ptr, &r0, &r1, &r2, &r3);tci_write_reg64 (regs, r1, r0, (uint64_t )regs[r2] * regs[r3]);
@@ -867,8 +840,8 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,break ;#endif case INDEX_op_brcond_i64: -tci_args_rrcl (&tb_ptr, &r0, &r1, &condition, &ptr); -if (tci_compare64 (regs[r0], regs[r1], condition)) { +tci_args_rl (&tb_ptr, &r0, &ptr); +if (regs[r0]) { tb_ptr = ptr; }break ;
@@ -1178,9 +1151,9 @@ int print_insn_tci(bfd_vma addr, disassemble_info *info)case INDEX_op_brcond_i32:case INDEX_op_brcond_i64: -tci_args_rrcl (&tb_ptr, &r0, &r1, &c, &ptr); - info->fprintf_func (info->stream,"%-12s %s,%s,%s,%p" , - op_name,str_r (r0),str_r (r1),str_c (c), ptr); +tci_args_rl (&tb_ptr, &r0, &ptr); + info->fprintf_func (info->stream,"%-12s %s,0,ne,%p" , + op_name,str_r (r0), ptr);break ;case INDEX_op_setcond_i32:
@@ -1305,13 +1278,6 @@ int print_insn_tci(bfd_vma addr, disassemble_info *info) str_r(r3), str_r(r4), str_c(c));break ; -case INDEX_op_brcond2_i32: -tci_args_rrrrcl (&tb_ptr, &r0, &r1, &r2, &r3, &c, &ptr); - info->fprintf_func (info->stream,"%-12s %s,%s,%s,%s,%s,%p" , - op_name,str_r (r0),str_r (r1), -str_r (r2),str_r (r3),str_c (c), ptr); -break ; -case INDEX_op_mulu2_i32:tci_args_rrrr (&tb_ptr, &r0, &r1, &r2, &r3); info->fprintf_func(info->stream, "%-12s %s,%s,%s,%s",
tcg/tci/tcg-target.c.inc +18 -34
82 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v4 60/71 tcg/tci: Remove tci_write_reg
In reply to Richard HendersonInline it into its one caller, tci_write_reg64. Drop the asserts that are redundant with tcg_read_r.
--- tcg/tci.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)
tcg/tci.c +2 -11
@@ -36,20 +36,11 @@ __threaduintptr_t tci_tb_ptr; -static void -tci_write_reg (tcg_target_ulong *regs,TCGReg index,tcg_target_ulong value) -{ -tci_assert (index <TCG_TARGET_NB_REGS ); -tci_assert (index !=TCG_AREG0 ); -tci_assert (index !=TCG_REG_CALL_STACK ); - regs[index] = value; -} -static void tci_write_reg64 (tcg_target_ulong *regs,uint32_t high_index,uint32_t low_index,uint64_t value) { -tci_write_reg (regs, low_index, value); -tci_write_reg (regs, high_index, value >>32 ); + regs[low_index] = value; + regs[high_index] = value >>32 ; }/* Create a 64 bit value from two 32 bit values. */
Signature · 1 line
2.25.1
PATCH v4 61/71 tcg/tci: Change encoding to uint32_t units
In reply to Richard HendersonThis removes all of the problems with unaligned accesses to the bytecode stream.
With an 8-bit opcode at the bottom, we have 24 bits remaining, which are generally split into 6 4-bit slots. This fits well with the maximum length opcodes, e.g. INDEX_op_add2_i386, which have 6 register operands.
We have, in previous patches, rearranged things such that there are no operations with a label, which have more than one other operand. Which leaves us with a 20-bit field in which to encode a label, giving us a maximum TB size of 512k -- easily large.
Change the INDEX_op_tci_movi_{i32,i64} opcodes to tci_mov[il]. The former puts the immediate in the upper 20 bits of the insn, like we do for the label displacement. The later uses a label to reference an entry in the constant pool. Thus, in the worst case we still have a single memory reference for any constant, but now the constants are out-of-line of the bytecode and can be shared between different moves saving space.
Change INDEX_op_call to use a label to reference a pair of pointers in the constant pool. This removes the only slightly dodgy link with the layout of struct TCGHelperInfo.
The re-encode cannot be done in pieces.
--- include/tcg/tcg-opc.h | 4 +- tcg/tci/tcg-target.h | 3 +- tcg/tci.c | 534 +++++++++++++++------------------------ tcg/tci/tcg-target.c.inc | 386 +++++++++++++--------------- tcg/tci/README | 20 +- 5 files changed, 380 insertions(+), 567 deletions(-)
include/tcg/tcg-opc.h +2 -2
@@ -277,8 +277,8 @@ DEF(last_generic, 0, 0, 0, TCG_OPF_NOT_PRESENT)#ifdef TCG_TARGET_INTERPRETER /* These opcodes are only for use between the tci generator and interpreter. */ -DEF(tci_movi_i32, 1, 0, 1, TCG_OPF_NOT_PRESENT) -DEF(tci_movi_i64, 1, 0, 1, TCG_OPF_64BIT | TCG_OPF_NOT_PRESENT) +DEF(tci_movi, 1, 0, 1, TCG_OPF_NOT_PRESENT) +DEF(tci_movl, 1, 0, 1, TCG_OPF_NOT_PRESENT)#endif #undef TLADDR_ARGS
tcg/tci/tcg-target.h +2 -1
@@ -41,7 +41,7 @@#define TCG_TARGET_H #define TCG_TARGET_INTERPRETER 1 -#define TCG_TARGET_INSN_UNIT_SIZE 1 +#define TCG_TARGET_INSN_UNIT_SIZE 4#define TCG_TARGET_TLB_DISPLACEMENT_BITS 32#if UINTPTR_MAX ==UINT32_MAX
@@ -165,6 +165,7 @@ typedef enum {#define TCG_TARGET_STACK_ALIGN 8#define HAVE_TCG_QEMU_TB_EXEC +#define TCG_TARGET_NEED_POOL_LABELS /* We could notice __i386__ or __s390x__ and reduce the barriers depending on the host. But if you want performance, you use the normal backend.
tcg/tci.c +200 -334
1,046 lines not on this page · raw message
tcg/tci/tcg-target.c.inc +171 -215
545 lines not on this page · raw message
tcg/tci/README +5 -15
@@ -23,10 +23,12 @@ This is what TCI (Tiny Code Interpreter) does. Like each TCG host frontend, TCI implements the code generator in tcg-target.c.inc, tcg-target.h. Both files are in directory tcg/tci. -The additional file tcg/tci.c adds the interpreter. +The additional file tcg/tci.c adds the interpreter and disassembler. -The bytecode consists of opcodes (same numeric values as those used by -TCG), command length and arguments of variable size and number. +The bytecode consists of opcodes (with only a few exceptions, with +the same same numeric values and semantics as used by TCG), and up +to six arguments packed into a 32-bit integer. See comments in tci.c +for details on the encoding. 3) Usage
@@ -39,11 +41,6 @@ suggest using this option. Setting it automatically would need additional code in configure which must be fixed when new native TCG implementations are added. -System emulation should work on any 32 or 64 bit host. -User mode emulation might work. Maybe a new linker script (*.ld) -is needed. Byte order might be wrong (on big endian hosts) -and need fixes in configure. - For hosts with native TCG, the interpreter TCI can be enabled by configure --enable-tcg-interpreter
@@ -118,13 +115,6 @@ u1 = linux-user-test works in the interpreter. These opcodes raise a runtime exception, so it is possible to see where code must be added. -* The pseudo code is not optimized and still ugly. For hosts with special - alignment requirements, it needs some fixes (maybe aligned bytecode - would also improve speed for hosts which support byte alignment). - -* A better disassembler for the pseudo code would be nice (a very primitive - disassembler is included in tcg-target.c.inc). - * It might be useful to have a runtime option which selects the native TCG or TCI, so QEMU would have to include two TCGs. Today, selecting TCI is a configure option, so you need two compilations of QEMU.
Signature · 1 line
2.25.1
PATCH v4 62/71 tcg/tci: Implement goto_ptr
In reply to Richard HendersonThis operation is critical to staying within the interpretation loop longer, which avoids the overhead of setup and teardown for many TBs.
The check in tcg_prologue_init is disabled because TCI does want to use NULL to indicate exit, as opposed to branching to a real epilogue.
--- tcg/tci/tcg-target-con-set.h | 1 + tcg/tci/tcg-target.h | 2 +- tcg/tcg.c | 2 ++ tcg/tci.c | 19 +++++++++++++++++++ tcg/tci/tcg-target.c.inc | 16 ++++++++++++++++ 5 files changed, 39 insertions(+), 1 deletion(-)
tcg/tci/tcg-target-con-set.h +1 -0
@@ -9,6 +9,7 @@* Each operand should be a sequence of constraint letters as defined by * tcg-target-con-str.h; the constraint combination is inclusive or. */ +C_O0_I1(r) C_O0_I2(r, r) C_O0_I3(r, r, r) C_O0_I4(r, r, r, r)
tcg/tci/tcg-target.h +1 -1
@@ -86,7 +86,7 @@#define TCG_TARGET_HAS_muls2_i32 0#define TCG_TARGET_HAS_muluh_i32 0#define TCG_TARGET_HAS_mulsh_i32 0 -#define TCG_TARGET_HAS_goto_ptr 0 +#define TCG_TARGET_HAS_goto_ptr 1#define TCG_TARGET_HAS_direct_jump 0#define TCG_TARGET_HAS_qemu_st8_i32 0
tcg/tcg.c +2 -0
@@ -1314,10 +1314,12 @@ void tcg_prologue_init(TCGContext *s) }#endif +#ifndef CONFIG_TCG_INTERPRETER /* Assert that goto_ptr is implemented completely. */ if (TCG_TARGET_HAS_goto_ptr) {tcg_debug_assert (tcg_code_gen_epilogue !=NULL ); } +#endif }void tcg_func_start (TCGContext *s)
tcg/tci.c +19 -0
@@ -69,6 +69,11 @@ static void tci_args_l(uint32_t insn, const void *tb_ptr, void **l0) *l0 = diff ? (void *)tb_ptr + diff :NULL ; } +static void tci_args_r (uint32_t insn,TCGReg *r0) +{ + *r0 =extract32 (insn,8 ,4 ); +} +static void tci_args_nl (uint32_t insn,const void *tb_ptr,uint8_t *n0,void **l1) {
@@ -738,6 +743,15 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, tb_ptr = *(void **)ptr;break ; +case INDEX_op_goto_ptr: +tci_args_r (insn, &r0); + ptr = (void *)regs[r0]; +if (!ptr) { +return 0 ; + } + tb_ptr = ptr; +break ; +case INDEX_op_qemu_ld_i32:if (TARGET_LONG_BITS <=TCG_TARGET_REG_BITS ) {tci_args_rrm (insn, &r0, &r1, &oi);
@@ -995,6 +1009,11 @@ int print_insn_tci(bfd_vma addr, disassemble_info *info) info->fprintf_func (info->stream,"%-12s %p" , op_name, ptr);break ; +case INDEX_op_goto_ptr: +tci_args_r (insn, &r0); + info->fprintf_func (info->stream,"%-12s %s" , op_name,str_r (r0)); +break ; +case INDEX_op_call:tci_args_nl (insn, tb_ptr, &len, &ptr); info->fprintf_func (info->stream,"%-12s %d,%p" , op_name, len, ptr);
tcg/tci/tcg-target.c.inc +16 -0
@@ -27,6 +27,9 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) { switch (op) { + case INDEX_op_goto_ptr: + return C_O0_I1(r); + case INDEX_op_ld8u_i32: case INDEX_op_ld8s_i32: case INDEX_op_ld16u_i32:
@@ -263,6 +266,15 @@ static void tcg_out_op_p(TCGContext *s, TCGOpcode op, void *p0) tcg_out32(s, insn); } +static void tcg_out_op_r(TCGContext *s, TCGOpcode op, TCGReg r0) +{ + tcg_insn_unit insn = 0; + + insn = deposit32(insn, 0, 8, op); + insn = deposit32(insn, 8, 4, r0); + tcg_out32(s, insn); +} + static void tcg_out_op_v(TCGContext *s, TCGOpcode op) { tcg_out32(s, (uint8_t)op);
@@ -567,6 +579,10 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, set_jmp_reset_offset(s, args[0]); break; + case INDEX_op_goto_ptr: + tcg_out_op_r(s, opc, args[0]); + break; + case INDEX_op_br: tcg_out_op_l(s, opc, arg_label(args[0])); break;
Signature · 1 line
2.25.1
PATCH v4 63/71 tcg/tci: Implement movcond
In reply to Richard HendersonWhen this opcode is not available in the backend, tcg middle-end will expand this as a series of 5 opcodes. So implementing this saves bytecode space.
--- tcg/tci/tcg-target.h | 4 ++-- tcg/tci.c | 16 +++++++++++++++- tcg/tci/tcg-target.c.inc | 10 +++++++--- 3 files changed, 24 insertions(+), 6 deletions(-)
tcg/tci/tcg-target.h +2 -2
@@ -82,7 +82,7 @@#define TCG_TARGET_HAS_not_i32 1#define TCG_TARGET_HAS_orc_i32 0#define TCG_TARGET_HAS_rot_i32 1 -#define TCG_TARGET_HAS_movcond_i32 0 +#define TCG_TARGET_HAS_movcond_i32 1#define TCG_TARGET_HAS_muls2_i32 0#define TCG_TARGET_HAS_muluh_i32 0#define TCG_TARGET_HAS_mulsh_i32 0
@@ -119,7 +119,7 @@#define TCG_TARGET_HAS_not_i64 1#define TCG_TARGET_HAS_orc_i64 0#define TCG_TARGET_HAS_rot_i64 1 -#define TCG_TARGET_HAS_movcond_i64 0 +#define TCG_TARGET_HAS_movcond_i64 1#define TCG_TARGET_HAS_muls2_i64 0#define TCG_TARGET_HAS_add2_i32 0#define TCG_TARGET_HAS_sub2_i32 0
tcg/tci.c +15 -1
@@ -169,6 +169,7 @@ static void tci_args_rrrr(uint32_t insn, *r2 =extract32 (insn,16 ,4 ); *r3 = extract32(insn, 20, 4); } +#endif static void tci_args_rrrrrc (uint32_t insn,TCGReg *r0,TCGReg *r1,TCGReg *r2,TCGReg *r3,TCGReg *r4,TCGCond *c5)
@@ -181,6 +182,7 @@ static void tci_args_rrrrrc(uint32_t insn, TCGReg *r0, TCGReg *r1, *c5 =extract32 (insn,28 ,4 ); } +#if TCG_TARGET_REG_BITS ==32 static void tci_args_rrrrrr (uint32_t insn,TCGReg *r0,TCGReg *r1,TCGReg *r2,TCGReg *r3,TCGReg *r4,TCGReg *r5) {
@@ -421,6 +423,11 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,tci_args_rrrc (insn, &r0, &r1, &r2, &condition); regs[r0] =tci_compare32 (regs[r1], regs[r2], condition);break ; +case INDEX_op_movcond_i32: +tci_args_rrrrrc (insn, &r0, &r1, &r2, &r3, &r4, &condition); + tmp32 =tci_compare32 (regs[r1], regs[r2], condition); + regs[r0] = regs[tmp32 ? r3 : r4]; +break ;#if TCG_TARGET_REG_BITS ==32 case INDEX_op_setcond2_i32:tci_args_rrrrrc (insn, &r0, &r1, &r2, &r3, &r4, &condition);
@@ -433,6 +440,11 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,tci_args_rrrc (insn, &r0, &r1, &r2, &condition); regs[r0] =tci_compare64 (regs[r1], regs[r2], condition);break ; +case INDEX_op_movcond_i64: +tci_args_rrrrrc (insn, &r0, &r1, &r2, &r3, &r4, &condition); + tmp32 =tci_compare64 (regs[r1], regs[r2], condition); + regs[r0] = regs[tmp32 ? r3 : r4]; +break ;#endif CASE_32_64(mov) tci_args_rr(insn, &r0, &r1);
@@ -1138,7 +1150,8 @@ int print_insn_tci(bfd_vma addr, disassemble_info *info) op_name, str_r(r0), str_r(r1), str_r(r2), pos, len);break ; -#if TCG_TARGET_REG_BITS ==32 +case INDEX_op_movcond_i32: +case INDEX_op_movcond_i64:case INDEX_op_setcond2_i32:tci_args_rrrrrc (insn, &r0, &r1, &r2, &r3, &r4, &c); info->fprintf_func(info->stream, "%-12s %s,%s,%s,%s,%s,%s",
@@ -1146,6 +1159,7 @@ int print_insn_tci(bfd_vma addr, disassemble_info *info) str_r(r3), str_r(r4), str_c(c));break ; +#if TCG_TARGET_REG_BITS ==32 case INDEX_op_mulu2_i32:tci_args_rrrr (insn, &r0, &r1, &r2, &r3); info->fprintf_func(info->stream, "%-12s %s,%s,%s,%s",
tcg/tci/tcg-target.c.inc +7 -3
@@ -133,9 +133,12 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) return C_O0_I4(r, r, r, r); case INDEX_op_mulu2_i32: return C_O2_I2(r, r, r, r); +#endif + + case INDEX_op_movcond_i32: + case INDEX_op_movcond_i64: case INDEX_op_setcond2_i32: return C_O1_I4(r, r, r, r, r); -#endif case INDEX_op_qemu_ld_i32: return (TARGET_LONG_BITS <= TCG_TARGET_REG_BITS
@@ -419,6 +422,7 @@ static void tcg_out_op_rrrr(TCGContext *s, TCGOpcode op, insn = deposit32(insn, 20, 4, r3); tcg_out32(s, insn); } +#endif static void tcg_out_op_rrrrrc(TCGContext *s, TCGOpcode op, TCGReg r0, TCGReg r1, TCGReg r2,
@@ -436,6 +440,7 @@ static void tcg_out_op_rrrrrc(TCGContext *s, TCGOpcode op, tcg_out32(s, insn); } +#if TCG_TARGET_REG_BITS == 32 static void tcg_out_op_rrrrrr(TCGContext *s, TCGOpcode op, TCGReg r0, TCGReg r1, TCGReg r2, TCGReg r3, TCGReg r4, TCGReg r5)
@@ -591,12 +596,11 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, tcg_out_op_rrrc(s, opc, args[0], args[1], args[2], args[3]); break; -#if TCG_TARGET_REG_BITS == 32 + CASE_32_64(movcond) case INDEX_op_setcond2_i32: tcg_out_op_rrrrrc(s, opc, args[0], args[1], args[2], args[3], args[4], args[5]); break; -#endif CASE_32_64(ld8u) CASE_32_64(ld8s)
Signature · 1 line
2.25.1
PATCH v4 64/71 tcg/tci: Implement andc, orc, eqv, nand, nor
In reply to Richard HendersonThese were already present in tcg-target.c.inc,
but not in the interpreter.
--- tcg/tci/tcg-target.h | 20 ++++++++++---------- tcg/tci.c | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 10 deletions(-)
tcg/tci/tcg-target.h +10 -10
@@ -67,20 +67,20 @@#define TCG_TARGET_HAS_ext16s_i32 1#define TCG_TARGET_HAS_ext8u_i32 1#define TCG_TARGET_HAS_ext16u_i32 1 -#define TCG_TARGET_HAS_andc_i32 0 +#define TCG_TARGET_HAS_andc_i32 1#define TCG_TARGET_HAS_deposit_i32 1#define TCG_TARGET_HAS_extract_i32 0#define TCG_TARGET_HAS_sextract_i32 0#define TCG_TARGET_HAS_extract2_i32 0 -#define TCG_TARGET_HAS_eqv_i32 0 -#define TCG_TARGET_HAS_nand_i32 0 -#define TCG_TARGET_HAS_nor_i32 0 +#define TCG_TARGET_HAS_eqv_i32 1 +#define TCG_TARGET_HAS_nand_i32 1 +#define TCG_TARGET_HAS_nor_i32 1#define TCG_TARGET_HAS_clz_i32 0#define TCG_TARGET_HAS_ctz_i32 0#define TCG_TARGET_HAS_ctpop_i32 0#define TCG_TARGET_HAS_neg_i32 1#define TCG_TARGET_HAS_not_i32 1 -#define TCG_TARGET_HAS_orc_i32 0 +#define TCG_TARGET_HAS_orc_i32 1#define TCG_TARGET_HAS_rot_i32 1#define TCG_TARGET_HAS_movcond_i32 1#define TCG_TARGET_HAS_muls2_i32 0
@@ -108,16 +108,16 @@#define TCG_TARGET_HAS_ext8u_i64 1#define TCG_TARGET_HAS_ext16u_i64 1#define TCG_TARGET_HAS_ext32u_i64 1 -#define TCG_TARGET_HAS_andc_i64 0 -#define TCG_TARGET_HAS_eqv_i64 0 -#define TCG_TARGET_HAS_nand_i64 0 -#define TCG_TARGET_HAS_nor_i64 0 +#define TCG_TARGET_HAS_andc_i64 1 +#define TCG_TARGET_HAS_eqv_i64 1 +#define TCG_TARGET_HAS_nand_i64 1 +#define TCG_TARGET_HAS_nor_i64 1#define TCG_TARGET_HAS_clz_i64 0#define TCG_TARGET_HAS_ctz_i64 0#define TCG_TARGET_HAS_ctpop_i64 0#define TCG_TARGET_HAS_neg_i64 1#define TCG_TARGET_HAS_not_i64 1 -#define TCG_TARGET_HAS_orc_i64 0 +#define TCG_TARGET_HAS_orc_i64 1#define TCG_TARGET_HAS_rot_i64 1#define TCG_TARGET_HAS_movcond_i64 1#define TCG_TARGET_HAS_muls2_i64 0
tcg/tci.c +40 -0
@@ -530,6 +530,36 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,tci_args_rrr (insn, &r0, &r1, &r2); regs[r0] = regs[r1] ^ regs[r2];break ; +#if TCG_TARGET_HAS_andc_i32 || TCG_TARGET_HAS_andc_i64 + CASE_32_64(andc) + tci_args_rrr(insn, &r0, &r1, &r2); + regs[r0] = regs[r1] & ~regs[r2]; +break ; +#endif +#if TCG_TARGET_HAS_orc_i32 || TCG_TARGET_HAS_orc_i64 + CASE_32_64(orc) + tci_args_rrr(insn, &r0, &r1, &r2); + regs[r0] = regs[r1] | ~regs[r2]; +break ; +#endif +#if TCG_TARGET_HAS_eqv_i32 || TCG_TARGET_HAS_eqv_i64 + CASE_32_64(eqv) + tci_args_rrr(insn, &r0, &r1, &r2); + regs[r0] = ~(regs[r1] ^ regs[r2]); +break ; +#endif +#if TCG_TARGET_HAS_nand_i32 || TCG_TARGET_HAS_nand_i64 + CASE_32_64(nand) + tci_args_rrr(insn, &r0, &r1, &r2); + regs[r0] = ~(regs[r1] & regs[r2]); +break ; +#endif +#if TCG_TARGET_HAS_nor_i32 || TCG_TARGET_HAS_nor_i64 + CASE_32_64(nor) + tci_args_rrr(insn, &r0, &r1, &r2); + regs[r0] = ~(regs[r1] | regs[r2]); +break ; +#endif /* Arithmetic operations (32 bit). */
@@ -1120,6 +1150,16 @@ int print_insn_tci(bfd_vma addr, disassemble_info *info)case INDEX_op_or_i64:case INDEX_op_xor_i32:case INDEX_op_xor_i64: +case INDEX_op_andc_i32: +case INDEX_op_andc_i64: +case INDEX_op_orc_i32: +case INDEX_op_orc_i64: +case INDEX_op_eqv_i32: +case INDEX_op_eqv_i64: +case INDEX_op_nand_i32: +case INDEX_op_nand_i64: +case INDEX_op_nor_i32: +case INDEX_op_nor_i64:case INDEX_op_div_i32:case INDEX_op_div_i64:case INDEX_op_rem_i32:
Signature · 1 line
2.25.1
PATCH v4 65/71 tcg/tci: Implement extract, sextract
In reply to Richard Henderson--- tcg/tci/tcg-target.h | 8 ++++---- tcg/tci.c | 42 ++++++++++++++++++++++++++++++++++++++++ tcg/tci/tcg-target.c.inc | 32 ++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+), 4 deletions(-)
tcg/tci/tcg-target.h +4 -4
@@ -69,8 +69,8 @@#define TCG_TARGET_HAS_ext16u_i32 1#define TCG_TARGET_HAS_andc_i32 1#define TCG_TARGET_HAS_deposit_i32 1 -#define TCG_TARGET_HAS_extract_i32 0 -#define TCG_TARGET_HAS_sextract_i32 0 +#define TCG_TARGET_HAS_extract_i32 1 +#define TCG_TARGET_HAS_sextract_i32 1#define TCG_TARGET_HAS_extract2_i32 0#define TCG_TARGET_HAS_eqv_i32 1#define TCG_TARGET_HAS_nand_i32 1
@@ -97,8 +97,8 @@#define TCG_TARGET_HAS_bswap32_i64 1#define TCG_TARGET_HAS_bswap64_i64 1#define TCG_TARGET_HAS_deposit_i64 1 -#define TCG_TARGET_HAS_extract_i64 0 -#define TCG_TARGET_HAS_sextract_i64 0 +#define TCG_TARGET_HAS_extract_i64 1 +#define TCG_TARGET_HAS_sextract_i64 1#define TCG_TARGET_HAS_extract2_i64 0#define TCG_TARGET_HAS_div_i64 1#define TCG_TARGET_HAS_rem_i64 1
tcg/tci.c +42 -0
66 lines not on this page · raw message
tcg/tci/tcg-target.c.inc +32 -0
@@ -63,6 +63,10 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) case INDEX_op_bswap32_i32: case INDEX_op_bswap32_i64: case INDEX_op_bswap64_i64: + case INDEX_op_extract_i32: + case INDEX_op_extract_i64: + case INDEX_op_sextract_i32: + case INDEX_op_sextract_i64: return C_O1_I1(r, r); case INDEX_op_st8_i32:
@@ -352,6 +356,21 @@ static void tcg_out_op_rrs(TCGContext *s, TCGOpcode op, tcg_out32(s, insn); } +static void tcg_out_op_rrbb(TCGContext *s, TCGOpcode op, TCGReg r0, + TCGReg r1, uint8_t b2, uint8_t b3) +{ + tcg_insn_unit insn = 0; + + tcg_debug_assert(b2 == extract32(b2, 0, 6)); + tcg_debug_assert(b3 == extract32(b3, 0, 6)); + insn = deposit32(insn, 0, 8, op); + insn = deposit32(insn, 8, 4, r0); + insn = deposit32(insn, 12, 4, r1); + insn = deposit32(insn, 16, 6, b2); + insn = deposit32(insn, 22, 6, b3); + tcg_out32(s, insn); +} + static void tcg_out_op_rrrc(TCGContext *s, TCGOpcode op, TCGReg r0, TCGReg r1, TCGReg r2, TCGCond c3) {
@@ -653,6 +672,19 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, } break; + CASE_32_64(extract) /* Optional (TCG_TARGET_HAS_extract_*). */ + CASE_32_64(sextract) /* Optional (TCG_TARGET_HAS_sextract_*). */ + { + TCGArg pos = args[2], len = args[3]; + TCGArg max = tcg_op_defs[opc].flags & TCG_OPF_64BIT ? 64 : 32; + + tcg_debug_assert(pos < max); + tcg_debug_assert(pos + len <= max); + + tcg_out_op_rrbb(s, opc, args[0], args[1], pos, len); + } + break; + CASE_32_64(brcond) tcg_out_op_rrrc(s, (opc == INDEX_op_brcond_i32 ? INDEX_op_setcond_i32 : INDEX_op_setcond_i64),
Signature · 1 line
2.25.1
PATCH v4 66/71 tcg/tci: Implement clz, ctz, ctpop
In reply to Richard Henderson--- tcg/tci/tcg-target.h | 12 +++++------ tcg/tci.c | 44 ++++++++++++++++++++++++++++++++++++++++ tcg/tci/tcg-target.c.inc | 9 ++++++++ 3 files changed, 59 insertions(+), 6 deletions(-)
tcg/tci/tcg-target.h +6 -6
@@ -75,9 +75,9 @@#define TCG_TARGET_HAS_eqv_i32 1#define TCG_TARGET_HAS_nand_i32 1#define TCG_TARGET_HAS_nor_i32 1 -#define TCG_TARGET_HAS_clz_i32 0 -#define TCG_TARGET_HAS_ctz_i32 0 -#define TCG_TARGET_HAS_ctpop_i32 0 +#define TCG_TARGET_HAS_clz_i32 1 +#define TCG_TARGET_HAS_ctz_i32 1 +#define TCG_TARGET_HAS_ctpop_i32 1#define TCG_TARGET_HAS_neg_i32 1#define TCG_TARGET_HAS_not_i32 1#define TCG_TARGET_HAS_orc_i32 1
@@ -112,9 +112,9 @@#define TCG_TARGET_HAS_eqv_i64 1#define TCG_TARGET_HAS_nand_i64 1#define TCG_TARGET_HAS_nor_i64 1 -#define TCG_TARGET_HAS_clz_i64 0 -#define TCG_TARGET_HAS_ctz_i64 0 -#define TCG_TARGET_HAS_ctpop_i64 0 +#define TCG_TARGET_HAS_clz_i64 1 +#define TCG_TARGET_HAS_ctz_i64 1 +#define TCG_TARGET_HAS_ctpop_i64 1#define TCG_TARGET_HAS_neg_i64 1#define TCG_TARGET_HAS_not_i64 1#define TCG_TARGET_HAS_orc_i64 1
tcg/tci.c +44 -0
68 lines not on this page · raw message
tcg/tci/tcg-target.c.inc +9 -0
@@ -67,6 +67,8 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) case INDEX_op_extract_i64: case INDEX_op_sextract_i32: case INDEX_op_sextract_i64: + case INDEX_op_ctpop_i32: + case INDEX_op_ctpop_i64: return C_O1_I1(r, r); case INDEX_op_st8_i32:
@@ -122,6 +124,10 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) case INDEX_op_setcond_i64: case INDEX_op_deposit_i32: case INDEX_op_deposit_i64: + case INDEX_op_clz_i32: + case INDEX_op_clz_i64: + case INDEX_op_ctz_i32: + case INDEX_op_ctz_i64: return C_O1_I2(r, r, r); case INDEX_op_brcond_i32:
@@ -657,6 +663,8 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, CASE_32_64(divu) /* Optional (TCG_TARGET_HAS_div_*). */ CASE_32_64(rem) /* Optional (TCG_TARGET_HAS_div_*). */ CASE_32_64(remu) /* Optional (TCG_TARGET_HAS_div_*). */ + CASE_32_64(clz) /* Optional (TCG_TARGET_HAS_clz_*). */ + CASE_32_64(ctz) /* Optional (TCG_TARGET_HAS_ctz_*). */ tcg_out_op_rrr(s, opc, args[0], args[1], args[2]); break;
@@ -705,6 +713,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, CASE_32_64(bswap16) /* Optional (TCG_TARGET_HAS_bswap16_*). */ CASE_32_64(bswap32) /* Optional (TCG_TARGET_HAS_bswap32_*). */ CASE_64(bswap64) /* Optional (TCG_TARGET_HAS_bswap64_i64). */ + CASE_32_64(ctpop) /* Optional (TCG_TARGET_HAS_ctpop_*). */ tcg_out_op_rr(s, opc, args[0], args[1]); break;
Signature · 1 line
2.25.1
PATCH v4 67/71 tcg/tci: Implement mulu2, muls2
In reply to Richard HendersonWe already had mulu2_i32 for a 32-bit host; expand this to 64-bit hosts as well. The muls2_i32 and the 64-bit opcodes are new.
--- tcg/tci/tcg-target.h | 8 ++++---- tcg/tci.c | 35 +++++++++++++++++++++++++++++------ tcg/tci/tcg-target.c.inc | 16 ++++++++++------ 3 files changed, 43 insertions(+), 16 deletions(-)
tcg/tci/tcg-target.h +4 -4
@@ -83,7 +83,7 @@#define TCG_TARGET_HAS_orc_i32 1#define TCG_TARGET_HAS_rot_i32 1#define TCG_TARGET_HAS_movcond_i32 1 -#define TCG_TARGET_HAS_muls2_i32 0 +#define TCG_TARGET_HAS_muls2_i32 1#define TCG_TARGET_HAS_muluh_i32 0#define TCG_TARGET_HAS_mulsh_i32 0#define TCG_TARGET_HAS_goto_ptr 1
@@ -120,13 +120,13 @@#define TCG_TARGET_HAS_orc_i64 1#define TCG_TARGET_HAS_rot_i64 1#define TCG_TARGET_HAS_movcond_i64 1 -#define TCG_TARGET_HAS_muls2_i64 0 +#define TCG_TARGET_HAS_muls2_i64 1#define TCG_TARGET_HAS_add2_i32 0#define TCG_TARGET_HAS_sub2_i32 0 -#define TCG_TARGET_HAS_mulu2_i32 0 +#define TCG_TARGET_HAS_mulu2_i32 1#define TCG_TARGET_HAS_add2_i64 0#define TCG_TARGET_HAS_sub2_i64 0 -#define TCG_TARGET_HAS_mulu2_i64 0 +#define TCG_TARGET_HAS_mulu2_i64 1#define TCG_TARGET_HAS_muluh_i64 0#define TCG_TARGET_HAS_mulsh_i64 0#else
tcg/tci.c +29 -6
@@ -39,7 +39,7 @@ __thread uintptr_t tci_tb_ptr;static void tci_write_reg64 (tcg_target_ulong *regs,uint32_t high_index,uint32_t low_index,uint64_t value) { - regs[low_index] = value; + regs[low_index] = (uint32_t )value; regs[high_index] = value >>32 ; }
@@ -169,7 +169,6 @@ static void tci_args_rrrrr(uint32_t insn, TCGReg *r0, TCGReg *r1, *r4 =extract32 (insn,24 ,4 ); } -#if TCG_TARGET_REG_BITS ==32 static void tci_args_rrrr (uint32_t insn,TCGReg *r0,TCGReg *r1,TCGReg *r2,TCGReg *r3) {
@@ -178,7 +177,6 @@ static void tci_args_rrrr(uint32_t insn, *r2 =extract32 (insn,16 ,4 ); *r3 =extract32 (insn,20 ,4 ); } -#endif static void tci_args_rrrrrc (uint32_t insn,TCGReg *r0,TCGReg *r1,TCGReg *r2,TCGReg *r3,TCGReg *r4,TCGCond *c5)
@@ -670,11 +668,21 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,T2 =tci_uint64 (regs[r5], regs[r4]);tci_write_reg64 (regs, r1, r0,T1 -T2 );break ; +#endif /* TCG_TARGET_REG_BITS == 32 */ +#if TCG_TARGET_HAS_mulu2_i32case INDEX_op_mulu2_i32:tci_args_rrrr (insn, &r0, &r1, &r2, &r3); -tci_write_reg64 (regs, r1, r0, (uint64_t )regs[r2] * regs[r3]); + tmp64 = (uint64_t )(uint32_t )regs[r2] * (uint32_t )regs[r3]; +tci_write_reg64 (regs, r1, r0, tmp64);break ; -#endif /* TCG_TARGET_REG_BITS == 32 */ +#endif +#if TCG_TARGET_HAS_muls2_i32 +case INDEX_op_muls2_i32: +tci_args_rrrr (insn, &r0, &r1, &r2, &r3); + tmp64 = (int64_t )(int32_t )regs[r2] * (int32_t )regs[r3]; +tci_write_reg64 (regs, r1, r0, tmp64); +break ; +#endif #if TCG_TARGET_HAS_ext8s_i32 || TCG_TARGET_HAS_ext8s_i64 CASE_32_64(ext8s) tci_args_rr(insn, &r0, &r1);
@@ -778,6 +786,18 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, regs[r0] =ctpop64 (regs[r1]);break ;#endif +#if TCG_TARGET_HAS_mulu2_i64 +case INDEX_op_mulu2_i64: +tci_args_rrrr (insn, &r0, &r1, &r2, &r3); +mulu64 (®s[r0], ®s[r1], regs[r2], regs[r3]); +break ; +#endif +#if TCG_TARGET_HAS_muls2_i64 +case INDEX_op_muls2_i64: +tci_args_rrrr (insn, &r0, &r1, &r2, &r3); +muls64 (®s[r0], ®s[r1], regs[r2], regs[r3]); +break ; +#endif /* Shift/rotate operations (64 bit). */
@@ -1285,14 +1305,17 @@ int print_insn_tci(bfd_vma addr, disassemble_info *info) str_r(r3), str_r(r4), str_c(c));break ; -#if TCG_TARGET_REG_BITS ==32 case INDEX_op_mulu2_i32: +case INDEX_op_mulu2_i64: +case INDEX_op_muls2_i32: +case INDEX_op_muls2_i64:tci_args_rrrr (insn, &r0, &r1, &r2, &r3); info->fprintf_func (info->stream,"%-12s %s,%s,%s,%s" , op_name,str_r (r0),str_r (r1),str_r (r2),str_r (r3));break ; +#if TCG_TARGET_REG_BITS ==32 case INDEX_op_add2_i32:case INDEX_op_sub2_i32:tci_args_rrrrrr (insn, &r0, &r1, &r2, &r3, &r4, &r5);
tcg/tci/tcg-target.c.inc +10 -6
@@ -141,10 +141,14 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) return C_O2_I4(r, r, r, r, r, r); case INDEX_op_brcond2_i32: return C_O0_I4(r, r, r, r); - case INDEX_op_mulu2_i32: - return C_O2_I2(r, r, r, r); #endif + case INDEX_op_mulu2_i32: + case INDEX_op_mulu2_i64: + case INDEX_op_muls2_i32: + case INDEX_op_muls2_i64: + return C_O2_I2(r, r, r, r); + case INDEX_op_movcond_i32: case INDEX_op_movcond_i64: case INDEX_op_setcond2_i32:
@@ -434,7 +438,6 @@ static void tcg_out_op_rrrrr(TCGContext *s, TCGOpcode op, TCGReg r0, tcg_out32(s, insn); } -#if TCG_TARGET_REG_BITS == 32 static void tcg_out_op_rrrr(TCGContext *s, TCGOpcode op, TCGReg r0, TCGReg r1, TCGReg r2, TCGReg r3) {
@@ -447,7 +450,6 @@ static void tcg_out_op_rrrr(TCGContext *s, TCGOpcode op, insn = deposit32(insn, 20, 4, r3); tcg_out32(s, insn); } -#endif static void tcg_out_op_rrrrrc(TCGContext *s, TCGOpcode op, TCGReg r0, TCGReg r1, TCGReg r2,
@@ -728,10 +730,12 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, args[0], args[1], args[2], args[3], args[4]); tcg_out_op_rl(s, INDEX_op_brcond_i32, TCG_REG_TMP, arg_label(args[5])); break; - case INDEX_op_mulu2_i32: +#endif + + CASE_32_64(mulu2) + CASE_32_64(muls2) tcg_out_op_rrrr(s, opc, args[0], args[1], args[2], args[3]); break; -#endif case INDEX_op_qemu_ld_i32: case INDEX_op_qemu_st_i32:
Signature · 1 line
2.25.1
PATCH v4 68/71 tcg/tci: Implement add2, sub2
In reply to Richard HendersonWe already had the 32-bit versions for a 32-bit host; expand this to 64-bit hosts as well. The 64-bit opcodes are new.
--- tcg/tci/tcg-target.h | 8 ++++---- tcg/tci.c | 40 ++++++++++++++++++++++++++-------------- tcg/tci/tcg-target.c.inc | 15 ++++++++------- 3 files changed, 38 insertions(+), 25 deletions(-)
tcg/tci/tcg-target.h +4 -4
@@ -121,11 +121,11 @@#define TCG_TARGET_HAS_rot_i64 1#define TCG_TARGET_HAS_movcond_i64 1#define TCG_TARGET_HAS_muls2_i64 1 -#define TCG_TARGET_HAS_add2_i32 0 -#define TCG_TARGET_HAS_sub2_i32 0 +#define TCG_TARGET_HAS_add2_i32 1 +#define TCG_TARGET_HAS_sub2_i32 1#define TCG_TARGET_HAS_mulu2_i32 1 -#define TCG_TARGET_HAS_add2_i64 0 -#define TCG_TARGET_HAS_sub2_i64 0 +#define TCG_TARGET_HAS_add2_i64 1 +#define TCG_TARGET_HAS_sub2_i64 1#define TCG_TARGET_HAS_mulu2_i64 1#define TCG_TARGET_HAS_muluh_i64 0#define TCG_TARGET_HAS_mulsh_i64 0
tcg/tci.c +26 -14
@@ -189,7 +189,6 @@ static void tci_args_rrrrrc(uint32_t insn, TCGReg *r0, TCGReg *r1, *c5 =extract32 (insn,28 ,4 ); } -#if TCG_TARGET_REG_BITS ==32 static void tci_args_rrrrrr (uint32_t insn,TCGReg *r0,TCGReg *r1,TCGReg *r2,TCGReg *r3,TCGReg *r4,TCGReg *r5) {
@@ -200,7 +199,6 @@ static void tci_args_rrrrrr(uint32_t insn, TCGReg *r0, TCGReg *r1, *r4 =extract32 (insn,24 ,4 ); *r5 =extract32 (insn,28 ,4 ); } -#endif static bool tci_compare32 (uint32_t u0,uint32_t u1,TCGCond condition) {
@@ -351,17 +349,14 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,for (;;) {uint32_t insn;TCGOpcode opc; -TCGReg r0, r1, r2, r3, r4; +TCGReg r0, r1, r2, r3, r4, r5;tcg_target_ulong t1;TCGCond condition;target_ulong taddr;uint8_t pos, len;uint32_t tmp32;uint64_t tmp64; -#if TCG_TARGET_REG_BITS ==32 -TCGReg r5;uint64_t T1 ,T2 ; -#endif TCGMemOpIdx oi;int32_t ofs;void *ptr;
@@ -655,20 +650,22 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, tb_ptr = ptr; }break ; -#if TCG_TARGET_REG_BITS ==32 +#if TCG_TARGET_REG_BITS ==32 || TCG_TARGET_HAS_add2_i32case INDEX_op_add2_i32:tci_args_rrrrrr (insn, &r0, &r1, &r2, &r3, &r4, &r5);T1 =tci_uint64 (regs[r3], regs[r2]);T2 =tci_uint64 (regs[r5], regs[r4]);tci_write_reg64 (regs, r1, r0,T1 +T2 );break ; +#endif +#if TCG_TARGET_REG_BITS ==32 || TCG_TARGET_HAS_sub2_i32case INDEX_op_sub2_i32:tci_args_rrrrrr (insn, &r0, &r1, &r2, &r3, &r4, &r5);T1 =tci_uint64 (regs[r3], regs[r2]);T2 =tci_uint64 (regs[r5], regs[r4]);tci_write_reg64 (regs, r1, r0,T1 -T2 );break ; -#endif /* TCG_TARGET_REG_BITS == 32 */ +#endif #if TCG_TARGET_HAS_mulu2_i32case INDEX_op_mulu2_i32:tci_args_rrrr (insn, &r0, &r1, &r2, &r3);
@@ -798,6 +795,24 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,muls64 (®s[r0], ®s[r1], regs[r2], regs[r3]);break ;#endif +#if TCG_TARGET_HAS_add2_i64 +case INDEX_op_add2_i64: +tci_args_rrrrrr (insn, &r0, &r1, &r2, &r3, &r4, &r5); +T1 = regs[r2] + regs[r4]; +T2 = regs[r3] + regs[r5] + (T1 < regs[r2]); + regs[r0] =T1 ; + regs[r1] =T2 ; +break ; +#endif +#if TCG_TARGET_HAS_add2_i64 +case INDEX_op_sub2_i64: +tci_args_rrrrrr (insn, &r0, &r1, &r2, &r3, &r4, &r5); +T1 = regs[r2] - regs[r4]; +T2 = regs[r3] - regs[r5] - (regs[r2] < regs[r4]); + regs[r0] =T1 ; + regs[r1] =T2 ; +break ; +#endif /* Shift/rotate operations (64 bit). */
@@ -1114,10 +1129,7 @@ int print_insn_tci(bfd_vma addr, disassemble_info *info)const char *op_name;uint32_t insn;TCGOpcode op; -TCGReg r0, r1, r2, r3, r4; -#if TCG_TARGET_REG_BITS ==32 -TCGReg r5; -#endif +TCGReg r0, r1, r2, r3, r4, r5;tcg_target_ulong i1;int32_t s2;TCGCond c;
@@ -1315,15 +1327,15 @@ int print_insn_tci(bfd_vma addr, disassemble_info *info) str_r(r2), str_r(r3));break ; -#if TCG_TARGET_REG_BITS ==32 case INDEX_op_add2_i32: +case INDEX_op_add2_i64:case INDEX_op_sub2_i32: +case INDEX_op_sub2_i64:tci_args_rrrrrr (insn, &r0, &r1, &r2, &r3, &r4, &r5); info->fprintf_func (info->stream,"%-12s %s,%s,%s,%s,%s,%s" , op_name,str_r (r0),str_r (r1),str_r (r2),str_r (r3),str_r (r4),str_r (r5));break ; -#endif case INDEX_op_qemu_ld_i64:case INDEX_op_qemu_st_i64:
tcg/tci/tcg-target.c.inc +8 -7
@@ -134,11 +134,13 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) case INDEX_op_brcond_i64: return C_O0_I2(r, r); -#if TCG_TARGET_REG_BITS == 32 - /* TODO: Support R, R, R, R, RI, RI? Will it be faster? */ case INDEX_op_add2_i32: + case INDEX_op_add2_i64: case INDEX_op_sub2_i32: + case INDEX_op_sub2_i64: return C_O2_I4(r, r, r, r, r, r); + +#if TCG_TARGET_REG_BITS == 32 case INDEX_op_brcond2_i32: return C_O0_I4(r, r, r, r); #endif
@@ -467,7 +469,6 @@ static void tcg_out_op_rrrrrc(TCGContext *s, TCGOpcode op, tcg_out32(s, insn); } -#if TCG_TARGET_REG_BITS == 32 static void tcg_out_op_rrrrrr(TCGContext *s, TCGOpcode op, TCGReg r0, TCGReg r1, TCGReg r2, TCGReg r3, TCGReg r4, TCGReg r5)
@@ -483,7 +484,6 @@ static void tcg_out_op_rrrrrr(TCGContext *s, TCGOpcode op, insn = deposit32(insn, 28, 4, r5); tcg_out32(s, insn); } -#endif static void tcg_out_ldst(TCGContext *s, TCGOpcode op, TCGReg val, TCGReg base, intptr_t offset)
@@ -719,12 +719,13 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, tcg_out_op_rr(s, opc, args[0], args[1]); break; -#if TCG_TARGET_REG_BITS == 32 - case INDEX_op_add2_i32: - case INDEX_op_sub2_i32: + CASE_32_64(add2) + CASE_32_64(sub2) tcg_out_op_rrrrrr(s, opc, args[0], args[1], args[2], args[3], args[4], args[5]); break; + +#if TCG_TARGET_REG_BITS == 32 case INDEX_op_brcond2_i32: tcg_out_op_rrrrrc(s, INDEX_op_setcond2_i32, TCG_REG_TMP, args[0], args[1], args[2], args[3], args[4]);
Signature · 1 line
2.25.1
PATCH v4 69/71 tcg/tci: Split out tci_qemu_ld, tci_qemu_st
In reply to Richard HendersonExpand the single-use macros into the new functions. Use cpu_ldsb_mmuidx_ra and cpu_ldsw_le_mmuidx_ra so that the trace event receives the correct sign flag.
--- tcg/tci.c | 215 +++++++++++++++++++----------------------------------- 1 file changed, 75 insertions(+), 140 deletions(-)
tcg/tci.c +75 -140
@@ -284,34 +284,77 @@ static bool tci_compare64(uint64_t u0, uint64_t u1, TCGCond condition)return result; } -#define qemu_ld_ub \ - cpu_ldub_mmuidx_ra(env, taddr, get_mmuidx(oi), (uintptr_t)tb_ptr) -#define qemu_ld_leuw \ - cpu_lduw_le_mmuidx_ra(env, taddr, get_mmuidx(oi), (uintptr_t)tb_ptr) -#define qemu_ld_leul \ - cpu_ldl_le_mmuidx_ra(env, taddr, get_mmuidx(oi), (uintptr_t)tb_ptr) -#define qemu_ld_leq \ - cpu_ldq_le_mmuidx_ra(env, taddr, get_mmuidx(oi), (uintptr_t)tb_ptr) -#define qemu_ld_beuw \ - cpu_lduw_be_mmuidx_ra(env, taddr, get_mmuidx(oi), (uintptr_t)tb_ptr) -#define qemu_ld_beul \ - cpu_ldl_be_mmuidx_ra(env, taddr, get_mmuidx(oi), (uintptr_t)tb_ptr) -#define qemu_ld_beq \ - cpu_ldq_be_mmuidx_ra(env, taddr, get_mmuidx(oi), (uintptr_t)tb_ptr) -#define qemu_st_b (X ) \ - cpu_stb_mmuidx_ra(env, taddr, X, get_mmuidx(oi), (uintptr_t)tb_ptr) -#define qemu_st_lew (X ) \ - cpu_stw_le_mmuidx_ra(env, taddr, X, get_mmuidx(oi), (uintptr_t)tb_ptr) -#define qemu_st_lel (X ) \ - cpu_stl_le_mmuidx_ra(env, taddr, X, get_mmuidx(oi), (uintptr_t)tb_ptr) -#define qemu_st_leq (X ) \ - cpu_stq_le_mmuidx_ra(env, taddr, X, get_mmuidx(oi), (uintptr_t)tb_ptr) -#define qemu_st_bew (X ) \ - cpu_stw_be_mmuidx_ra(env, taddr, X, get_mmuidx(oi), (uintptr_t)tb_ptr) -#define qemu_st_bel (X ) \ - cpu_stl_be_mmuidx_ra(env, taddr, X, get_mmuidx(oi), (uintptr_t)tb_ptr) -#define qemu_st_beq (X ) \ - cpu_stq_be_mmuidx_ra(env, taddr, X, get_mmuidx(oi), (uintptr_t)tb_ptr) +static uint64_t tci_qemu_ld (CPUArchState *env,target_ulong taddr, +TCGMemOpIdx oi,const void *tb_ptr) +{ +uintptr_t ra = (uintptr_t )tb_ptr; +int mmu_idx =get_mmuidx (oi); +MemOp mop =get_memop (oi); + +switch (mop & (MO_BSWAP |MO_SSIZE )) { +case MO_UB : +return cpu_ldub_mmuidx_ra (env, taddr, mmu_idx, ra); +case MO_SB : +return cpu_ldsb_mmuidx_ra (env, taddr, mmu_idx, ra); +case MO_LEUW : +return cpu_lduw_le_mmuidx_ra (env, taddr, mmu_idx, ra); +case MO_BEUW : +return cpu_lduw_be_mmuidx_ra (env, taddr, mmu_idx, ra); +case MO_LESW : +return cpu_ldsw_le_mmuidx_ra (env, taddr, mmu_idx, ra); +case MO_BESW : +return cpu_ldsw_be_mmuidx_ra (env, taddr, mmu_idx, ra); +case MO_LEUL : +return cpu_ldl_le_mmuidx_ra (env, taddr, mmu_idx, ra); +case MO_BEUL : +return cpu_ldl_be_mmuidx_ra (env, taddr, mmu_idx, ra); +case MO_LESL : +return (int32_t )cpu_ldl_le_mmuidx_ra (env, taddr, mmu_idx, ra); +case MO_BESL : +return (int32_t )cpu_ldl_be_mmuidx_ra (env, taddr, mmu_idx, ra); +case MO_LEQ : +return cpu_ldq_le_mmuidx_ra (env, taddr, mmu_idx, ra); +case MO_BEQ : +return cpu_ldq_be_mmuidx_ra (env, taddr, mmu_idx, ra); + +default : +g_assert_not_reached (); + } +} + +static void tci_qemu_st (CPUArchState *env,target_ulong taddr,uint64_t val, +TCGMemOpIdx oi,const void *tb_ptr) +{ +uintptr_t ra = (uintptr_t )tb_ptr; +int mmu_idx =get_mmuidx (oi); +MemOp mop =get_memop (oi); + +switch (mop & (MO_BSWAP |MO_SIZE )) { +case MO_UB : +cpu_stb_mmuidx_ra (env, taddr, val, mmu_idx, ra); +break ; +case MO_LEUW : +cpu_stw_le_mmuidx_ra (env, taddr, val, mmu_idx, ra); +break ; +case MO_BEUW : +cpu_stw_be_mmuidx_ra (env, taddr, val, mmu_idx, ra); +break ; +case MO_LEUL : +cpu_stl_le_mmuidx_ra (env, taddr, val, mmu_idx, ra); +break ; +case MO_BEUL : +cpu_stl_be_mmuidx_ra (env, taddr, val, mmu_idx, ra); +break ; +case MO_LEQ : +cpu_stq_le_mmuidx_ra (env, taddr, val, mmu_idx, ra); +break ; +case MO_BEQ : +cpu_stq_be_mmuidx_ra (env, taddr, val, mmu_idx, ra); +break ; +default : +g_assert_not_reached (); + } +}#if TCG_TARGET_REG_BITS ==64 # define CASE_32_64 (x) \
@@ -908,34 +951,7 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,tci_args_rrrm (insn, &r0, &r1, &r2, &oi); taddr =tci_uint64 (regs[r2], regs[r1]); } -switch (get_memop (oi) & (MO_BSWAP |MO_SSIZE )) { -case MO_UB : - tmp32 = qemu_ld_ub; -break ; -case MO_SB : - tmp32 = (int8_t )qemu_ld_ub; -break ; -case MO_LEUW : - tmp32 = qemu_ld_leuw; -break ; -case MO_LESW : - tmp32 = (int16_t )qemu_ld_leuw; -break ; -case MO_LEUL : - tmp32 = qemu_ld_leul; -break ; -case MO_BEUW : - tmp32 = qemu_ld_beuw; -break ; -case MO_BESW : - tmp32 = (int16_t )qemu_ld_beuw; -break ; -case MO_BEUL : - tmp32 = qemu_ld_beul; -break ; -default : -g_assert_not_reached (); - } + tmp32 =tci_qemu_ld (env, taddr, oi, tb_ptr); regs[r0] = tmp32;break ;
@@ -951,46 +967,7 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, taddr =tci_uint64 (regs[r3], regs[r2]); oi = regs[r4]; } -switch (get_memop (oi) & (MO_BSWAP |MO_SSIZE )) { -case MO_UB : - tmp64 = qemu_ld_ub; -break ; -case MO_SB : - tmp64 = (int8_t )qemu_ld_ub; -break ; -case MO_LEUW : - tmp64 = qemu_ld_leuw; -break ; -case MO_LESW : - tmp64 = (int16_t )qemu_ld_leuw; -break ; -case MO_LEUL : - tmp64 = qemu_ld_leul; -break ; -case MO_LESL : - tmp64 = (int32_t )qemu_ld_leul; -break ; -case MO_LEQ : - tmp64 = qemu_ld_leq; -break ; -case MO_BEUW : - tmp64 = qemu_ld_beuw; -break ; -case MO_BESW : - tmp64 = (int16_t )qemu_ld_beuw; -break ; -case MO_BEUL : - tmp64 = qemu_ld_beul; -break ; -case MO_BESL : - tmp64 = (int32_t )qemu_ld_beul; -break ; -case MO_BEQ : - tmp64 = qemu_ld_beq; -break ; -default : -g_assert_not_reached (); - } + tmp64 =tci_qemu_ld (env, taddr, oi, tb_ptr);if (TCG_TARGET_REG_BITS ==32 ) {tci_write_reg64 (regs, r1, r0, tmp64); }else {
@@ -1007,25 +984,7 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, taddr =tci_uint64 (regs[r2], regs[r1]); } tmp32 = regs[r0]; -switch (get_memop (oi) & (MO_BSWAP |MO_SIZE )) { -case MO_UB : -qemu_st_b (tmp32); -break ; -case MO_LEUW : -qemu_st_lew (tmp32); -break ; -case MO_LEUL : -qemu_st_lel (tmp32); -break ; -case MO_BEUW : -qemu_st_bew (tmp32); -break ; -case MO_BEUL : -qemu_st_bel (tmp32); -break ; -default : -g_assert_not_reached (); - } +tci_qemu_st (env, taddr, tmp32, oi, tb_ptr);break ;case INDEX_op_qemu_st_i64:
@@ -1044,31 +1003,7 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, } tmp64 =tci_uint64 (regs[r1], regs[r0]); } -switch (get_memop (oi) & (MO_BSWAP |MO_SIZE )) { -case MO_UB : -qemu_st_b (tmp64); -break ; -case MO_LEUW : -qemu_st_lew (tmp64); -break ; -case MO_LEUL : -qemu_st_lel (tmp64); -break ; -case MO_LEQ : -qemu_st_leq (tmp64); -break ; -case MO_BEUW : -qemu_st_bew (tmp64); -break ; -case MO_BEUL : -qemu_st_bel (tmp64); -break ; -case MO_BEQ : -qemu_st_beq (tmp64); -break ; -default : -g_assert_not_reached (); - } +tci_qemu_st (env, taddr, tmp64, oi, tb_ptr);break ;case INDEX_op_mb:
Signature · 1 line
2.25.1
PATCH v4 70/71 tests/tcg: Increase timeout for TCI
In reply to Richard HendersonThe longest test at the moment seems to be a (slower) aarch64 host, for which test-mmap takes 64 seconds.
--- configure | 3 +++ tests/tcg/Makefile.target | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-)
configure +3 -0
@@ -5797,6 +5797,9 @@ fi if test "$optreset" = "yes" ; then echo "HAVE_OPTRESET=y" >> $config_host_mak fi +if test "$tcg" = "enabled" -a "$tcg_interpreter" = "true" ; then + echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak +fi if test "$fdatasync" = "yes" ; then echo "CONFIG_FDATASYNC=y" >> $config_host_mak fi
tests/tcg/Makefile.target +4 -2
@@ -77,8 +77,10 @@ LDFLAGS= QEMU_OPTS= -# If TCG debugging is enabled things are a lot slower -ifeq ($(CONFIG_DEBUG_TCG),y) +# If TCG debugging, or TCI is enabled things are a lot slower +ifneq ($(CONFIG_TCG_INTERPRETER),) +TIMEOUT=90 +else ifneq ($(CONFIG_DEBUG_TCG),) TIMEOUT=60 else TIMEOUT=15
Signature · 1 line
2.25.1
Re: [PATCH v4 70/71] tests/tcg: Increase timeout for TCI
Quoted 30 lines · Richard Henderson
The longest test at the moment seems to be a (slower) aarch64 host, for which test-mmap takes 64 seconds.
Signed-off-by Richard Henderson <[email protected]>--- configure | 3 +++ tests/tcg/Makefile.target | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-)configure +3
-0@@ -5797,6 +5797,9 @@ fi if test "$optreset" = "yes" ; then echo "HAVE_OPTRESET=y" >> $config_host_mak fi +if test "$tcg" = "enabled" -a "$tcg_interpreter" = "true" ; then + echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak +fi if test "$fdatasync" = "yes" ; then echo "CONFIG_FDATASYNC=y" >> $config_host_mak fitests/tcg/Makefile.target +0
-0@@ -77,8 +77,10 @@ LDFLAGS= QEMU_OPTS=
tests/tcg/Makefile.target LDFLAGS= · line 86
Quoted 10 lines
tests/tcg/Makefile.target +4
-2-# If TCG debugging is enabled things are a lot slower -ifeq ($(CONFIG_DEBUG_TCG),y) +# If TCG debugging, or TCI is enabled things are a lot slower +ifneq ($(CONFIG_TCG_INTERPRETER),) +TIMEOUT=90 +else ifneq ($(CONFIG_DEBUG_TCG),) TIMEOUT=60 else TIMEOUT=15
Does it even get slower if you enable both at the same time, TCG debugging and TCI?
Re: [PATCH v4 70/71] tests/tcg: Increase timeout for TCI
Quoted 11 lines · Thomas Huth
Quoted 8 lines
tests/tcg/Makefile.target +4
-1-ifeq ($(CONFIG_DEBUG_TCG),y) +# If TCG debugging, or TCI is enabled things are a lot slower +ifneq ($(CONFIG_TCG_INTERPRETER),) +TIMEOUT=90 +else ifneq ($(CONFIG_DEBUG_TCG),)TIMEOUT=60
else
TIMEOUT=15Reviewed-by Thomas Huth <[email protected]>
Quoted 2 lines
Does it even get slower if you enable both at the same time, TCG debugging and TCI?
As it happens, my testing was with --enable-debug-tcg.
So, unless you're doing --enable-debug (-O0) testing, we should be fine.
r~
PATCH v4 71/71 gitlab: Enable cross-i386 builds of TCI
In reply to Richard HendersonWe're currently only testing TCI with a 64-bit host -- also test with a 32-bit host. Enable a selection of softmmu and user-only targets, 32-bit LE, 64-bit LE, 32-bit BE, as there are ifdefs for each.
--- .gitlab-ci.d/crossbuilds.yml | 17 ++++++++++++++--- .../docker/dockerfiles/fedora-i386-cross.docker | 1 + 2 files changed, 15 insertions(+), 3 deletions(-)
.gitlab-ci.d/crossbuilds.yml +14 -3
@@ -6,7 +6,8 @@ - mkdir build - cd build - PKG_CONFIG_PATH=$PKG_CONFIG_PATH - ../configure --enable-werror $QEMU_CONFIGURE_OPTS --disable-user + ../configure --enable-werror $QEMU_CONFIGURE_OPTS $ACCEL_CONFIGURE_OPTS + --disable-user --target-list-exclude="arm-softmmu cris-softmmu i386-softmmu microblaze-softmmu mips-softmmu mipsel-softmmu mips64-softmmu ppc-softmmu sh4-softmmu xtensa-softmmu"
@@ -27,7 +28,7 @@ - PKG_CONFIG_PATH=$PKG_CONFIG_PATH ../configure --enable-werror $QEMU_CONFIGURE_OPTS --disable-tools --enable-${ACCEL:-kvm} $ACCEL_CONFIGURE_OPTS - - make -j$(expr $(nproc) + 1) all check-build + - make -j$(expr $(nproc) + 1) all check-build $MAKE_CHECK_ARGS .cross_user_build_job: stage: build
@@ -36,7 +37,8 @@ - mkdir build - cd build - PKG_CONFIG_PATH=$PKG_CONFIG_PATH - ../configure --enable-werror $QEMU_CONFIGURE_OPTS --disable-system + ../configure --enable-werror $QEMU_CONFIGURE_OPTS $ACCEL_CONFIGURE_OPTS + --disable-system - make -j$(expr $(nproc) + 1) all check-build $MAKE_CHECK_ARGS cross-armel-system:
@@ -81,6 +83,15 @@ cross-i386-user: IMAGE: fedora-i386-cross MAKE_CHECK_ARGS: check +cross-i386-tci: + extends: .cross_accel_build_job + timeout: 60m + variables: + IMAGE: fedora-i386-cross + ACCEL: tcg-interpreter + ACCEL_CONFIGURE_OPTS: --target-list=i386-softmmu,i386-linux-user,aarch64-softmmu,aarch64-linux-user,ppc-softmmu,ppc-linux-user + MAKE_CHECK_ARGS: check + cross-mips-system: extends: .cross_system_build_job variables:
tests/docker/dockerfiles/fedora-i386-cross.docker +1 -0
@@ -5,6 +5,7 @@ ENV PACKAGES \ findutils \ gcc \ git \ + libffi-devel.i686 \ libtasn1-devel.i686 \ libzstd-devel.i686 \ make \
Signature · 1 line
2.25.1
Re: [PATCH v4 71/71] gitlab: Enable cross-i386 builds of TCI
Quoted 16 lines · Richard Henderson
We're currently only testing TCI with a 64-bit host -- also test with a 32-bit host. Enable a selection of softmmu and user-only targets, 32-bit LE, 64-bit LE, 32-bit BE, as there are ifdefs for each.
Reviewed-by Philippe Mathieu-Daudé <[email protected]>Signed-off-by Richard Henderson <[email protected]>--- .gitlab-ci.d/crossbuilds.yml | 17 ++++++++++++++--- .../docker/dockerfiles/fedora-i386-cross.docker | 1 + 2 files changed, 15 insertions(+), 3 deletions(-).gitlab-ci.d/crossbuilds.yml +0
-0
.gitlab-ci.d/crossbuilds.yml line 9
Quoted 5 lines
.gitlab-ci.d/crossbuilds.yml +1
-1@@ -6,7 +6,8 @@ - mkdir build - cd build - PKG_CONFIG_PATH=$PKG_CONFIG_PATH - ../configure --enable-werror $QEMU_CONFIGURE_OPTS --disable-user + ../configure --enable-werror $QEMU_CONFIGURE_OPTS $ACCEL_CONFIGURE_OPTS
I'd maybe call it EXTRA_CONFIGURE_OPTS instead since it could also be used for other purposes later.
Quoted 25 lines
.gitlab-ci.d/crossbuilds.yml +4
-2+ --disable-user --target-list-exclude="arm-softmmu cris-softmmu i386-softmmu microblaze-softmmu mips-softmmu mipsel-softmmu mips64-softmmu ppc-softmmu sh4-softmmu xtensa-softmmu"@@ -27,7 +28,7 @@ - PKG_CONFIG_PATH=$PKG_CONFIG_PATH ../configure --enable-werror $QEMU_CONFIGURE_OPTS --disable-tools --enable-${ACCEL:-kvm} $ACCEL_CONFIGURE_OPTS - - make -j$(expr $(nproc) + 1) all check-build + - make -j$(expr $(nproc) + 1) all check-build $MAKE_CHECK_ARGS .cross_user_build_job: stage: build@@ -36,7 +37,8 @@ - mkdir build - cd build - PKG_CONFIG_PATH=$PKG_CONFIG_PATH - ../configure --enable-werror $QEMU_CONFIGURE_OPTS --disable-system + ../configure --enable-werror $QEMU_CONFIGURE_OPTS $ACCEL_CONFIGURE_OPTS + --disable-system - make -j$(expr $(nproc) + 1) all check-build $MAKE_CHECK_ARGS cross-armel-system:@@ -81,6 +83,15 @@ cross-i386-user: IMAGE: fedora-i386-cross
.gitlab-ci.d/crossbuilds.yml cross-i386-user: · line 93
Quoted 10 lines
.gitlab-ci.d/crossbuilds.yml +8
-0MAKE_CHECK_ARGS: check +cross-i386-tci: + extends: .cross_accel_build_job + timeout: 60m + variables: + IMAGE: fedora-i386-cross + ACCEL: tcg-interpreter + ACCEL_CONFIGURE_OPTS: --target-list=i386-softmmu,i386-linux-user,aarch64-softmmu,aarch64-linux-user,ppc-softmmu,ppc-linux-user + MAKE_CHECK_ARGS: check
Don't you want to run "check-tcg" here, too? (IIRC it's not included in "check")
Quoted 9 lines
.gitlab-ci.d/crossbuilds.yml +0
-0cross-mips-system: extends: .cross_system_build_job variables:tests/docker/dockerfiles/fedora-i386-cross.docker +0
-0
tests/docker/dockerfiles/fedora-i386-cross.docker ENV PACKAGES \ · line 11
Quoted 7 lines
tests/docker/dockerfiles/fedora-i386-cross.docker +1
-0@@ -5,6 +5,7 @@ ENV PACKAGES \ findutils \ gcc \ git \ + libffi-devel.i686 \ libtasn1-devel.i686 \ libzstd-devel.i686 \ make \
Anyway,
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series seems to have some coding style problems. See output below for more information:
Type: series
Message-id: [email protected]
Subject: [PATCH v4 00/71] TCI fixes and cleanups
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
- [tag update] patchew/[email protected] -> patchew/[email protected] - [tag update] patchew/[email protected] -> patchew/[email protected] * [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
e85d152 gitlab: Enable cross-i386 builds of TCI
e125dfd tests/tcg: Increase timeout for TCI
ad8b717 tcg/tci: Split out tci_qemu_ld, tci_qemu_st
445fd0c tcg/tci: Implement add2, sub2
191eee2 tcg/tci: Implement mulu2, muls2
a35dc19 tcg/tci: Implement clz, ctz, ctpop
e7ab306 tcg/tci: Implement extract, sextract
b83da74 tcg/tci: Implement andc, orc, eqv, nand, nor
4568e34 tcg/tci: Implement movcond
e1ad4f4 tcg/tci: Implement goto_ptr
19bec07 tcg/tci: Change encoding to uint32_t units
6261272 tcg/tci: Remove tci_write_reg
b776dc6 tcg/tci: Emit setcond before brcond
c17b133 tcg/tci: Reserve r13 for a temporary
db6b59f tcg/tci: Split out tcg_out_op_r[iI]
7004982 tcg/tci: Split out tcg_out_op_np
c191fb8 tcg/tci: Split out tcg_out_op_v
1ba20d5 tcg/tci: Split out tcg_out_op_{rrm,rrrm,rrrrm}
e31d965 tcg/tci: Split out tcg_out_op_rrrrcl
410ecb8 tcg/tci: Split out tcg_out_op_rrrr
06327d7 tcg/tci: Split out tcg_out_op_rrrrrr
ab0f94f tcg/tci: Split out tcg_out_op_rrcl
c5ebc4e tcg/tci: Split out tcg_out_op_rrrbb
74efd89 tcg/tci: Split out tcg_out_op_rrrrrc
2e5ce8a tcg/tci: Split out tcg_out_op_rrrc
92262f4 tcg/tci: Split out tcg_out_op_rrr
8a239e2 tcg/tci: Split out tcg_out_op_rr
3e08393 tcg/tci: Split out tcg_out_op_p
de027aa tcg/tci: Split out tcg_out_op_l
158aea5 tcg/tci: Split out tcg_out_op_rrs
a8f550f tcg/tci: Push opcode emit into each case
6b16ed8 tcg/tci: Move call-return regs to end of tcg_target_reg_alloc_order 4b276e0 tcg/tci: Improve tcg_target_call_clobber_regs
03fb535 tcg/tci: Use ffi for calls
08630c0 tcg: Build ffi data structures for helpers
110290b tcg/tci: Implement the disassembler properly
af8cf82 tcg/tci: Remove tci_disas
943d70e tcg/tci: Hoist op_size checking into tci_args_*
5614808 tcg/tci: Split out tci_args_{rrm,rrrm,rrrrm}
2869f99 tcg/tci: Reduce qemu_ld/st TCGMemOpIdx operand to 32-bits 3582a1c tcg/tci: Clean up deposit operations
f0171b8 tcg/tci: Split out tci_args_rrrr
7f92807 tcg/tci: Split out tci_args_rrrrrr
0b26e05 tcg/tci: Reuse tci_args_l for goto_tb
7c4a274 tcg/tci: Reuse tci_args_l for exit_tb
ab21186 tcg/tci: Reuse tci_args_l for calls.
cf103cc tcg/tci: Split out tci_args_ri and tci_args_rI
e9d843f tcg/tci: Split out tci_args_rrcl and tci_args_rrrrcl 2cf21fd tcg/tci: Split out tci_args_rrrrrc
e3d915b tcg/tci: Split out tci_args_l
7de9dbe tcg/tci: Split out tci_args_rrrc
711a66e tcg/tci: Split out tci_args_rrr
fe4f405 tcg/tci: Split out tci_args_rr
aa09a6d tcg/tci: Split out tci_args_rrs
9ecb320 tcg/tci: Rename tci_read_r to tci_read_rval
224c1a8 tcg/tci: Merge mov, not and neg operations
13d8e59 tcg/tci: Merge bswap operations
dd76922 tcg/tci: Remove ifdefs for TCG_TARGET_HAS_ext32[us]_i64 df3e5ed tcg/tci: Merge extension operations
ba078b9 tcg/tci: Merge basic arithmetic operations
5ddef6d tcg/tci: Reduce use of tci_read_r64
18fcb82 tcg/tci: Remove tci_read_r32s
5654362 tcg/tci: Remove tci_read_r32
61d9e17 tcg/tci: Remove tci_read_r16s
f8a1a9f tcg/tci: Remove tci_read_r16
e9802a3 tcg/tci: Remove tci_read_r8s
45296e6 tcg/tci: Remove tci_read_r8
c18d3ce tcg/tci: Merge identical cases in generation
facfd9b tcg: Manage splitwx in tc_ptr_to_region_tree by hand a476867 tcg: Split out tcg_raise_tb_overflow
2f8942c tcg/tci: Use exec/cpu_ldst.h interfaces
=== OUTPUT BEGIN ===
1/71 Checking commit 2f8942c11f7a (tcg/tci: Use exec/cpu_ldst.h interfaces) 2/71 Checking commit a4768674a7eb (tcg: Split out tcg_raise_tb_overflow)
3/71 Checking commit facfd9b9fef0 (tcg: Manage splitwx in tc_ptr_to_region_tree by hand) 4/71 Checking commit c18d3ce9381f (tcg/tci: Merge identical cases in generation) 5/71 Checking commit 45296e6a731d (tcg/tci: Remove tci_read_r8)
6/71 Checking commit e9802a3c780d (tcg/tci: Remove tci_read_r8s)
7/71 Checking commit f8a1a9f6fcb7 (tcg/tci: Remove tci_read_r16)
8/71 Checking commit 61d9e175534d (tcg/tci: Remove tci_read_r16s)
9/71 Checking commit 5654362bac78 (tcg/tci: Remove tci_read_r32)
10/71 Checking commit 18fcb82d28ef (tcg/tci: Remove tci_read_r32s)
11/71 Checking commit 5ddef6d22641 (tcg/tci: Reduce use of tci_read_r64)
12/71 Checking commit ba078b9affec (tcg/tci: Merge basic arithmetic operations) 13/71 Checking commit df3e5ed82035 (tcg/tci: Merge extension operations)
14/71 Checking commit dd76922ba15a (tcg/tci: Remove ifdefs for TCG_TARGET_HAS_ext32[us]_i64) 15/71 Checking commit 13d8e599fb0c (tcg/tci: Merge bswap operations)
16/71 Checking commit 224c1a88d049 (tcg/tci: Merge mov, not and neg operations) 17/71 Checking commit 9ecb320de08f (tcg/tci: Rename tci_read_r to tci_read_rval) 18/71 Checking commit aa09a6dcda41 (tcg/tci: Split out tci_args_rrs)
19/71 Checking commit fe4f405a0f09 (tcg/tci: Split out tci_args_rr)
20/71 Checking commit 711a66e44072 (tcg/tci: Split out tci_args_rrr)
21/71 Checking commit 7de9dbe9e5b5 (tcg/tci: Split out tci_args_rrrc)
22/71 Checking commit e3d915b8deeb (tcg/tci: Split out tci_args_l)
23/71 Checking commit 2cf21fd9b7d4 (tcg/tci: Split out tci_args_rrrrrc)
24/71 Checking commit e9d843fe026d (tcg/tci: Split out tci_args_rrcl and tci_args_rrrrcl) 25/71 Checking commit cf103cc55285 (tcg/tci: Split out tci_args_ri and tci_args_rI) 26/71 Checking commit ab211864fc33 (tcg/tci: Reuse tci_args_l for calls.)
27/71 Checking commit 7c4a2742c8e4 (tcg/tci: Reuse tci_args_l for exit_tb) 28/71 Checking commit 0b26e05871d4 (tcg/tci: Reuse tci_args_l for goto_tb) 29/71 Checking commit 7f92807a427f (tcg/tci: Split out tci_args_rrrrrr)
30/71 Checking commit f0171b8f39f2 (tcg/tci: Split out tci_args_rrrr)
31/71 Checking commit 3582a1c54926 (tcg/tci: Clean up deposit operations)
32/71 Checking commit 2869f995d57a (tcg/tci: Reduce qemu_ld/st TCGMemOpIdx operand to 32-bits) 33/71 Checking commit 56148088cb2e (tcg/tci: Split out tci_args_{rrm,rrrm,rrrrm}) 34/71 Checking commit 943d70e3248c (tcg/tci: Hoist op_size checking into tci_args_*) 35/71 Checking commit af8cf82f60b0 (tcg/tci: Remove tci_disas)
36/71 Checking commit 110290b57736 (tcg/tci: Implement the disassembler properly)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#21:
deleted file mode 100644
total: 0 errors, 1 warnings, 304 lines checked
Patch 36/71 has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
37/71 Checking commit 08630c07ee13 (tcg: Build ffi data structures for helpers)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #25:
new file mode 100644
ERROR: Macros with complex values should be enclosed in parenthesis #40: FILE: include/exec/helper-ffi.h:11:
+#define dh_ffitype_i32 &ffi_type_uint32
ERROR: Macros with complex values should be enclosed in parenthesis #41: FILE: include/exec/helper-ffi.h:12:
+#define dh_ffitype_s32 &ffi_type_sint32
ERROR: Macros with complex values should be enclosed in parenthesis #43: FILE: include/exec/helper-ffi.h:14:
+#define dh_ffitype_i64 &ffi_type_uint64
ERROR: Macros with complex values should be enclosed in parenthesis #44: FILE: include/exec/helper-ffi.h:15:
+#define dh_ffitype_s64 &ffi_type_sint64
ERROR: Macros with complex values should be enclosed in parenthesis #45: FILE: include/exec/helper-ffi.h:16:
+#define dh_ffitype_f16 &ffi_type_uint32
ERROR: Macros with complex values should be enclosed in parenthesis #46: FILE: include/exec/helper-ffi.h:17:
+#define dh_ffitype_f32 &ffi_type_uint32
ERROR: Macros with complex values should be enclosed in parenthesis #47: FILE: include/exec/helper-ffi.h:18:
+#define dh_ffitype_f64 &ffi_type_uint64
ERROR: Macros with complex values should be enclosed in parenthesis #50: FILE: include/exec/helper-ffi.h:21:
+# define dh_ffitype_tl &ffi_type_uint32
ERROR: Macros with complex values should be enclosed in parenthesis #52: FILE: include/exec/helper-ffi.h:23:
+# define dh_ffitype_tl &ffi_type_uint64
ERROR: Macros with complex values should be enclosed in parenthesis #55: FILE: include/exec/helper-ffi.h:26:
+#define dh_ffitype_ptr &ffi_type_pointer
ERROR: Macros with complex values should be enclosed in parenthesis #56: FILE: include/exec/helper-ffi.h:27:
+#define dh_ffitype_cptr &ffi_type_pointer
ERROR: Macros with complex values should be enclosed in parenthesis #59: FILE: include/exec/helper-ffi.h:30:
+#define dh_ffitype_env &ffi_type_pointer
ERROR: space required after that ',' (ctx:VxV)
#63: FILE: include/exec/helper-ffi.h:34:
+ static ffi_cif glue(cif_,NAME) = { \
^ERROR: Macros with multiple statements should be enclosed in a do - while loop #67: FILE: include/exec/helper-ffi.h:38:
+#define DEF_HELPER_FLAGS_1(NAME, FLAGS, ret, t1) \
+ static ffi_type *glue(cif_args_,NAME)[1] = { dh_ffitype(t1) }; \
+ static ffi_cif glue(cif_,NAME) = { \
+ .rtype = dh_ffitype(ret), .nargs = 1, \
+ .arg_types = glue(cif_args_,NAME), \+ };
ERROR: spaces required around that '*' (ctx:WxV)
#68: FILE: include/exec/helper-ffi.h:39:
+ static ffi_type *glue(cif_args_,NAME)[1] = { dh_ffitype(t1) }; \
^ERROR: space required after that ',' (ctx:VxV)
#68: FILE: include/exec/helper-ffi.h:39:
+ static ffi_type *glue(cif_args_,NAME)[1] = { dh_ffitype(t1) }; \
^ERROR: open brace '{' following function declarations go on the next line #69: FILE: include/exec/helper-ffi.h:40:
+ static ffi_cif glue(cif_,NAME) = { \
ERROR: space required after that ',' (ctx:VxV)
#69: FILE: include/exec/helper-ffi.h:40:
+ static ffi_cif glue(cif_,NAME) = { \
^ERROR: space required after that ',' (ctx:VxV)
#71: FILE: include/exec/helper-ffi.h:42:
+ .arg_types = glue(cif_args_,NAME), \
^ERROR: Macros with multiple statements should be enclosed in a do - while loop #74: FILE: include/exec/helper-ffi.h:45:
+#define DEF_HELPER_FLAGS_2(NAME, FLAGS, ret, t1, t2) \
+ static ffi_type *glue(cif_args_,NAME)[2] = { \
+ dh_ffitype(t1), dh_ffitype(t2) \
+ }; \
+ static ffi_cif glue(cif_,NAME) = { \
+ .rtype = dh_ffitype(ret), .nargs = 2, \
+ .arg_types = glue(cif_args_,NAME), \+ };
ERROR: spaces required around that '*' (ctx:WxV)
#75: FILE: include/exec/helper-ffi.h:46:
+ static ffi_type *glue(cif_args_,NAME)[2] = { \
^ERROR: space required after that ',' (ctx:VxV)
#75: FILE: include/exec/helper-ffi.h:46:
+ static ffi_type *glue(cif_args_,NAME)[2] = { \
^ERROR: open brace '{' following function declarations go on the next line #78: FILE: include/exec/helper-ffi.h:49:
+ static ffi_cif glue(cif_,NAME) = { \
ERROR: space required after that ',' (ctx:VxV)
#78: FILE: include/exec/helper-ffi.h:49:
+ static ffi_cif glue(cif_,NAME) = { \
^ERROR: space required after that ',' (ctx:VxV)
#80: FILE: include/exec/helper-ffi.h:51:
+ .arg_types = glue(cif_args_,NAME), \
^ERROR: Macros with multiple statements should be enclosed in a do - while loop #83: FILE: include/exec/helper-ffi.h:54:
+#define DEF_HELPER_FLAGS_3(NAME, FLAGS, ret, t1, t2, t3) \
+ static ffi_type *glue(cif_args_,NAME)[3] = { \
+ dh_ffitype(t1), dh_ffitype(t2), dh_ffitype(t3) \
+ }; \
+ static ffi_cif glue(cif_,NAME) = { \
+ .rtype = dh_ffitype(ret), .nargs = 3, \
+ .arg_types = glue(cif_args_,NAME), \+ };
ERROR: spaces required around that '*' (ctx:WxV)
#84: FILE: include/exec/helper-ffi.h:55:
+ static ffi_type *glue(cif_args_,NAME)[3] = { \
^ERROR: space required after that ',' (ctx:VxV)
#84: FILE: include/exec/helper-ffi.h:55:
+ static ffi_type *glue(cif_args_,NAME)[3] = { \
^ERROR: open brace '{' following function declarations go on the next line #87: FILE: include/exec/helper-ffi.h:58:
+ static ffi_cif glue(cif_,NAME) = { \
ERROR: space required after that ',' (ctx:VxV)
#87: FILE: include/exec/helper-ffi.h:58:
+ static ffi_cif glue(cif_,NAME) = { \
^ERROR: space required after that ',' (ctx:VxV)
#89: FILE: include/exec/helper-ffi.h:60:
+ .arg_types = glue(cif_args_,NAME), \
^ERROR: Macros with multiple statements should be enclosed in a do - while loop #92: FILE: include/exec/helper-ffi.h:63:
+#define DEF_HELPER_FLAGS_4(NAME, FLAGS, ret, t1, t2, t3, t4) \
+ static ffi_type *glue(cif_args_,NAME)[4] = { \
+ dh_ffitype(t1), dh_ffitype(t2), dh_ffitype(t3), dh_ffitype(t4) \
+ }; \
+ static ffi_cif glue(cif_,NAME) = { \
+ .rtype = dh_ffitype(ret), .nargs = 4, \
+ .arg_types = glue(cif_args_,NAME), \+ };
ERROR: spaces required around that '*' (ctx:WxV)
#93: FILE: include/exec/helper-ffi.h:64:
+ static ffi_type *glue(cif_args_,NAME)[4] = { \
^ERROR: space required after that ',' (ctx:VxV)
#93: FILE: include/exec/helper-ffi.h:64:
+ static ffi_type *glue(cif_args_,NAME)[4] = { \
^ERROR: open brace '{' following function declarations go on the next line #96: FILE: include/exec/helper-ffi.h:67:
+ static ffi_cif glue(cif_,NAME) = { \
ERROR: space required after that ',' (ctx:VxV)
#96: FILE: include/exec/helper-ffi.h:67:
+ static ffi_cif glue(cif_,NAME) = { \
^ERROR: space required after that ',' (ctx:VxV)
#98: FILE: include/exec/helper-ffi.h:69:
+ .arg_types = glue(cif_args_,NAME), \
^ERROR: Macros with multiple statements should be enclosed in a do - while loop #101: FILE: include/exec/helper-ffi.h:72:
+#define DEF_HELPER_FLAGS_5(NAME, FLAGS, ret, t1, t2, t3, t4, t5) \
+ static ffi_type *glue(cif_args_,NAME)[5] = { \
+ dh_ffitype(t1), dh_ffitype(t2), dh_ffitype(t3), \
+ dh_ffitype(t4), dh_ffitype(t5) \
+ }; \
+ static ffi_cif glue(cif_,NAME) = { \
+ .rtype = dh_ffitype(ret), .nargs = 5, \
+ .arg_types = glue(cif_args_,NAME), \+ };
ERROR: spaces required around that '*' (ctx:WxV)
#102: FILE: include/exec/helper-ffi.h:73:
+ static ffi_type *glue(cif_args_,NAME)[5] = { \
^ERROR: space required after that ',' (ctx:VxV)
#102: FILE: include/exec/helper-ffi.h:73:
+ static ffi_type *glue(cif_args_,NAME)[5] = { \
^ERROR: open brace '{' following function declarations go on the next line #106: FILE: include/exec/helper-ffi.h:77:
+ static ffi_cif glue(cif_,NAME) = { \
ERROR: space required after that ',' (ctx:VxV)
#106: FILE: include/exec/helper-ffi.h:77:
+ static ffi_cif glue(cif_,NAME) = { \
^ERROR: space required after that ',' (ctx:VxV)
#108: FILE: include/exec/helper-ffi.h:79:
+ .arg_types = glue(cif_args_,NAME), \
^ERROR: Macros with multiple statements should be enclosed in a do - while loop #111: FILE: include/exec/helper-ffi.h:82:
+#define DEF_HELPER_FLAGS_6(NAME, FLAGS, ret, t1, t2, t3, t4, t5, t6) \
+ static ffi_type *glue(cif_args_,NAME)[6] = { \
+ dh_ffitype(t1), dh_ffitype(t2), dh_ffitype(t3), \
+ dh_ffitype(t4), dh_ffitype(t5), dh_ffitype(t6) \
+ }; \
+ static ffi_cif glue(cif_,NAME) = { \
+ .rtype = dh_ffitype(ret), .nargs = 6, \
+ .arg_types = glue(cif_args_,NAME), \+ };
ERROR: spaces required around that '*' (ctx:WxV)
#112: FILE: include/exec/helper-ffi.h:83:
+ static ffi_type *glue(cif_args_,NAME)[6] = { \
^ERROR: space required after that ',' (ctx:VxV)
#112: FILE: include/exec/helper-ffi.h:83:
+ static ffi_type *glue(cif_args_,NAME)[6] = { \
^ERROR: open brace '{' following function declarations go on the next line #116: FILE: include/exec/helper-ffi.h:87:
+ static ffi_cif glue(cif_,NAME) = { \
ERROR: space required after that ',' (ctx:VxV)
#116: FILE: include/exec/helper-ffi.h:87:
+ static ffi_cif glue(cif_,NAME) = { \
^ERROR: space required after that ',' (ctx:VxV)
#118: FILE: include/exec/helper-ffi.h:89:
+ .arg_types = glue(cif_args_,NAME), \
^ERROR: Macros with multiple statements should be enclosed in a do - while loop #121: FILE: include/exec/helper-ffi.h:92:
+#define DEF_HELPER_FLAGS_7(NAME, FLAGS, ret, t1, t2, t3, t4, t5, t6, t7) \
+ static ffi_type *glue(cif_args_,NAME)[7] = { \
+ dh_ffitype(t1), dh_ffitype(t2), dh_ffitype(t3), \
+ dh_ffitype(t4), dh_ffitype(t5), dh_ffitype(t6), dh_ffitype(t7) \
+ }; \
+ static ffi_cif glue(cif_,NAME) = { \
+ .rtype = dh_ffitype(ret), .nargs = 7, \
+ .arg_types = glue(cif_args_,NAME), \+ };
ERROR: spaces required around that '*' (ctx:WxV)
#122: FILE: include/exec/helper-ffi.h:93:
+ static ffi_type *glue(cif_args_,NAME)[7] = { \
^ERROR: space required after that ',' (ctx:VxV)
#122: FILE: include/exec/helper-ffi.h:93:
+ static ffi_type *glue(cif_args_,NAME)[7] = { \
^ERROR: open brace '{' following function declarations go on the next line #126: FILE: include/exec/helper-ffi.h:97:
+ static ffi_cif glue(cif_,NAME) = { \
ERROR: space required after that ',' (ctx:VxV)
#126: FILE: include/exec/helper-ffi.h:97:
+ static ffi_cif glue(cif_,NAME) = { \
^ERROR: space required after that ',' (ctx:VxV)
#128: FILE: include/exec/helper-ffi.h:99:
+ .arg_types = glue(cif_args_,NAME), \
^total: 55 errors, 1 warnings, 309 lines checked
Patch 37/71 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
38/71 Checking commit 03fb53571a97 (tcg/tci: Use ffi for calls)
ERROR: spaces required around that '+' (ctx:VxV)
#93: FILE: tcg/tcg.c:2085:
+ bool is_64bit = sizemask & (1 << (i+1)*2);
^ERROR: spaces required around that '*' (ctx:VxV)
#93: FILE: tcg/tcg.c:2085:
+ bool is_64bit = sizemask & (1 << (i+1)*2);
^ERROR: suspect code indent for conditional statements (8, 11) #122: FILE: tcg/tcg.c:2104:
+ if (TCG_TARGET_REG_BITS < 64 && is_64bit) {
+ /*
total: 3 errors, 0 warnings, 387 lines checked
Patch 38/71 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
39/71 Checking commit 4b276e00585f (tcg/tci: Improve tcg_target_call_clobber_regs) 40/71 Checking commit 6b16ed82c3cb (tcg/tci: Move call-return regs to end of tcg_target_reg_alloc_order) 41/71 Checking commit a8f550f73633 (tcg/tci: Push opcode emit into each case)
42/71 Checking commit 158aea50157a (tcg/tci: Split out tcg_out_op_rrs)
43/71 Checking commit de027aa8d54a (tcg/tci: Split out tcg_out_op_l)
44/71 Checking commit 3e08393a2a94 (tcg/tci: Split out tcg_out_op_p)
45/71 Checking commit 8a239e2737b6 (tcg/tci: Split out tcg_out_op_rr)
46/71 Checking commit 92262f4db0a6 (tcg/tci: Split out tcg_out_op_rrr)
47/71 Checking commit 2e5ce8a25bff (tcg/tci: Split out tcg_out_op_rrrc)
48/71 Checking commit 74efd8927ccd (tcg/tci: Split out tcg_out_op_rrrrrc)
49/71 Checking commit c5ebc4e7dad3 (tcg/tci: Split out tcg_out_op_rrrbb)
50/71 Checking commit ab0f94f4c906 (tcg/tci: Split out tcg_out_op_rrcl)
51/71 Checking commit 06327d7aa3ca (tcg/tci: Split out tcg_out_op_rrrrrr)
52/71 Checking commit 410ecb8a8f40 (tcg/tci: Split out tcg_out_op_rrrr)
53/71 Checking commit e31d965631c6 (tcg/tci: Split out tcg_out_op_rrrrcl)
54/71 Checking commit 1ba20d596566 (tcg/tci: Split out tcg_out_op_{rrm,rrrm,rrrrm}) 55/71 Checking commit c191fb85d058 (tcg/tci: Split out tcg_out_op_v)
56/71 Checking commit 700498232323 (tcg/tci: Split out tcg_out_op_np)
57/71 Checking commit db6b59ff016d (tcg/tci: Split out tcg_out_op_r[iI])
58/71 Checking commit c17b133aa9e4 (tcg/tci: Reserve r13 for a temporary)
59/71 Checking commit b776dc697813 (tcg/tci: Emit setcond before brcond)
60/71 Checking commit 62612727551d (tcg/tci: Remove tci_write_reg)
61/71 Checking commit 19bec07a5e12 (tcg/tci: Change encoding to uint32_t units)
62/71 Checking commit e1ad4f48baaf (tcg/tci: Implement goto_ptr)
63/71 Checking commit 4568e3455959 (tcg/tci: Implement movcond)
64/71 Checking commit b83da745d3d4 (tcg/tci: Implement andc, orc, eqv, nand, nor)
65/71 Checking commit e7ab3061f755 (tcg/tci: Implement extract, sextract)
66/71 Checking commit a35dc197d225 (tcg/tci: Implement clz, ctz, ctpop)
67/71 Checking commit 191eee2f94e6 (tcg/tci: Implement mulu2, muls2)
68/71 Checking commit 445fd0c7b411 (tcg/tci: Implement add2, sub2)
69/71 Checking commit ad8b71759c36 (tcg/tci: Split out tci_qemu_ld, tci_qemu_st)
70/71 Checking commit e125dfdfdad7 (tests/tcg: Increase timeout for TCI)
71/71 Checking commit e85d15221e70 (gitlab: Enable cross-i386 builds of TCI)
=== OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]