qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v1] RISC-V: RISC-V TCG backend work in progress


From: Michael Clark
Subject: Re: [Qemu-devel] [PATCH v1] RISC-V: RISC-V TCG backend work in progress
Date: Tue, 27 Mar 2018 22:33:47 -0700

On Tue, Mar 27, 2018 at 5:35 PM, Richard Henderson <
address@hidden> wrote:

> On 03/28/2018 01:43 AM, Michael Clark wrote:
> >     > +    if ((ct & TCG_CT_CONST_N12) && val >= -2047 && val <= 2047) {
> >
> >     +2048?
>

Yes of course, you're right. It's safe. I just hadn't thought about it
carefully enough.


> > We use this constraint for a negatable immediate and the constraint is
> only
> > applied to sub. We have no subi, so we implement subi as addi rd, rs1,
> -imm
> >
> >     case INDEX_op_sub_i32:
> >         if (c2) {
> >             tcg_out_opc_imm(s, is32bit ? OPC_ADDI : OPC_ADDIW, a0, a1,
> -a2);
> >         } else {
> >             tcg_out_opc_reg(s, is32bit ? OPC_SUB : OPC_SUBW, a0, a1, a2);
> >         }
> >         break;
>
> That's my point.  The "positive" range for addition is -2048...2047, so the
> "negative" range for subtraction should be -2047...2048.
>

Got it. Thanks.


reply via email to

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