qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 07/19] target/i386: introduce flags writeback mechanism


From: Paolo Bonzini
Subject: Re: [PATCH v2 07/19] target/i386: introduce flags writeback mechanism
Date: Thu, 19 Oct 2023 21:08:46 +0200



Il gio 19 ott 2023, 19:44 Richard Henderson <richard.henderson@linaro.org> ha scritto:
On 10/19/23 03:46, Paolo Bonzini wrote:
> +    /*
> +     * Write back flags after last memory access.  Some newer ALU instructions, as
> +     * well as SSE instructions, write flags in the gen_* function, but that can
> +     * cause incorrect tracking of CC_OP for instructions that write to both memory
> +     * and flags.
> +     */
> +    if (decode.cc_op != -1) {
> +        if (decode.cc_dst) {
> +            tcg_gen_mov_tl(cpu_cc_dst, decode.cc_dst);
> +        }
> +        if (decode.cc_src) {
> +            tcg_gen_mov_tl(cpu_cc_src, decode.cc_src);
> +        }
> +        if (decode.cc_src2) {
> +            tcg_gen_mov_tl(cpu_cc_src2, decode.cc_src2);
> +        }
> +        if (decode.cc_op == CC_OP_DYNAMIC) {
> +            tcg_gen_mov_i32(cpu_cc_op, decode.cc_op_dynamic);
> +        } else {
> +            assert(!decode.cc_op_dynamic);
> +        }
> +        set_cc_op(s, decode.cc_op);
> +    } else {
> +        assert(!decode.cc_dst);
> +        assert(!decode.cc_src);
> +        assert(!decode.cc_src2);
> +        assert(!decode.cc_op_dynamic);
> +    }

I suggest you use cc_op_live[] to ensure that each output is present if USES_CC_* is set,
and absent otherwise. Obviously that's not possible for CC_OP_DYNAMIC, but for everything else...

I tried but it didn't work very well. I have shuffled things a bit and I don't remember why :) so I will give it another go.

Paolo



r~


reply via email to

[Prev in Thread] Current Thread [Next in Thread]