qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 4/6] Do constant folding for boolean operations.


From: Richard Henderson
Subject: Re: [Qemu-devel] [PATCH 4/6] Do constant folding for boolean operations.
Date: Fri, 20 May 2011 11:45:22 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Thunderbird/3.1.10

On 05/20/2011 05:39 AM, Kirill Batuzov wrote:
> +        case INDEX_op_or_i32:
> +        case INDEX_op_and_i32:
> +#if TCG_TARGET_REG_BITS == 64
> +        case INDEX_op_and_i64:
> +        case INDEX_op_or_i64:
> +#endif
> +            if (args[1] == args[2]) {
> +                if (args[1] == args[0]) {
> +                    args += 3;
> +                    gen_opc_buf[op_index] = INDEX_op_nop;
> +                } else {

I do wonder if it would be better to split this sort of optimization
out into a different function.  You're applying identity sorts of
functions here, where you're not doing it for other operations, 
such as x + 0.

Indeed, I'll argue that 0+x is more likely to happen than x|x, given
that the 0 value could have been relocation filled in by the linker.
Consider @hi16 and @lo16 relocation pairs when the symbol happens to
be linked into the low 64k of the address space.


r~



reply via email to

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