[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 13/20] target/arm: Convert LDR/STR with 12-bit immediate to d
From: |
Peter Maydell |
Subject: |
Re: [PATCH 13/20] target/arm: Convert LDR/STR with 12-bit immediate to decodetree |
Date: |
Sat, 3 Jun 2023 17:18:43 +0100 |
On Fri, 2 Jun 2023 at 21:51, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> Hi Peter,
>
> On 2/6/23 17:52, Peter Maydell wrote:
> > Convert the LDR and STR instructions which use a 12-bit immediate
> > offset to decodetree. We can reuse the existing LDR and STR
> > trans functions for these.
> >
> > Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> > ---
> > target/arm/tcg/a64.decode | 25 ++++++++
> > target/arm/tcg/translate-a64.c | 103 +++++----------------------------
> > 2 files changed, 41 insertions(+), 87 deletions(-)
> >
> > diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode
> > index 4dfb7bbdc2e..c3a6d0b740a 100644
> > --- a/target/arm/tcg/a64.decode
> > +++ b/target/arm/tcg/a64.decode
>
>
> > +# Load/store with an unsigned 12 bit immediate, which is scaled by the
> > +# element size. The function gets the sz:imm and returns the scaled
> > immediate.
> > +%uimm_scaled 10:12 sz:3 !function=uimm_scaled
> > +
> > +@ldst_uimm .. ... . .. .. ............ rn:5 rt:5 &ldst_imm unpriv=0
> > p=0 w=0 imm=%uimm_scaled
> > +
> > +STR_i sz:2 111 0 01 00 ............ ..... ..... @ldst_uimm
> > sign=0 ext=0
> > +LDR_i 00 111 0 01 01 ............ ..... ..... @ldst_uimm sign=0
> > ext=1 sz=0
> > +LDR_i 01 111 0 01 01 ............ ..... ..... @ldst_uimm sign=0
> > ext=1 sz=1
> > +LDR_i 10 111 0 01 01 ............ ..... ..... @ldst_uimm sign=0
> > ext=1 sz=2
> > +LDR_i 11 111 0 01 01 ............ ..... ..... @ldst_uimm sign=0
> > ext=0 sz=3
> > +LDR_i 00 111 0 01 10 ............ ..... ..... @ldst_uimm sign=1
> > ext=0 sz=0
> > +LDR_i 01 111 0 01 10 ............ ..... ..... @ldst_uimm sign=1
> > ext=0 sz=1
> > +LDR_i 10 111 0 01 10 ............ ..... ..... @ldst_uimm sign=1
> > ext=0 sz=2
> > +LDR_i 00 111 0 01 11 ............ ..... ..... @ldst_uimm sign=1
> > ext=1 sz=0
> > +LDR_i 01 111 0 01 11 ............ ..... ..... @ldst_uimm sign=1
> > ext=1 sz=1
>
> Why not use "sz:2 111 0 01 sign:1 ext:1", returning false for the
> cases not covered?
That would also catch the PRFM case (which is size=0b11 sign=1 ext=0
in your pattern); and it gives the wrong ext value for 11 111 0 01 01.
You could do more of the decode in the trans_ functions and less
here; but my impression is that we tend to prefer decoding in the
.decode file where we can.
thanks
-- PMM
- [PATCH 09/20] target/arm: Convert LDXP, STXP, CASP, CAS to decodetree, (continued)
- [PATCH 09/20] target/arm: Convert LDXP, STXP, CASP, CAS to decodetree, Peter Maydell, 2023/06/02
- [PATCH 10/20] target/arm: Convert load reg (literal) group to decodetree, Peter Maydell, 2023/06/02
- [PATCH 12/20] target/arm: Convert ld/st reg+imm9 insns to decodetree, Peter Maydell, 2023/06/02
- [PATCH 11/20] target/arm: Convert load/store-pair to decodetree, Peter Maydell, 2023/06/02
- [PATCH 13/20] target/arm: Convert LDR/STR with 12-bit immediate to decodetree, Peter Maydell, 2023/06/02
- [PATCH 14/20] target/arm: Convert LDR/STR reg+reg to decodetree, Peter Maydell, 2023/06/02
- [PATCH 15/20] target/arm: Convert atomic memory ops to decodetree, Peter Maydell, 2023/06/02
- [PATCH 16/20] target/arm: Convert load (pointer auth) insns to decodetree, Peter Maydell, 2023/06/02
- [PATCH 19/20] target/arm: Convert load/store single structure to decodetree, Peter Maydell, 2023/06/02