qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC] TCG new op: setcond


From: Paul Brook
Subject: Re: [Qemu-devel] [RFC] TCG new op: setcond
Date: Tue, 4 Nov 2008 14:16:38 +0100
User-agent: KMail/1.9.9

> this patch implements a new TCG op, setcond, that sets a temp
> to 1 if the condition is true, else to 0.  The benefit is the potential
> removal of brcond instructions, and helpers size reduction which
> can lead to using TCG instead of helpers.

>   - a variant that sets -1 instead of 1 for masking

I'm worried about this. If we're not careful we'll end up with an explosion of 
different patterns, many of which aren't optimal of different hosts.

>   - 64 bit setcond's

You should do this sooner rather than later, and on a 32-bit host.

> +    /* clear ret since setcc only sets the lower 8 bits */
> +    tcg_out_modrm(s, 0x01 | (ARITH_XOR << 3) | rexw, ret, ret);

This is broken. Inputs and outputs may overlap.

> +    // TODO this should use tcg_out_modrm
> +    //      however currently tcg_out_modrm outputs an extra byte for
> [abcd]l +    //tcg_out_modrm(s, (0x90 + tcg_cond_to_jcc[cond]) | P_EXT |
> P_REXB, ret, 0)

This is the wrong way to fix this. If you really care about the extra code 
byte (which is harmless) you should fix tcg_out_modrm.

Also, please use C comments, not c++ style //.

Paul




reply via email to

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