qemu-ppc
[Top][All Lists]
Advanced

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

Re: [Qemu-ppc] [RFC v2 05/13] target-ppc: add modulo word operations


From: Richard Henderson
Subject: Re: [Qemu-ppc] [RFC v2 05/13] target-ppc: add modulo word operations
Date: Mon, 25 Jul 2016 20:04:34 +0530
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1

On 07/25/2016 04:44 PM, Nikunj A Dadhania wrote:
Modulo case: a % (b == 0 ? 1 : b)

    tcg_gen_trunc_tl_i32(t0, cpu_gpr[rA(ctx->opcode)]);
    tcg_gen_trunc_tl_i32(t1, cpu_gpr[rB(ctx->opcode)]);
    tcg_gen_setcondi_i32(TCG_COND_EQ, t2, t1, 0);
    tcg_gen_movi_i32(t3, 0);
    tcg_gen_movcond_i32(TCG_COND_NE, t1, t2, t3, t2, t1);

No setcond for unsigned; you can do the whole thing with movcond.

  t2 = tcg_const_i32(1);
  t3 = tcg_const_i32(0);
  tcg_gen_movcond_i32(TCG_COND_EQ, t1, t1, t3, t2, t1);

But otherwise, yes.

For "div[wd]o." we will have further cases to implement overflow.

For divwo, you *would* actually do the setcond as above, because that would be exactly the overflow condition that you're supposed to compute.

The signed case you pasted looks correct, and the T2 input to the movcond is also exactly the overflow condition.


r~



reply via email to

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