qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC v1 09/13] target-ppc: add cmpeqb instruction


From: Nikunj A Dadhania
Subject: Re: [Qemu-devel] [RFC v1 09/13] target-ppc: add cmpeqb instruction
Date: Thu, 21 Jul 2016 13:32:02 +0530
User-agent: Notmuch/0.21 (https://notmuchmail.org) Emacs/25.0.94.1 (x86_64-redhat-linux-gnu)

Richard Henderson <address@hidden> writes:

> On 07/18/2016 10:35 PM, Nikunj A Dadhania wrote:
>> +    tcg_gen_andi_tl(src1, cpu_gpr[rA(ctx->opcode)], 0xFF);
>> +    for (i = 0; i < 64; i += 8) {
>> +        tcg_gen_shri_tl(t0, arg1, i);
>> +        tcg_gen_andi_tl(t0, t0, 0xFF);
>> +        tcg_gen_brcond_tl(TCG_COND_EQ, src1, t0, l1);
>> +    }
>> +    tcg_gen_movi_i32(cpu_crf[crfD(ctx->opcode)], 0);
>> +    tcg_gen_br(l2);
>> +    gen_set_label(l1);
>> +    /* Set match bit, i.e. CRF_GT */
>> +    tcg_gen_movi_i32(cpu_crf[crfD(ctx->opcode)], 1 << CRF_GT);
>
> Ew.  This can be done much better as
>
>    http://graphics.stanford.edu/~seander/bithacks.html#ZeroInWord
>
> Which still might be best done in a helper, because of the constants involved 
> (tcg is not nearly so good as gcc in building full 64-bit constants).
>
> C.f. target-alpha/int_helper.c, helper_cmpbe0 (which computes different 
> information than cmpeqb, but is still helpful as an example).

Sure, I will have a look.

Nikunj




reply via email to

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