[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 11/14] i386: convert gen_compute_eflags_c to TCG
From: |
Richard Henderson |
Subject: |
Re: [Qemu-devel] [PATCH 11/14] i386: convert gen_compute_eflags_c to TCG |
Date: |
Tue, 09 Oct 2012 13:07:05 -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:
> + case CC_OP_SUBB:
> + case CC_OP_SUBW:
> + case CC_OP_SUBL:
> + case CC_OP_SUBQ:
> + /* (DATA_TYPE)(CC_DST + CC_SRC) < (DATA_TYPE)CC_SRC */
> + size = (s->cc_op - CC_OP_ADDB) & 3;
I guess the & 3 makes the result "just so happen" to be right,
but I think the code would be more readable with "- SUBB" there.
And the other cases of the same pattern below.
> + case CC_OP_SBBB:
> + case CC_OP_SBBW:
> + case CC_OP_SBBL:
> + case CC_OP_SBBQ:
> + /* (DATA_TYPE)(CC_DST + CC_SRC + 1) <= (DATA_TYPE)CC_SRC */
> + size = (s->cc_op - CC_OP_ADDB) & 3;
> + t1 = gen_ext_tl(cpu_tmp0, cpu_cc_src, size, false);
> + if (t1 == reg && reg == cpu_cc_src) {
> + tcg_gen_mov_tl(cpu_tmp0, cpu_cc_src);
> + t1 = cpu_tmp0;
> + }
> +
> + tcg_gen_add_tl(reg, cpu_cc_dst, cpu_cc_src);
> + tcg_gen_addi_tl(reg, reg, 1);
> + gen_extu(size, reg);
> + t0 = reg;
> + goto adc_sbb;
> +
> + case CC_OP_ADCB:
> + case CC_OP_ADCW:
> + case CC_OP_ADCL:
> + case CC_OP_ADCQ:
> + /* (DATA_TYPE)CC_DST <= (DATA_TYPE)CC_SRC */
> + size = (s->cc_op - CC_OP_ADDB) & 3;
> + t1 = gen_ext_tl(cpu_tmp0, cpu_cc_src, size, false);
> + t0 = gen_ext_tl(reg, cpu_cc_dst, size, false);
> + adc_sbb:
> + tcg_gen_setcond_tl(inv ? TCG_COND_GTU : TCG_COND_LEU, reg, t0, t1);
> + return;
There's no point in handling these, because you can never see them
assigned to s->cc_op. The ADC/SBB translators always set CC_OP_DYNAMIC
after dynamically selecting CC_OP_ADD or CC_OP_ADC based on the carry-in.
> + default:
> + abort();
Better to just treat unlisted codes as dynamic? I.e.
default: /* Including CC_OP_DYNAMIC */
gen_compute_eflags(s);
/* FALLTHRU */
case CC_OP_EFLAGS:
...
All that said, the patch as written is correct.
Reviewed-by: Richard Henderson <address@hidden>
r~
- Re: [Qemu-devel] [PATCH 10/14] i386: use inverted setcond when computing NS or NZ, (continued)