[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v6 15/25] tcg/s390: Implement goto_ptr
From: |
Aurelien Jarno |
Subject: |
Re: [Qemu-devel] [PATCH v6 15/25] tcg/s390: Implement goto_ptr |
Date: |
Sat, 6 May 2017 14:15:00 +0200 |
User-agent: |
NeoMutt/20170113 (1.7.2) |
On 2017-05-02 12:22, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <address@hidden>
> ---
> tcg/s390/tcg-target.h | 2 +-
> tcg/s390/tcg-target.inc.c | 24 +++++++++++++++++++++---
> 2 files changed, 22 insertions(+), 4 deletions(-)
>
> diff --git a/tcg/s390/tcg-target.h b/tcg/s390/tcg-target.h
> index 6b7bcfb..957f0c0 100644
> --- a/tcg/s390/tcg-target.h
> +++ b/tcg/s390/tcg-target.h
> @@ -92,7 +92,7 @@ extern uint64_t s390_facilities;
> #define TCG_TARGET_HAS_mulsh_i32 0
> #define TCG_TARGET_HAS_extrl_i64_i32 0
> #define TCG_TARGET_HAS_extrh_i64_i32 0
> -#define TCG_TARGET_HAS_goto_ptr 0
> +#define TCG_TARGET_HAS_goto_ptr 1
>
> #define TCG_TARGET_HAS_div2_i64 1
> #define TCG_TARGET_HAS_rot_i64 1
> diff --git a/tcg/s390/tcg-target.inc.c b/tcg/s390/tcg-target.inc.c
> index a679280..5d7083e 100644
> --- a/tcg/s390/tcg-target.inc.c
> +++ b/tcg/s390/tcg-target.inc.c
> @@ -1741,9 +1741,14 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode
> opc,
>
> switch (opc) {
> case INDEX_op_exit_tb:
> - /* return value */
> - tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_R2, args[0]);
> - tgen_gotoi(s, S390_CC_ALWAYS, tb_ret_addr);
> + /* Reuse the zeroing that exists for goto_ptr. */
> + a0 = args[0];
> + if (a0 == 0) {
> + tgen_gotoi(s, S390_CC_ALWAYS, s->code_gen_epilogue);
> + } else {
> + tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_R2, a0);
> + tgen_gotoi(s, S390_CC_ALWAYS, tb_ret_addr);
> + }
> break;
>
> case INDEX_op_goto_tb:
> @@ -1767,6 +1772,10 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode
> opc,
> s->tb_jmp_reset_offset[args[0]] = tcg_current_code_size(s);
> break;
>
> + case INDEX_op_goto_ptr:
> + tcg_out_insn(s, RR, BCR, S390_CC_ALWAYS, args[0]);
> + break;
> +
> OP_32_64(ld8u):
> /* ??? LLC (RXY format) is only present with the extended-immediate
> facility, whereas LLGC is always present. */
> @@ -2241,6 +2250,7 @@ static const TCGTargetOpDef s390_op_defs[] = {
> { INDEX_op_exit_tb, { } },
> { INDEX_op_goto_tb, { } },
> { INDEX_op_br, { } },
> + { INDEX_op_goto_ptr, { "r" } },
>
> { INDEX_op_ld8u_i32, { "r", "r" } },
> { INDEX_op_ld8s_i32, { "r", "r" } },
> @@ -2439,6 +2449,14 @@ static void tcg_target_qemu_prologue(TCGContext *s)
> /* br %r3 (go to TB) */
> tcg_out_insn(s, RR, BCR, S390_CC_ALWAYS, tcg_target_call_iarg_regs[1]);
>
> + /*
> + * Return path for goto_ptr. Set return value to 0, a-la exit_tb,
> + * and fall through to the rest of the epilogue.
> + */
> + s->code_gen_epilogue = s->code_ptr;
> + tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_R2, 0);
> +
> + /* TB epilogue */
> tb_ret_addr = s->code_ptr;
>
> /* lmg %r6,%r15,fs+48(%r15) (restore registers) */
Reviewed-by: Aurelien Jarno <address@hidden>
Tested-by: Aurelien Jarno <address@hidden>
--
Aurelien Jarno GPG: 4096R/1DDD8C9B
address@hidden http://www.aurel32.net
- [Qemu-devel] [PATCH v6 03/25] qemu/atomic: Loosen restrictions for 64-bit ILP32 hosts, (continued)
- [Qemu-devel] [PATCH v6 03/25] qemu/atomic: Loosen restrictions for 64-bit ILP32 hosts, Richard Henderson, 2017/05/02
- [Qemu-devel] [PATCH v6 05/25] tcg/i386: implement goto_ptr, Richard Henderson, 2017/05/02
- [Qemu-devel] [PATCH v6 06/25] target/arm: optimize cross-page direct jumps in softmmu, Richard Henderson, 2017/05/02
- [Qemu-devel] [PATCH v6 07/25] target/arm: optimize indirect branches, Richard Henderson, 2017/05/02
- [Qemu-devel] [PATCH v6 04/25] tcg: Introduce goto_ptr opcode and tcg_gen_lookup_and_goto_ptr, Richard Henderson, 2017/05/02
- [Qemu-devel] [PATCH v6 09/25] target/i386: optimize cross-page direct jumps in softmmu, Richard Henderson, 2017/05/02
- [Qemu-devel] [PATCH v6 08/25] target/i386: introduce gen_jr helper to generate lookup_and_goto_ptr, Richard Henderson, 2017/05/02
- [Qemu-devel] [PATCH v6 10/25] target/i386: optimize indirect branches, Richard Henderson, 2017/05/02
- [Qemu-devel] [PATCH v6 12/25] tcg/ppc: Implement goto_ptr, Richard Henderson, 2017/05/02
- [Qemu-devel] [PATCH v6 15/25] tcg/s390: Implement goto_ptr, Richard Henderson, 2017/05/02
- Re: [Qemu-devel] [PATCH v6 15/25] tcg/s390: Implement goto_ptr,
Aurelien Jarno <=
- [Qemu-devel] [PATCH v6 13/25] tcg/aarch64: Implement goto_ptr, Richard Henderson, 2017/05/02
- [Qemu-devel] [PATCH v6 11/25] tb-hash: improve tb_jmp_cache hash function in user mode, Richard Henderson, 2017/05/02
- [Qemu-devel] [PATCH v6 17/25] tcg/arm: Implement goto_ptr, Richard Henderson, 2017/05/02
- [Qemu-devel] [PATCH v6 14/25] tcg/sparc: Implement goto_ptr, Richard Henderson, 2017/05/02
- [Qemu-devel] [PATCH v6 16/25] tcg/arm: Clarify tcg_out_bx for arm4 host, Richard Henderson, 2017/05/02
- [Qemu-devel] [PATCH v6 19/25] target/hppa: Use tcg_gen_lookup_and_goto_ptr, Richard Henderson, 2017/05/02
- [Qemu-devel] [PATCH v6 20/25] target/alpha: Use tcg_gen_lookup_and_goto_ptr, Richard Henderson, 2017/05/02
- [Qemu-devel] [PATCH v6 18/25] target/s390: Use tcg_gen_lookup_and_goto_ptr, Richard Henderson, 2017/05/02