[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 08/14] i386: do not compute eflags multiple time
From: |
Richard Henderson |
Subject: |
Re: [Qemu-devel] [PATCH 08/14] i386: do not compute eflags multiple times consecutively |
Date: |
Tue, 09 Oct 2012 12:14:16 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120911 Thunderbird/15.0.1 |
On 10/06/2012 05:30 AM, Paolo Bonzini wrote:
> +static void gen_compute_eflags(DisasContext *s)
> {
> if (s->cc_op != CC_OP_DYNAMIC) {
> gen_op_set_cc_op(s->cc_op);
> }
> + if (s->cc_op == CC_OP_EFLAGS) {
> + return;
> }
> + gen_helper_cc_compute_all(cpu_tmp2_i32, cpu_env, cpu_cc_op);
> + tcg_gen_discard_tl(cpu_cc_dst);
> + s->cc_op = CC_OP_EFLAGS;
> + tcg_gen_extu_i32_tl(cpu_cc_src, cpu_tmp2_i32);
> }
Can we at this point in the series assert that if s->cc_op == CC_OP_EFLAGS,
then cpu_cc_op has also been assigned CC_OP_EFLAGS? If so, then we can do
if (s->cc_op == CC_OP_EFLAGS) {
return;
}
if (s->cc_op != CC_OP_DYNAMIC) {
gen_op_set_cc_op(s->cc_op);
}
...
As-is it would appear that we get redundant assignments to cpu_cc_op when
calling this routine twice in a row. And with that helper call in between
we won't be able to eliminate the second assignment.
I'll also note that we'd probably get better code if gen_helper_cc_compute_all
took all of cpu_cc_{op,src,dst} as arguments so that it could be CONST+PURE.
With just that changed I think the redundant assignment to cpu_cc_op would
be eliminated.
All that said, I don't see anything wrong with the patch as-is, and probably
these other things I mention would want to be follow-on patches anyway.
Reviewed-by: Richard Henderson <address@hidden>
r~
- Re: [Qemu-devel] [PATCH 07/14] i386: add helper functions to get other flags, (continued)
- [Qemu-devel] [PATCH 06/14] i386: factor gen_op_set_cc_op/tcg_gen_discard_tl around computing flags, Paolo Bonzini, 2012/10/06
- [Qemu-devel] [PATCH 09/14] i386: do not call helper to compute ZF/SF, Paolo Bonzini, 2012/10/06
- [Qemu-devel] [PATCH 08/14] i386: do not compute eflags multiple times consecutively, Paolo Bonzini, 2012/10/06
- [Qemu-devel] [PATCH 05/14] i386: move eflags computation closer to gen_op_set_cc_op, Paolo Bonzini, 2012/10/06
- [Qemu-devel] [PATCH 10/14] i386: use inverted setcond when computing NS or NZ, Paolo Bonzini, 2012/10/06
- [Qemu-devel] [PATCH 13/14] i386: optimize setbe, Paolo Bonzini, 2012/10/06
- [Qemu-devel] [PATCH 12/14] i386: change gen_setcc_slow_T0 to gen_setcc_slow, Paolo Bonzini, 2012/10/06