qemu-riscv
[Top][All Lists]
Advanced

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

Re: [Qemu-riscv] [RFC v2 14/24] riscv: tcg-target: Add branch and jump i


From: Richard Henderson
Subject: Re: [Qemu-riscv] [RFC v2 14/24] riscv: tcg-target: Add branch and jump instructions
Date: Wed, 28 Nov 2018 19:08:35 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0

On 11/28/18 5:06 PM, Alistair Francis wrote:
> On Wed, Nov 28, 2018 at 12:15 PM Richard Henderson
> <address@hidden> wrote:
>>
>> On 11/27/18 1:08 PM, Alistair Francis wrote:
>>> +static inline void tcg_out_goto_long(TCGContext *s, tcg_insn_unit *target)
>>> +{
>>> +    ptrdiff_t offset = tcg_pcrel_diff(s, target);
>>> +
>>> +    if (offset == sextract64(offset, 0, 26)) {
>>> +        tcg_out_opc_jump(s, OPC_JAL, TCG_REG_ZERO, offset);
>>> +    } else {
>>> +        tcg_out_movi(s, TCG_TYPE_I64, TCG_REG_TMP0, (intptr_t)target);
>>> +        tcg_out_opc_jump(s, OPC_JAL, TCG_REG_TMP0, 0);
>>> +    }
>>> +}
>>> +
>>> +static void tcg_out_call_int(TCGContext *s, tcg_insn_unit *arg, bool tail)
>>> +{
>>> +    TCGReg link = tail ? TCG_REG_ZERO : TCG_REG_RA;
>>> +    ptrdiff_t offset = tcg_pcrel_diff(s, arg);
>>> +    if (offset == sextract64(offset, 1, 20) << 1) {
>>
>> s/20/26/
>>
>> Seems like there ought to be more shared code between tcg_out_call_int and
>> tcg_out_goto_long, really.
> 
> I think tcg_out_goto_long can just be removed and replaced with
> tcg_out_call() right?

Yes, tcg_out_goto_long(s, dest) = tcg_out_call_int(s, dest, true).


r~



reply via email to

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