On Wed, Jan 13, 2021, at 4:06 PM, Philippe Mathieu-Daudé wrote:
> On 1/13/21 3:15 AM, Jiaxun Yang wrote:
> > 在 2021/1/13 上午5:54, Philippe Mathieu-Daudé 写道:
> >> Loongson is next step in the "MIPS decodetree conversion" epic.
> >> Start with the simplest extension.
> >>
> >> The diffstat addition comes from the TCG functions expanded.
> >> The code is easier to review now.
> >> IMO this is also a good template to show how easy a decodetree
> >> conversion can be (and how nice the .decode file is to review) :P
> >>
> >> Please review,
> >>
> >> Phil.
> >>
> >> Based-on: <20210112184156.2014305-1-f4...@amsat.org>
> >>            "decodetree: Allow 'dot' in opcode names"
> >>
> >> Philippe Mathieu-Daudé (6):
> >>    target/mips: Re-introduce OPC_ADDUH_QB_DSP and OPC_MUL_PH_DSP
> >>    target/mips: Convert Loongson DDIV.G opcodes to decodetree
> >>    target/mips: Convert Loongson DIV.G opcodes to decodetree
> >>    target/mips: Convert Loongson [D]DIVU.G opcodes to decodetree
> >>    target/mips: Convert Loongson [D]MOD[U].G opcodes to decodetree
> >>    target/mips: Convert Loongson [D]MULT[U].G opcodes to decodetree
> >>
> >>   target/mips/translate.h       |   1 +
> >>   target/mips/godson2.decode    |  29 +++
> >>   target/mips/loong-ext.decode  |  30 +++
> > 
> > Hi Philippe,
> > 
> > Thanks for the template!
> > 
> > Just a small question, where should we perform ISA availability check?
> > Before calling generated decoder or after decoded?
> 
> The check is done before in decode_loongson:
> 
>  bool decode_loongson(DisasContext *ctx, uint32_t insn)
>  {
>      if ((ctx->insn_flags & INSN_LOONGSON2E)
>          // if ISA available ...
>              && decode_godson2(ctx, ctx->opcode)) {
>              // and opcode supported
>          // return success
>          return true;
>      }
>      // else keep going ...
> 
>      if ((ctx->insn_flags & ASE_LEXT)
>              && decode_loong_ext(ctx, ctx->opcode)) {
>          return true;
>      }
> 
>      // finally return false, if nothing else decoded
>      // gen_reserved_instruction will be called in the
>      // main decode loop.
>      return false;
>  }
> 
> > 
> > Loong-EXT is a super set of Loongson2F's Godson2 and MMI instructions,
> > how could we tell it?
> 
> MMI instructions are currently handled by the ASE_LMMI flag,
> a different decoder (which will also be handled by this function,
> similarly to ASE_LEXT).

SWC2/LWC2/SDC2/LDC2 family of LEXT instructions do exist on LEXT but not 
Loongson-2F.

Thanks.

> 
> Regards,
> 
> Phil.
>

-- 
- Jiaxun

Reply via email to