target/arm: Convert exception, system, loads and stores to decodetree
cover target/arm: Convert exception, system, loads and stores to decodetree
This patchseries does more of the conversion of the A64 decoder to decodetree. It covers the exception-generation, system, load and store instructions.
After this the remaining legacy decoder pieces are:
* data-processing (register)
* data-processing (SIMD)
* data-processing (floating-point)
I plan to take a break from conversion after this series to work on FEAT_MOPS, but want to come back to the dp-register parts for this release cycle. The FP/SIMD stuff is a bigger job and I'm inclined to leave it for the moment.
I include the LDSMIN/LDSMAX bugfix as patch 1 to avoid a conflict later. Speaking of conflicts, this is going to conflict with RTH's LSE2 series, which I expect to get in to the tree first, but I'm hoping the rebase of this series won't be too painful.
thanks
-- PMM
Peter Maydell (20):
target/arm: Fix return value from LDSMIN/LDSMAX 8/16 bit atomics target/arm: Convert hint instruction space to decodetree target/arm: Convert barrier insns to decodetree target/arm: Convert CFINV, XAFLAG and AXFLAG to decodetree target/arm: Convert MSR (immediate) to decodetree target/arm: Convert MSR (reg), MRS, SYS, SYSL to decodetree target/arm: Convert exception generation instructions to decodetree target/arm: Convert load/store exclusive and ordered to decodetree target/arm: Convert LDXP, STXP, CASP, CAS to decodetree target/arm: Convert load reg (literal) group to decodetree target/arm: Convert load/store-pair to decodetree target/arm: Convert ld/st reg+imm9 insns to decodetree target/arm: Convert LDR/STR with 12-bit immediate to decodetree target/arm: Convert LDR/STR reg+reg to decodetree target/arm: Convert atomic memory ops to decodetree target/arm: Convert load (pointer auth) insns to decodetree target/arm: Convert LDAPR/STLR (imm) to decodetree target/arm: Convert load/store (multiple structures) to decodetree target/arm: Convert load/store single structure to decodetree target/arm: Convert load/store tags insns to decodetree
target/arm/tcg/a64.decode | 406 ++++ target/arm/tcg/translate-a64.c | 3183 ++++++++++++++------------------ 2 files changed, 1801 insertions(+), 1788 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/20 target/arm: Fix return value from LDSMIN/LDSMAX 8/16 bit atomics
The atomic memory operations are supposed to return the old memory data value in the destination register. This value is not sign-extended, even if the operation is the signed minimum or maximum. (In the pseudocode for the instructions the returned data value is passed to ZeroExtend() to create the value in the register.)
We got this wrong because we were doing a 32-to-64 zero extend on the result for 8 and 16 bit data values, rather than the correct amount of zero extension.
Fix the bug by using ext8u and ext16u for the MO_8 and MO_16 data sizes rather than ext32u.
--- target/arm/tcg/translate-a64.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
target/arm/tcg/translate-a64.c +16 -2
@@ -3401,8 +3401,22 @@ static void disas_ldst_atomic(DisasContext *s, uint32_t insn,*/ fn (tcg_rt, clean_addr, tcg_rs,get_mem_index (s), mop); -if ((mop &MO_SIGN ) && size !=MO_64 ) { -tcg_gen_ext32u_i64 (tcg_rt, tcg_rt); +if (mop &MO_SIGN ) { +switch (size) { +case MO_8 : +tcg_gen_ext8u_i64 (tcg_rt, tcg_rt); +break ; +case MO_16 : +tcg_gen_ext16u_i64 (tcg_rt, tcg_rt); +break ; +case MO_32 : +tcg_gen_ext32u_i64 (tcg_rt, tcg_rt); +break ; +case MO_64 : +break ; +default : +g_assert_not_reached (); + } } }
Signature · 1 line
2.34.1
Re: [PATCH 01/20] target/arm: Fix return value from LDSMIN/LDSMAX 8/16 bit atomics
Quoted 10 lines · Peter Maydell
The atomic memory operations are supposed to return the old memory data value in the destination register. This value is not sign-extended, even if the operation is the signed minimum or maximum. (In the pseudocode for the instructions the returned data value is passed to
ZeroExtend()to create the value in the register.)We got this wrong because we were doing a 32-to-64 zero extend on the result for 8 and 16 bit data values, rather than the correct amount of zero extension.
Quoted 8 lines
Fix the bug by using ext8u and ext16u for the
MO_8andMO_16data sizes rather than ext32u.Signed-off-by Peter Maydell<[email protected]>--- target/arm/tcg/translate-a64.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
r~
PATCH 2/20 target/arm: Convert hint instruction space to decodetree
In reply to Peter MaydellConvert the various instructions in the hint instruction space to decodetree.
--- target/arm/tcg/a64.decode | 31 ++++ target/arm/tcg/translate-a64.c | 277 ++++++++++++++++++--------------- 2 files changed, 185 insertions(+), 123 deletions(-)
target/arm/tcg/a64.decode +31 -0
@@ -150,3 +150,34 @@ ERETA 1101011 0100 11111 00001 m:1 11111 11111 &reta # ERETAA, ERETAB # the processor is in halting debug state (which we don't implement). # The pattern is listed here as documentation. # DRPS 1101011 0101 11111 000000 11111 00000 + +# Hint instruction group +{ + [ + YIELD 1101 0101 0000 0011 0010 0000 001 11111 + WFE 1101 0101 0000 0011 0010 0000 010 11111 + WFI 1101 0101 0000 0011 0010 0000 011 11111 + # We implement WFE to never block, so our SEV/SEVL are NOPs + # SEV 1101 0101 0000 0011 0010 0000 100 11111 + # SEVL 1101 0101 0000 0011 0010 0000 101 11111 + # Our DGL is a NOP because we don't merge memory accesses anyway. + # DGL 1101 0101 0000 0011 0010 0000 110 11111 + XPACLRI 1101 0101 0000 0011 0010 0000 111 11111 + PACIA1716 1101 0101 0000 0011 0010 0001 000 11111 + PACIB1716 1101 0101 0000 0011 0010 0001 010 11111 + AUTIA1716 1101 0101 0000 0011 0010 0001 100 11111 + AUTIB1716 1101 0101 0000 0011 0010 0001 110 11111 + ESB 1101 0101 0000 0011 0010 0010 000 11111 + PACIAZ 1101 0101 0000 0011 0010 0011 000 11111 + PACIASP 1101 0101 0000 0011 0010 0011 001 11111 + PACIBZ 1101 0101 0000 0011 0010 0011 010 11111 + PACIBSP 1101 0101 0000 0011 0010 0011 011 11111 + AUTIAZ 1101 0101 0000 0011 0010 0011 100 11111 + AUTIASP 1101 0101 0000 0011 0010 0011 101 11111 + AUTIBZ 1101 0101 0000 0011 0010 0011 110 11111 + AUTIBSP 1101 0101 0000 0011 0010 0011 111 11111 + ] + # The canonical NOP has CRm == op2 == 0, but all of the space + # that isn't specifically allocated to an instruction must NOP + NOP 1101 0101 0000 0011 0010 ---- --- 11111 +}
target/arm/tcg/translate-a64.c +154 -123
296 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH 02/20] target/arm: Convert hint instruction space to decodetree
Quoted 8 lines · Peter Maydell
Convert the various instructions in the hint instruction space to decodetree.
Signed-off-by Peter Maydell<[email protected]>--- target/arm/tcg/a64.decode | 31 ++++ target/arm/tcg/translate-a64.c | 277 ++++++++++++++++++--------------- 2 files changed, 185 insertions(+), 123 deletions(-)
r~
PATCH 3/20 target/arm: Convert barrier insns to decodetree
In reply to Peter MaydellConvert the insns in the "Barriers" instruction class to
decodetree: CLREX, DSB, DMB, ISB and SB.
--- target/arm/tcg/a64.decode | 7 +++ target/arm/tcg/translate-a64.c | 92 ++++++++++++++-------------------- 2 files changed, 46 insertions(+), 53 deletions(-)
target/arm/tcg/a64.decode +7 -0
@@ -181,3 +181,10 @@ ERETA 1101011 0100 11111 00001 m:1 11111 11111 &reta # ERETAA, ERETAB # that isn't specifically allocated to an instruction must NOP NOP 1101 0101 0000 0011 0010 ---- --- 11111 } + +# Barriers + +CLREX 1101 0101 0000 0011 0011 imm:4 010 11111 +DSB_DMB 1101 0101 0000 0011 0011 domain:2 types:2 10- 11111 +ISB 1101 0101 0000 0011 0011 imm:4 110 11111 +SB 1101 0101 0000 0011 0011 0000 111 11111
target/arm/tcg/translate-a64.c +39 -53
115 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH 03/20] target/arm: Convert barrier insns to decodetree
Quoted 3 lines · Peter Maydell
target/arm/tcg/a64.decode +3
-0+# Barriers + +CLREX 1101 0101 0000 0011 0011 imm:4 010 11111
...
Quoted 1 line
+ISB 1101 0101 0000 0011 0011 imm:4 110 11111
The two imm:4 fields are ignored; use ---- instead?
Otherwise,
r~
PATCH 4/20 target/arm: Convert CFINV, XAFLAG and AXFLAG to decodetree
In reply to Peter MaydellConvert the CFINV, XAFLAG and AXFLAG insns to decodetree. The old decoder handles these in handle_msr_i(), but the architecture defines them as separate instructions from MSR (immediate).
--- target/arm/tcg/a64.decode | 6 ++++ target/arm/tcg/translate-a64.c | 56 ++++++++++++++++++---------------- 2 files changed, 35 insertions(+), 27 deletions(-)
target/arm/tcg/a64.decode +6 -0
@@ -188,3 +188,9 @@ CLREX 1101 0101 0000 0011 0011 imm:4 010 11111 DSB_DMB 1101 0101 0000 0011 0011 domain:2 types:2 10- 11111 ISB 1101 0101 0000 0011 0011 imm:4 110 11111 SB 1101 0101 0000 0011 0011 0000 111 11111 + +# PSTATE + +CFINV 1101 0101 0000 0 000 0100 0000 000 11111 +XAFLAG 1101 0101 0000 0 000 0100 0000 001 11111 +AXFLAG 1101 0101 0000 0 000 0100 0000 010 11111
target/arm/tcg/translate-a64.c +29 -27
84 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH 04/20] target/arm: Convert CFINV, XAFLAG and AXFLAG to decodetree
Quoted 34 lines · Peter Maydell
Convert the CFINV, XAFLAG and AXFLAG insns to decodetree. The old decoder handles these in
handle_msr_i(), but the architecture defines them as separate instructions from MSR (immediate).Signed-off-by Peter Maydell <[email protected]>--- target/arm/tcg/a64.decode | 6 ++++ target/arm/tcg/translate-a64.c | 56 ++++++++++++++++++---------------- 2 files changed, 35 insertions(+), 27 deletions(-)target/arm/tcg/a64.decode +6
-0@@ -188,3 +188,9 @@ CLREX 1101 0101 0000 0011 0011 imm:4 010 11111 DSB_DMB 1101 0101 0000 0011 0011 domain:2 types:2 10- 11111 ISB 1101 0101 0000 0011 0011 imm:4 110 11111 SB 1101 0101 0000 0011 0011 0000 111 11111 + +# PSTATE + +CFINV 1101 0101 0000 0 000 0100 0000 000 11111 +XAFLAG 1101 0101 0000 0 000 0100 0000 001 11111 +AXFLAG 1101 0101 0000 0 000 0100 0000 010 11111target/arm/tcg/translate-a64.c +0
-1@@ -1809,9 +1809,25 @@ static bool trans_SB(DisasContext *s, arg_SB *a)return true; } -static void gen_xaflag (void )
target/arm/tcg/translate-a64.c static bool trans_SB(DisasContext *s, arg_SB *a) · line 1820
Quoted 10 lines
target/arm/tcg/translate-a64.c +8
-1+static bool trans_CFINV (DisasContext *s,arg_CFINV *a) { -TCGv_i32 z =tcg_temp_new_i32 (); +if (!dc_isar_feature (aa64_condm_4, s)) { +return false; + } +tcg_gen_xori_i32 (cpu_CF, cpu_CF,1 ); + s->base.is_jmp =DISAS_NEXT ; +return true; +}
The settings of is_jmp do not need to be copied across. That's another benefit of extracting from MSR_i.
Otherwise,
r~
PATCH 5/20 target/arm: Convert MSR (immediate) to decodetree
In reply to Peter MaydellConvert the MSR (immediate) insn to decodetree. Our implementation has basically no commonality between the different destinations, so we decode the destination register in a64.decode.
--- target/arm/tcg/a64.decode | 13 ++ target/arm/tcg/translate-a64.c | 251 ++++++++++++++++----------------- 2 files changed, 136 insertions(+), 128 deletions(-)
target/arm/tcg/a64.decode +13 -0
@@ -194,3 +194,16 @@ SB 1101 0101 0000 0011 0011 0000 111 11111 CFINV 1101 0101 0000 0 000 0100 0000 000 11111 XAFLAG 1101 0101 0000 0 000 0100 0000 001 11111 AXFLAG 1101 0101 0000 0 000 0100 0000 010 11111 + +# These are architecturally all "MSR (immediate)"; we decode the destination +# register too because there is no commonality in our implementation. +@msr_i .... .... .... . ... .... imm:4 ... ..... +MSR_i_UAO 1101 0101 0000 0 000 0100 .... 011 11111 @msr_i +MSR_i_PAN 1101 0101 0000 0 000 0100 .... 100 11111 @msr_i +MSR_i_SPSEL 1101 0101 0000 0 000 0100 .... 101 11111 @msr_i +MSR_i_SBSS 1101 0101 0000 0 011 0100 .... 001 11111 @msr_i +MSR_i_DIT 1101 0101 0000 0 011 0100 .... 010 11111 @msr_i +MSR_i_TCO 1101 0101 0000 0 011 0100 .... 100 11111 @msr_i +MSR_i_DAIFSET 1101 0101 0000 0 011 0100 .... 110 11111 @msr_i +MSR_i_DAIFCLEAR 1101 0101 0000 0 011 0100 .... 111 11111 @msr_i +MSR_i_SVCR 1101 0101 0000 0 011 0100 0 mask:2 imm:1 011 11111
target/arm/tcg/translate-a64.c +123 -128
265 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH 05/20] target/arm: Convert MSR (immediate) to decodetree
Quoted 9 lines · Peter Maydell
Convert the MSR (immediate) insn to decodetree. Our implementation has basically no commonality between the different destinations, so we decode the destination register in a64.decode.
Signed-off-by Peter Maydell<[email protected]>--- target/arm/tcg/a64.decode | 13 ++ target/arm/tcg/translate-a64.c | 251 ++++++++++++++++----------------- 2 files changed, 136 insertions(+), 128 deletions(-)
r~
PATCH 6/20 target/arm: Convert MSR (reg), MRS, SYS, SYSL to decodetree
In reply to Peter MaydellConvert MSR (reg), MRS, SYS, SYSL to decodetree. For QEMU these are all essentially the same instruction (system register access).
--- target/arm/tcg/a64.decode | 8 ++++++++ target/arm/tcg/translate-a64.c | 32 +++++--------------------------- 2 files changed, 13 insertions(+), 27 deletions(-)
target/arm/tcg/a64.decode +8 -0
@@ -207,3 +207,11 @@ MSR_i_TCO 1101 0101 0000 0 011 0100 .... 100 11111 @msr_i MSR_i_DAIFSET 1101 0101 0000 0 011 0100 .... 110 11111 @msr_i MSR_i_DAIFCLEAR 1101 0101 0000 0 011 0100 .... 111 11111 @msr_i MSR_i_SVCR 1101 0101 0000 0 011 0100 0 mask:2 imm:1 011 11111 + +# MRS, MSR (register), SYS, SYSL. These are all essentially the +# same instruction as far as QEMU is concerned. +# NB: op0 is bits [20:19], but op0=0b00 is other insns, so we have +# to hand-decode it. +SYS 1101 0101 00 l:1 01 op1:3 crn:4 crm:4 op2:3 rt:5 op0=1 +SYS 1101 0101 00 l:1 10 op1:3 crn:4 crm:4 op2:3 rt:5 op0=2 +SYS 1101 0101 00 l:1 11 op1:3 crn:4 crm:4 op2:3 rt:5 op0=3
target/arm/tcg/translate-a64.c +5 -27
@@ -2070,7 +2070,7 @@ static void gen_sysreg_undef(DisasContext *s, bool isread,* These are all essentially the same insn in 'read' and 'write' * versions, with varying op0 fields. */ -static void handle_sys (DisasContext *s,uint32_t insn,bool isread, +static void handle_sys (DisasContext *s,bool isread,unsigned int op0,unsigned int op1,unsigned int op2,unsigned int crn,unsigned int crm,unsigned int rt) {
@@ -2254,28 +2254,10 @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread, } } -/* System -* 31 22 21 20 19 18 16 15 12 11 8 7 5 4 0 -* +---------------------+---+-----+-----+-------+-------+-----+------+ -* | 1 1 0 1 0 1 0 1 0 0 | L | op0 | op1 | CRn | CRm | op2 | Rt | -* +---------------------+---+-----+-----+-------+-------+-----+------+ -*/ -static void disas_system (DisasContext *s,uint32_t insn) +static bool trans_SYS (DisasContext *s,arg_SYS *a) { -unsigned int l, op0, op1, crn, crm, op2, rt; - l =extract32 (insn,21 ,1 ); - op0 =extract32 (insn,19 ,2 ); - op1 =extract32 (insn,16 ,3 ); - crn =extract32 (insn,12 ,4 ); - crm =extract32 (insn,8 ,4 ); - op2 =extract32 (insn,5 ,3 ); - rt =extract32 (insn,0 ,5 ); - -if (op0 ==0 ) { -unallocated_encoding (s); -return ; - } -handle_sys (s, insn, l, op0, op1, op2, crn, crm, rt); +handle_sys (s, a->l, a->op0, a->op1, a->op2, a->crn, a->crm, a->rt); +return true; }/* Exception generation
@@ -2382,11 +2364,7 @@ static void disas_b_exc_sys(DisasContext *s, uint32_t insn)switch (extract32 (insn,25 ,7 )) {case 0x6a :/* Exception generation / System */ if (insn & (1 <<24 )) { -if (extract32 (insn,22 ,2 ) ==0 ) { -disas_system (s, insn); - }else { -unallocated_encoding (s); - } +unallocated_encoding (s); }else {disas_exc (s, insn); }
Signature · 1 line
2.34.1
Re: [PATCH 06/20] target/arm: Convert MSR (reg), MRS, SYS, SYSL to decodetree
Quoted 8 lines · Peter Maydell
Convert MSR (reg), MRS, SYS, SYSL to decodetree. For QEMU these are all essentially the same instruction (system register access).
Signed-off-by Peter Maydell<[email protected]>--- target/arm/tcg/a64.decode | 8 ++++++++ target/arm/tcg/translate-a64.c | 32 +++++--------------------------- 2 files changed, 13 insertions(+), 27 deletions(-)
r~
PATCH 7/20 target/arm: Convert exception generation instructions to decodetree
In reply to Peter MaydellConvert the exception generation instructions SVC, HVC, SMC, BRK and HLT to decodetree.
The old decoder decoded the halting-debug insnns DCPS1, DCPS2 and DCPS3 just in order to then make them UNDEF; as with DRPS, we don't bother to decode them, but document the patterns in a64.decode.
--- target/arm/tcg/a64.decode | 15 +++ target/arm/tcg/translate-a64.c | 173 ++++++++++++--------------------- 2 files changed, 79 insertions(+), 109 deletions(-)
target/arm/tcg/a64.decode +15 -0
@@ -215,3 +215,18 @@ MSR_i_SVCR 1101 0101 0000 0 011 0100 0 mask:2 imm:1 011 11111 SYS 1101 0101 00 l:1 01 op1:3 crn:4 crm:4 op2:3 rt:5 op0=1 SYS 1101 0101 00 l:1 10 op1:3 crn:4 crm:4 op2:3 rt:5 op0=2 SYS 1101 0101 00 l:1 11 op1:3 crn:4 crm:4 op2:3 rt:5 op0=3 + +# Exception generation + +@i16 .... .... ... imm:16 ... .. &i +SVC 1101 0100 000 ................ 000 01 @i16 +HVC 1101 0100 000 ................ 000 10 @i16 +SMC 1101 0100 000 ................ 000 11 @i16 +BRK 1101 0100 001 ................ 000 00 @i16 +HLT 1101 0100 010 ................ 000 00 @i16 +# These insns always UNDEF unless in halting debug state, which +# we don't implement. So we don't need to decode them. The patterns +# are listed here as documentation. +# DCPS1 1101 0100 101 ................ 000 01 @i16 +# DCPS2 1101 0100 101 ................ 000 10 @i16 +# DCPS3 1101 0100 101 ................ 000 11 @i16
target/arm/tcg/translate-a64.c +64 -109
192 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH 07/20] target/arm: Convert exception generation instructions to decodetree
Quoted 7 lines · Peter Maydell
Convert the exception generation instructions SVC, HVC, SMC, BRK and HLT to decodetree.
The old decoder decoded the halting-debug insnns DCPS1, DCPS2 and DCPS3 just in order to then make them UNDEF; as with DRPS, we don't bother to decode them, but document the patterns in a64.decode.
Quoted 5 lines
Signed-off-by Peter Maydell<[email protected]>--- target/arm/tcg/a64.decode | 15 +++ target/arm/tcg/translate-a64.c | 173 ++++++++++++--------------------- 2 files changed, 79 insertions(+), 109 deletions(-)
r~
PATCH 8/20 target/arm: Convert load/store exclusive and ordered to decodetree
In reply to Peter MaydellConvert the instructions in the load/store exclusive (STXR, STLXR, LDXR, LDAXR) and load/store ordered (STLR, STLLR, LDAR, LDLAR) to decodetree.
Note that for STLR, STLLR, LDAR, LDLAR this fixes an under-decoding in the legacy decoder where we were not checking that the RES1 bits in the Rs and Rt2 fields were set.
The new function ldst_iss_sf() is equivalent to the existing disas_ldst_compute_iss_sf(), but it takes the pre-decoded 'ext' field rather than taking an undecoded two-bit opc field and extracting 'ext' from it. Once all the loads and stores have been converted to decodetree disas_ldst_compute_iss_sf() will be unused and can be deleted.
--- target/arm/tcg/a64.decode | 11 +++ target/arm/tcg/translate-a64.c | 164 ++++++++++++++++++++------------- 2 files changed, 110 insertions(+), 65 deletions(-)
target/arm/tcg/a64.decode +11 -0
@@ -230,3 +230,14 @@ HLT 1101 0100 010 ................ 000 00 @i16 # DCPS1 1101 0100 101 ................ 000 01 @i16 # DCPS2 1101 0100 101 ................ 000 10 @i16 # DCPS3 1101 0100 101 ................ 000 11 @i16 + +# Loads and stores + +&stxr rn rt rt2 rs sz lasr +&stlr rn rt sz lasr +@stxr sz:2 ...... ... rs:5 lasr:1 rt2:5 rn:5 rt:5 &stxr +@stlr sz:2 ...... ... ..... lasr:1 ..... rn:5 rt:5 &stlr +STXR .. 001000 000 ..... . ..... ..... ..... @stxr # inc STLXR +LDXR .. 001000 010 ..... . ..... ..... ..... @stxr # inc LDAXR +STLR .. 001000 100 11111 . 11111 ..... ..... @stlr # inc STLLR +LDAR .. 001000 110 11111 . 11111 ..... ..... @stlr # inc LDLAR
target/arm/tcg/translate-a64.c +99 -65
182 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH 08/20] target/arm: Convert load/store exclusive and ordered to decodetree
Quoted 15 lines · Peter Maydell
Convert the instructions in the load/store exclusive (STXR, STLXR, LDXR, LDAXR) and load/store ordered (STLR, STLLR, LDAR, LDLAR) to decodetree.
Note that for STLR, STLLR, LDAR, LDLAR this fixes an under-decoding in the legacy decoder where we were not checking that the RES1 bits in the Rs and Rt2 fields were set.
The new function
ldst_iss_sf()is equivalent to the existingdisas_ldst_compute_iss_sf(), but it takes the pre-decoded 'ext' field rather than taking an undecoded two-bit opc field and extracting 'ext' from it. Once all the loads and stores have been converted to decodetreedisas_ldst_compute_iss_sf()will be unused and can be deleted.
Quoted 5 lines
Signed-off-by Peter Maydell<[email protected]>--- target/arm/tcg/a64.decode | 11 +++ target/arm/tcg/translate-a64.c | 164 ++++++++++++++++++++------------- 2 files changed, 110 insertions(+), 65 deletions(-)
r~
PATCH 9/20 target/arm: Convert LDXP, STXP, CASP, CAS to decodetree
In reply to Peter MaydellConvert the load/store exclusive pair (LDXP, STXP, LDAXP, STLXP), compare-and-swap pair (CASP, CASPA, CASPAL, CASPL), and compare-and swap (CAS, CASA, CASAL, CASL) instructions to decodetree.
--- target/arm/tcg/a64.decode | 10 +++ target/arm/tcg/translate-a64.c | 132 ++++++++++++--------------------- 2 files changed, 59 insertions(+), 83 deletions(-)
target/arm/tcg/a64.decode +10 -0
@@ -237,7 +237,17 @@ HLT 1101 0100 010 ................ 000 00 @i16 &stlr rn rt sz lasr @stxr sz:2 ...... ... rs:5 lasr:1 rt2:5 rn:5 rt:5 &stxr @stlr sz:2 ...... ... ..... lasr:1 ..... rn:5 rt:5 &stlr +%imm1_30_p2 30:1 !function=plus_2 +@stxp .. ...... ... rs:5 lasr:1 rt2:5 rn:5 rt:5 &stxr sz=%imm1_30_p2 STXR .. 001000 000 ..... . ..... ..... ..... @stxr # inc STLXR LDXR .. 001000 010 ..... . ..... ..... ..... @stxr # inc LDAXR STLR .. 001000 100 11111 . 11111 ..... ..... @stlr # inc STLLR LDAR .. 001000 110 11111 . 11111 ..... ..... @stlr # inc LDLAR + +STXP 1 . 001000 001 ..... . ..... ..... ..... @stxp # inc STLXP +LDXP 1 . 001000 011 ..... . ..... ..... ..... @stxp # inc LDAXP + +# CASP, CASPA, CASPAL, CASPL +CASP 0 . 001000 0 a:1 1 rs:5 lasr:1 11111 rn:5 rt:5 sz=%imm1_30_p2 +# CAS, CASA, CASAL, CASL +CAS sz:2 001000 1 a:1 1 rs:5 lasr:1 11111 rn:5 rt:5
target/arm/tcg/translate-a64.c +49 -83
148 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH 09/20] target/arm: Convert LDXP, STXP, CASP, CAS to decodetree
target/arm/tcg/a64.decode HLT 1101 0100 010 ................ 000 00 @i16 · line 253
Quoted 4 lines · Peter Maydell
target/arm/tcg/a64.decode +4
-0+# CASP, CASPA, CASPAL, CASPL +CASP 0 . 001000 0 a:1 1 rs:5 lasr:1 11111 rn:5 rt:5 sz=%imm1_30_p2 +# CAS, CASA, CASAL, CASL +CAS sz:2 001000 1 a:1 1 rs:5 lasr:1 11111 rn:5 rt:5
Drop decode of a + lasr? Or rename lasr to l? Anyhow,
r~
PATCH 10/20 target/arm: Convert load reg (literal) group to decodetree
In reply to Peter MaydellConvert the "Load register (literal)" instruction class to decodetree.
--- target/arm/tcg/a64.decode | 13 ++++++ target/arm/tcg/translate-a64.c | 73 ++++++++++------------------------ 2 files changed, 33 insertions(+), 53 deletions(-)
target/arm/tcg/a64.decode +13 -0
@@ -251,3 +251,16 @@ LDXP 1 . 001000 011 ..... . ..... ..... ..... @stxp # inc LDAXP CASP 0 . 001000 0 a:1 1 rs:5 lasr:1 11111 rn:5 rt:5 sz=%imm1_30_p2 # CAS, CASA, CASAL, CASL CAS sz:2 001000 1 a:1 1 rs:5 lasr:1 11111 rn:5 rt:5 + +&ldlit rt imm sz sign +@ldlit .. ... . .. ................... rt:5 &ldlit imm=%imm19 + +LD_lit 00 011 0 00 ................... ..... @ldlit sz=2 sign=0 +LD_lit 01 011 0 00 ................... ..... @ldlit sz=3 sign=0 +LD_lit 10 011 0 00 ................... ..... @ldlit sz=2 sign=1 +LD_lit_v 00 011 1 00 ................... ..... @ldlit sz=2 sign=0 +LD_lit_v 01 011 1 00 ................... ..... @ldlit sz=3 sign=0 +LD_lit_v 10 011 1 00 ................... ..... @ldlit sz=4 sign=0 + +# PRFM +NOP 11 011 0 00 ------------------- -----
target/arm/tcg/translate-a64.c +20 -53
89 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH 10/20] target/arm: Convert load reg (literal) group to decodetree
Quoted 8 lines · Peter Maydell
Convert the "Load register (literal)" instruction class to decodetree.
Signed-off-by Peter Maydell<[email protected]>--- target/arm/tcg/a64.decode | 13 ++++++ target/arm/tcg/translate-a64.c | 73 ++++++++++------------------------ 2 files changed, 33 insertions(+), 53 deletions(-)
r~
PATCH 11/20 target/arm: Convert load/store-pair to decodetree
In reply to Peter MaydellConvert the load/store register pair insns (LDP, STP, LDNP, STNP, LDPSW, STGP) to decodetree.
--- target/arm/tcg/a64.decode | 62 +++++++ target/arm/tcg/translate-a64.c | 299 ++++++++++++++------------------- 2 files changed, 192 insertions(+), 169 deletions(-)
target/arm/tcg/a64.decode +62 -0
@@ -264,3 +264,65 @@ LD_lit_v 10 011 1 00 ................... ..... @ldlit sz=4 sign=0 # PRFM NOP 11 011 0 00 ------------------- ----- + +%imms7 15:s7 +&ldstpair rt2 rt rn imm sz sign w p +@ldstpair .. ... . ... . ....... rt2:5 rn:5 rt:5 &ldstpair imm=%imms7 + +# STNP, LDNP: Signed offset, non-temporal hint. We don't emulate caches +# so we ignore hints about data access patterns, and handle these like +# plain signed offset. +STP 00 101 0 000 0 ....... ..... ..... ..... @ldstpair sz=2 sign=0 p=0 w=0 +LDP 00 101 0 000 1 ....... ..... ..... ..... @ldstpair sz=2 sign=0 p=0 w=0 +STP 10 101 0 000 0 ....... ..... ..... ..... @ldstpair sz=3 sign=0 p=0 w=0 +LDP 10 101 0 000 1 ....... ..... ..... ..... @ldstpair sz=3 sign=0 p=0 w=0 +STP_v 00 101 1 000 0 ....... ..... ..... ..... @ldstpair sz=2 sign=0 p=0 w=0 +LDP_v 00 101 1 000 1 ....... ..... ..... ..... @ldstpair sz=2 sign=0 p=0 w=0 +STP_v 01 101 1 000 0 ....... ..... ..... ..... @ldstpair sz=3 sign=0 p=0 w=0 +LDP_v 01 101 1 000 1 ....... ..... ..... ..... @ldstpair sz=3 sign=0 p=0 w=0 +STP_v 10 101 1 000 0 ....... ..... ..... ..... @ldstpair sz=4 sign=0 p=0 w=0 +LDP_v 10 101 1 000 1 ....... ..... ..... ..... @ldstpair sz=4 sign=0 p=0 w=0 + +# STP and LDP: post-indexed +STP 00 101 0 001 0 ....... ..... ..... ..... @ldstpair sz=2 sign=0 p=1 w=1 +LDP 00 101 0 001 1 ....... ..... ..... ..... @ldstpair sz=2 sign=0 p=1 w=1 +LDP 01 101 0 001 1 ....... ..... ..... ..... @ldstpair sz=2 sign=1 p=1 w=1 +STP 10 101 0 001 0 ....... ..... ..... ..... @ldstpair sz=3 sign=0 p=1 w=1 +LDP 10 101 0 001 1 ....... ..... ..... ..... @ldstpair sz=3 sign=0 p=1 w=1 +STP_v 00 101 1 001 0 ....... ..... ..... ..... @ldstpair sz=2 sign=0 p=1 w=1 +LDP_v 00 101 1 001 1 ....... ..... ..... ..... @ldstpair sz=2 sign=0 p=1 w=1 +STP_v 01 101 1 001 0 ....... ..... ..... ..... @ldstpair sz=3 sign=0 p=1 w=1 +LDP_v 01 101 1 001 1 ....... ..... ..... ..... @ldstpair sz=3 sign=0 p=1 w=1 +STP_v 10 101 1 001 0 ....... ..... ..... ..... @ldstpair sz=4 sign=0 p=1 w=1 +LDP_v 10 101 1 001 1 ....... ..... ..... ..... @ldstpair sz=4 sign=0 p=1 w=1 + +# STP and LDP: offset +STP 00 101 0 010 0 ....... ..... ..... ..... @ldstpair sz=2 sign=0 p=0 w=0 +LDP 00 101 0 010 1 ....... ..... ..... ..... @ldstpair sz=2 sign=0 p=0 w=0 +LDP 01 101 0 010 1 ....... ..... ..... ..... @ldstpair sz=2 sign=1 p=0 w=0 +STP 10 101 0 010 0 ....... ..... ..... ..... @ldstpair sz=3 sign=0 p=0 w=0 +LDP 10 101 0 010 1 ....... ..... ..... ..... @ldstpair sz=3 sign=0 p=0 w=0 +STP_v 00 101 1 010 0 ....... ..... ..... ..... @ldstpair sz=2 sign=0 p=0 w=0 +LDP_v 00 101 1 010 1 ....... ..... ..... ..... @ldstpair sz=2 sign=0 p=0 w=0 +STP_v 01 101 1 010 0 ....... ..... ..... ..... @ldstpair sz=3 sign=0 p=0 w=0 +LDP_v 01 101 1 010 1 ....... ..... ..... ..... @ldstpair sz=3 sign=0 p=0 w=0 +STP_v 10 101 1 010 0 ....... ..... ..... ..... @ldstpair sz=4 sign=0 p=0 w=0 +LDP_v 10 101 1 010 1 ....... ..... ..... ..... @ldstpair sz=4 sign=0 p=0 w=0 + +# STP and LDP: pre-indexed +STP 00 101 0 011 0 ....... ..... ..... ..... @ldstpair sz=2 sign=0 p=0 w=1 +LDP 00 101 0 011 1 ....... ..... ..... ..... @ldstpair sz=2 sign=0 p=0 w=1 +LDP 01 101 0 011 1 ....... ..... ..... ..... @ldstpair sz=2 sign=1 p=0 w=1 +STP 10 101 0 011 0 ....... ..... ..... ..... @ldstpair sz=3 sign=0 p=0 w=1 +LDP 10 101 0 011 1 ....... ..... ..... ..... @ldstpair sz=3 sign=0 p=0 w=1 +STP_v 00 101 1 011 0 ....... ..... ..... ..... @ldstpair sz=2 sign=0 p=0 w=1 +LDP_v 00 101 1 011 1 ....... ..... ..... ..... @ldstpair sz=2 sign=0 p=0 w=1 +STP_v 01 101 1 011 0 ....... ..... ..... ..... @ldstpair sz=3 sign=0 p=0 w=1 +LDP_v 01 101 1 011 1 ....... ..... ..... ..... @ldstpair sz=3 sign=0 p=0 w=1 +STP_v 10 101 1 011 0 ....... ..... ..... ..... @ldstpair sz=4 sign=0 p=0 w=1 +LDP_v 10 101 1 011 1 ....... ..... ..... ..... @ldstpair sz=4 sign=0 p=0 w=1 + +# STGP: store tag and pair +STGP 01 101 0 001 0 ....... ..... ..... ..... @ldstpair sz=3 sign=0 p=1 w=1 +STGP 01 101 0 010 0 ....... ..... ..... ..... @ldstpair sz=3 sign=0 p=0 w=0 +STGP 01 101 0 011 0 ....... ..... ..... ..... @ldstpair sz=3 sign=0 p=0 w=1
target/arm/tcg/translate-a64.c +130 -169
321 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH 11/20] target/arm: Convert load/store-pair to decodetree
Quoted 3 lines · Peter Maydell
+%imms7 15:s7 +&ldstpair rt2 rt rn imm sz sign w p +@ldstpair .. ... . ... . ....... rt2:5 rn:5 rt:5 &ldstpair imm=%imms7
FYI, you don't need to extract imms7 -- imm:s7 inline will do.
Anyway,
r~
PATCH 12/20 target/arm: Convert ld/st reg+imm9 insns to decodetree
In reply to Peter MaydellConvert the load and store instructions which use a 9-bit immediate offset to decodetree.
--- target/arm/tcg/a64.decode | 69 ++++++++++++ target/arm/tcg/translate-a64.c | 198 +++++++++++++-------------------- 2 files changed, 148 insertions(+), 119 deletions(-)
target/arm/tcg/a64.decode +69 -0
@@ -326,3 +326,72 @@ LDP_v 10 101 1 011 1 ....... ..... ..... ..... @ldstpair sz=4 sign=0 p STGP 01 101 0 001 0 ....... ..... ..... ..... @ldstpair sz=3 sign=0 p=1 w=1 STGP 01 101 0 010 0 ....... ..... ..... ..... @ldstpair sz=3 sign=0 p=0 w=0 STGP 01 101 0 011 0 ....... ..... ..... ..... @ldstpair sz=3 sign=0 p=0 w=1 + +# Load/store register (unscaled immediate) +&ldst_imm rt rn imm sz sign w p unpriv ext +@ldst_imm .. ... . .. .. . imm:s9 .. rn:5 rt:5 &ldst_imm unpriv=0 p=0 w=0 +@ldst_imm_pre .. ... . .. .. . imm:s9 .. rn:5 rt:5 &ldst_imm unpriv=0 p=0 w=1 +@ldst_imm_post .. ... . .. .. . imm:s9 .. rn:5 rt:5 &ldst_imm unpriv=0 p=1 w=1 +@ldst_imm_user .. ... . .. .. . imm:s9 .. rn:5 rt:5 &ldst_imm unpriv=1 p=0 w=0 + +STR_i sz:2 111 0 00 00 0 ......... 00 ..... ..... @ldst_imm sign=0 ext=0 +LDR_i 00 111 0 00 01 0 ......... 00 ..... ..... @ldst_imm sign=0 ext=1 sz=0 +LDR_i 01 111 0 00 01 0 ......... 00 ..... ..... @ldst_imm sign=0 ext=1 sz=1 +LDR_i 10 111 0 00 01 0 ......... 00 ..... ..... @ldst_imm sign=0 ext=1 sz=2 +LDR_i 11 111 0 00 01 0 ......... 00 ..... ..... @ldst_imm sign=0 ext=0 sz=3 +LDR_i 00 111 0 00 10 0 ......... 00 ..... ..... @ldst_imm sign=1 ext=0 sz=0 +LDR_i 01 111 0 00 10 0 ......... 00 ..... ..... @ldst_imm sign=1 ext=0 sz=1 +LDR_i 10 111 0 00 10 0 ......... 00 ..... ..... @ldst_imm sign=1 ext=0 sz=2 +LDR_i 00 111 0 00 11 0 ......... 00 ..... ..... @ldst_imm sign=1 ext=1 sz=0 +LDR_i 01 111 0 00 11 0 ......... 00 ..... ..... @ldst_imm sign=1 ext=1 sz=1 + +STR_i sz:2 111 0 00 00 0 ......... 01 ..... ..... @ldst_imm_post sign=0 ext=0 +LDR_i 00 111 0 00 01 0 ......... 01 ..... ..... @ldst_imm_post sign=0 ext=1 sz=0 +LDR_i 01 111 0 00 01 0 ......... 01 ..... ..... @ldst_imm_post sign=0 ext=1 sz=1 +LDR_i 10 111 0 00 01 0 ......... 01 ..... ..... @ldst_imm_post sign=0 ext=1 sz=2 +LDR_i 11 111 0 00 01 0 ......... 01 ..... ..... @ldst_imm_post sign=0 ext=0 sz=3 +LDR_i 00 111 0 00 10 0 ......... 01 ..... ..... @ldst_imm_post sign=1 ext=0 sz=0 +LDR_i 01 111 0 00 10 0 ......... 01 ..... ..... @ldst_imm_post sign=1 ext=0 sz=1 +LDR_i 10 111 0 00 10 0 ......... 01 ..... ..... @ldst_imm_post sign=1 ext=0 sz=2 +LDR_i 00 111 0 00 11 0 ......... 01 ..... ..... @ldst_imm_post sign=1 ext=1 sz=0 +LDR_i 01 111 0 00 11 0 ......... 01 ..... ..... @ldst_imm_post sign=1 ext=1 sz=1 + +STR_i sz:2 111 0 00 00 0 ......... 10 ..... ..... @ldst_imm_user sign=0 ext=0 +LDR_i 00 111 0 00 01 0 ......... 10 ..... ..... @ldst_imm_user sign=0 ext=1 sz=0 +LDR_i 01 111 0 00 01 0 ......... 10 ..... ..... @ldst_imm_user sign=0 ext=1 sz=1 +LDR_i 10 111 0 00 01 0 ......... 10 ..... ..... @ldst_imm_user sign=0 ext=1 sz=2 +LDR_i 11 111 0 00 01 0 ......... 10 ..... ..... @ldst_imm_user sign=0 ext=0 sz=3 +LDR_i 00 111 0 00 10 0 ......... 10 ..... ..... @ldst_imm_user sign=1 ext=0 sz=0 +LDR_i 01 111 0 00 10 0 ......... 10 ..... ..... @ldst_imm_user sign=1 ext=0 sz=1 +LDR_i 10 111 0 00 10 0 ......... 10 ..... ..... @ldst_imm_user sign=1 ext=0 sz=2 +LDR_i 00 111 0 00 11 0 ......... 10 ..... ..... @ldst_imm_user sign=1 ext=1 sz=0 +LDR_i 01 111 0 00 11 0 ......... 10 ..... ..... @ldst_imm_user sign=1 ext=1 sz=1 + +STR_i sz:2 111 0 00 00 0 ......... 11 ..... ..... @ldst_imm_pre sign=0 ext=0 +LDR_i 00 111 0 00 01 0 ......... 11 ..... ..... @ldst_imm_pre sign=0 ext=1 sz=0 +LDR_i 01 111 0 00 01 0 ......... 11 ..... ..... @ldst_imm_pre sign=0 ext=1 sz=1 +LDR_i 10 111 0 00 01 0 ......... 11 ..... ..... @ldst_imm_pre sign=0 ext=1 sz=2 +LDR_i 11 111 0 00 01 0 ......... 11 ..... ..... @ldst_imm_pre sign=0 ext=0 sz=3 +LDR_i 00 111 0 00 10 0 ......... 11 ..... ..... @ldst_imm_pre sign=1 ext=0 sz=0 +LDR_i 01 111 0 00 10 0 ......... 11 ..... ..... @ldst_imm_pre sign=1 ext=0 sz=1 +LDR_i 10 111 0 00 10 0 ......... 11 ..... ..... @ldst_imm_pre sign=1 ext=0 sz=2 +LDR_i 00 111 0 00 11 0 ......... 11 ..... ..... @ldst_imm_pre sign=1 ext=1 sz=0 +LDR_i 01 111 0 00 11 0 ......... 11 ..... ..... @ldst_imm_pre sign=1 ext=1 sz=1 + +# PRFM : prefetch memory: a no-op for QEMU +NOP 11 111 0 00 10 0 --------- 00 ----- ----- + +STR_v_i sz:2 111 1 00 00 0 ......... 00 ..... ..... @ldst_imm sign=0 ext=0 +STR_v_i 00 111 1 00 10 0 ......... 00 ..... ..... @ldst_imm sign=0 ext=0 sz=4 +LDR_v_i sz:2 111 1 00 01 0 ......... 00 ..... ..... @ldst_imm sign=0 ext=0 +LDR_v_i 00 111 1 00 11 0 ......... 00 ..... ..... @ldst_imm sign=0 ext=0 sz=4 + +STR_v_i sz:2 111 1 00 00 0 ......... 01 ..... ..... @ldst_imm_post sign=0 ext=0 +STR_v_i 00 111 1 00 10 0 ......... 01 ..... ..... @ldst_imm_post sign=0 ext=0 sz=4 +LDR_v_i sz:2 111 1 00 01 0 ......... 01 ..... ..... @ldst_imm_post sign=0 ext=0 +LDR_v_i 00 111 1 00 11 0 ......... 01 ..... ..... @ldst_imm_post sign=0 ext=0 sz=4 + +STR_v_i sz:2 111 1 00 00 0 ......... 11 ..... ..... @ldst_imm_pre sign=0 ext=0 +STR_v_i 00 111 1 00 10 0 ......... 11 ..... ..... @ldst_imm_pre sign=0 ext=0 sz=4 +LDR_v_i sz:2 111 1 00 01 0 ......... 11 ..... ..... @ldst_imm_pre sign=0 ext=0 +LDR_v_i 00 111 1 00 11 0 ......... 11 ..... ..... @ldst_imm_pre sign=0 ext=0 sz=4
target/arm/tcg/translate-a64.c +79 -119
222 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH 12/20] target/arm: Convert ld/st reg+imm9 insns to decodetree
Quoted 8 lines · Peter Maydell
Convert the load and store instructions which use a 9-bit immediate offset to decodetree.
Signed-off-by Peter Maydell<[email protected]>--- target/arm/tcg/a64.decode | 69 ++++++++++++ target/arm/tcg/translate-a64.c | 198 +++++++++++++-------------------- 2 files changed, 148 insertions(+), 119 deletions(-)
r~
PATCH 13/20 target/arm: Convert LDR/STR with 12-bit immediate to decodetree
In reply to Peter MaydellConvert 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.
--- target/arm/tcg/a64.decode | 25 ++++++++ target/arm/tcg/translate-a64.c | 103 +++++---------------------------- 2 files changed, 41 insertions(+), 87 deletions(-)
target/arm/tcg/a64.decode +25 -0
@@ -395,3 +395,28 @@ STR_v_i sz:2 111 1 00 00 0 ......... 11 ..... ..... @ldst_imm_pre sign=0 STR_v_i 00 111 1 00 10 0 ......... 11 ..... ..... @ldst_imm_pre sign=0 ext=0 sz=4 LDR_v_i sz:2 111 1 00 01 0 ......... 11 ..... ..... @ldst_imm_pre sign=0 ext=0 LDR_v_i 00 111 1 00 11 0 ......... 11 ..... ..... @ldst_imm_pre sign=0 ext=0 sz=4 + +# 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 + +# PRFM +NOP 11 111 0 01 10 ------------ ----- ----- + +STR_v_i sz:2 111 1 01 00 ............ ..... ..... @ldst_uimm sign=0 ext=0 +STR_v_i 00 111 1 01 10 ............ ..... ..... @ldst_uimm sign=0 ext=0 sz=4 +LDR_v_i sz:2 111 1 01 01 ............ ..... ..... @ldst_uimm sign=0 ext=0 +LDR_v_i 00 111 1 01 11 ............ ..... ..... @ldst_uimm sign=0 ext=0 sz=4
target/arm/tcg/translate-a64.c +16 -87
121 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH 13/20] target/arm: Convert LDR/STR with 12-bit immediate to decodetree
Hi Peter,
Quoted 22 lines · Peter Maydell
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 <[email protected]>--- target/arm/tcg/a64.decode | 25 ++++++++ target/arm/tcg/translate-a64.c | 103 +++++---------------------------- 2 files changed, 41 insertions(+), 87 deletions(-)target/arm/tcg/a64.decode +6
-0+# 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 +
target/arm/tcg/a64.decode STR_v_i sz:2 111 1 00 00 0 ......... 11 ..... ..... @ldst_imm_pre sign=0 · line 414
Quoted 10 lines
target/arm/tcg/a64.decode +10
-0+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?
Re: [PATCH 13/20] target/arm: Convert LDR/STR with 12-bit immediate to decodetree
Quoted 31 lines · Philippe Mathieu-Daudé
Hi Peter,
Quoted 27 lines · Peter Maydell
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 <[email protected]>--- target/arm/tcg/a64.decode | 25 ++++++++ target/arm/tcg/translate-a64.c | 103 +++++---------------------------- 2 files changed, 41 insertions(+), 87 deletions(-)target/arm/tcg/a64.decode +11
-0+# 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
Quoted 8 lines
target/arm/tcg/a64.decode STR_v_i sz:2 111 1 00 00 0 ......... 11 ..... ..... @ldst_imm_pre sign=0 · line 414
Quoted 5 lines
target/arm/tcg/a64.decode +5
-0+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=1Why 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
Re: [PATCH 13/20] target/arm: Convert LDR/STR with 12-bit immediate to decodetree
In reply to Peter MaydellQuoted 9 lines · Peter Maydell
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<[email protected]>--- target/arm/tcg/a64.decode | 25 ++++++++ target/arm/tcg/translate-a64.c | 103 +++++---------------------------- 2 files changed, 41 insertions(+), 87 deletions(-)
r~
PATCH 14/20 target/arm: Convert LDR/STR reg+reg to decodetree
In reply to Peter MaydellConvert the LDR and STR instructions which take a register plus register offset to decodetree.
--- target/arm/tcg/a64.decode | 22 +++++ target/arm/tcg/translate-a64.c | 163 +++++++++++++++------------------ 2 files changed, 96 insertions(+), 89 deletions(-)
target/arm/tcg/a64.decode +22 -0
@@ -420,3 +420,25 @@ STR_v_i sz:2 111 1 01 00 ............ ..... ..... @ldst_uimm sign=0 ext= STR_v_i 00 111 1 01 10 ............ ..... ..... @ldst_uimm sign=0 ext=0 sz=4 LDR_v_i sz:2 111 1 01 01 ............ ..... ..... @ldst_uimm sign=0 ext=0 LDR_v_i 00 111 1 01 11 ............ ..... ..... @ldst_uimm sign=0 ext=0 sz=4 + +# Load/store with register offset +&ldst rm rn rt sign ext sz opt s +@ldst .. ... . .. .. . rm:5 opt:3 s:1 .. rn:5 rt:5 &ldst +STR sz:2 111 0 00 00 1 ..... ... . 10 ..... ..... @ldst sign=0 ext=0 +LDR 00 111 0 00 01 1 ..... ... . 10 ..... ..... @ldst sign=0 ext=1 sz=0 +LDR 01 111 0 00 01 1 ..... ... . 10 ..... ..... @ldst sign=0 ext=1 sz=1 +LDR 10 111 0 00 01 1 ..... ... . 10 ..... ..... @ldst sign=0 ext=1 sz=2 +LDR 11 111 0 00 01 1 ..... ... . 10 ..... ..... @ldst sign=0 ext=0 sz=3 +LDR 00 111 0 00 10 1 ..... ... . 10 ..... ..... @ldst sign=1 ext=0 sz=0 +LDR 01 111 0 00 10 1 ..... ... . 10 ..... ..... @ldst sign=1 ext=0 sz=1 +LDR 10 111 0 00 10 1 ..... ... . 10 ..... ..... @ldst sign=1 ext=0 sz=2 +LDR 00 111 0 00 11 1 ..... ... . 10 ..... ..... @ldst sign=1 ext=1 sz=0 +LDR 01 111 0 00 11 1 ..... ... . 10 ..... ..... @ldst sign=1 ext=1 sz=1 + +# PRFM +NOP 11 111 0 00 10 1 ----- -1- - 10 ----- ----- + +STR_v sz:2 111 1 00 00 1 ..... ... . 10 ..... ..... @ldst sign=0 ext=0 +STR_v 00 111 1 00 10 1 ..... ... . 10 ..... ..... @ldst sign=0 ext=0 sz=4 +LDR_v sz:2 111 1 00 01 1 ..... ... . 10 ..... ..... @ldst sign=0 ext=0 +LDR_v 00 111 1 00 11 1 ..... ... . 10 ..... ..... @ldst sign=0 ext=0 sz=4
target/arm/tcg/translate-a64.c +74 -89
189 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH 14/20] target/arm: Convert LDR/STR reg+reg to decodetree
Quoted 8 lines · Peter Maydell
Convert the LDR and STR instructions which take a register plus register offset to decodetree.
Signed-off-by Peter Maydell<[email protected]>--- target/arm/tcg/a64.decode | 22 +++++ target/arm/tcg/translate-a64.c | 163 +++++++++++++++------------------ 2 files changed, 96 insertions(+), 89 deletions(-)
r~
PATCH 15/20 target/arm: Convert atomic memory ops to decodetree
In reply to Peter MaydellConvert the insns in the atomic memory operations group to decodetree.
--- target/arm/tcg/a64.decode | 15 ++++ target/arm/tcg/translate-a64.c | 148 ++++++++++++--------------------- 2 files changed, 67 insertions(+), 96 deletions(-)
target/arm/tcg/a64.decode +15 -0
@@ -442,3 +442,18 @@ STR_v sz:2 111 1 00 00 1 ..... ... . 10 ..... ..... @ldst sign=0 ext=0 STR_v 00 111 1 00 10 1 ..... ... . 10 ..... ..... @ldst sign=0 ext=0 sz=4 LDR_v sz:2 111 1 00 01 1 ..... ... . 10 ..... ..... @ldst sign=0 ext=0 LDR_v 00 111 1 00 11 1 ..... ... . 10 ..... ..... @ldst sign=0 ext=0 sz=4 + +# Atomic memory operations +&atomic rs rn rt a r sz +@atomic sz:2 ... . .. a:1 r:1 . rs:5 . ... .. rn:5 rt:5 &atomic +LDADD .. 111 0 00 . . 1 ..... 0000 00 ..... ..... @atomic +LDCLR .. 111 0 00 . . 1 ..... 0001 00 ..... ..... @atomic +LDEOR .. 111 0 00 . . 1 ..... 0010 00 ..... ..... @atomic +LDSET .. 111 0 00 . . 1 ..... 0011 00 ..... ..... @atomic +LDSMAX .. 111 0 00 . . 1 ..... 0100 00 ..... ..... @atomic +LDSMIN .. 111 0 00 . . 1 ..... 0101 00 ..... ..... @atomic +LDUMAX .. 111 0 00 . . 1 ..... 0110 00 ..... ..... @atomic +LDUMIN .. 111 0 00 . . 1 ..... 0111 00 ..... ..... @atomic +SWP .. 111 0 00 . . 1 ..... 1000 00 ..... ..... @atomic + +LDAPR sz:2 111 0 00 1 0 1 11111 1100 00 rn:5 rt:5
target/arm/tcg/translate-a64.c +52 -96
177 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH 15/20] target/arm: Convert atomic memory ops to decodetree
Quoted 8 lines · Peter Maydell
Convert the insns in the atomic memory operations group to decodetree.
Signed-off-by Peter Maydell<[email protected]>--- target/arm/tcg/a64.decode | 15 ++++ target/arm/tcg/translate-a64.c | 148 ++++++++++++--------------------- 2 files changed, 67 insertions(+), 96 deletions(-)
r~
PATCH 16/20 target/arm: Convert load (pointer auth) insns to decodetree
In reply to Peter MaydellConvert the instructions in the load/store register (pointer authentication) group ot decodetree: LDRAA, LDRAB.
--- target/arm/tcg/a64.decode | 7 +++ target/arm/tcg/translate-a64.c | 83 +++++++--------------------------- 2 files changed, 23 insertions(+), 67 deletions(-)
target/arm/tcg/a64.decode +7 -0
@@ -457,3 +457,10 @@ LDUMIN .. 111 0 00 . . 1 ..... 0111 00 ..... ..... @atomic SWP .. 111 0 00 . . 1 ..... 1000 00 ..... ..... @atomic LDAPR sz:2 111 0 00 1 0 1 11111 1100 00 rn:5 rt:5 + +# Load/store register (pointer authentication) + +# LDRA immediate is 10 bits signed and scaled, but the bits aren't all contiguous +%ldra_imm 22:s1 12:9 !function=times_2 + +LDRA 11 111 0 00 m:1 . 1 ......... w:1 1 rn:5 rt:5 imm=%ldra_imm
target/arm/tcg/translate-a64.c +16 -67
122 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH 16/20] target/arm: Convert load (pointer auth) insns to decodetree
Quoted 14 lines · Peter Maydell
Convert the instructions in the load/store register (pointer authentication) group ot decodetree: LDRAA, LDRAB.
Signed-off-by Peter Maydell <[email protected]>--- target/arm/tcg/a64.decode | 7 +++ target/arm/tcg/translate-a64.c | 83 +++++++--------------------------- 2 files changed, 23 insertions(+), 67 deletions(-)target/arm/tcg/a64.decode +0
-0
target/arm/tcg/a64.decode LDUMIN .. 111 0 00 . . 1 ..... 0111 00 ..... ..... @atomic · line 466
Quoted 10 lines
target/arm/tcg/a64.decode +7
-0@@ -457,3 +457,10 @@ LDUMIN .. 111 0 00 . . 1 ..... 0111 00 ..... ..... @atomic SWP .. 111 0 00 . . 1 ..... 1000 00 ..... ..... @atomic LDAPR sz:2 111 0 00 1 0 1 11111 1100 00 rn:5 rt:5 + +# Load/store register (pointer authentication) + +# LDRA immediate is 10 bits signed and scaled, but the bits aren't all contiguous +%ldra_imm 22:s1 12:9 !function=times_2 + +LDRA 11 111 0 00 m:1 . 1 ......... w:1 1 rn:5 rt:5 imm=%ldra_imm
Only sz=3 && v=0, OK (previous code was calling unallocated_encoding).
Re: [PATCH 16/20] target/arm: Convert load (pointer auth) insns to decodetree
In reply to Peter MaydellQuoted 8 lines · Peter Maydell
Convert the instructions in the load/store register (pointer authentication) group ot decodetree: LDRAA, LDRAB.
Signed-off-by Peter Maydell<[email protected]>--- target/arm/tcg/a64.decode | 7 +++ target/arm/tcg/translate-a64.c | 83 +++++++--------------------------- 2 files changed, 23 insertions(+), 67 deletions(-)
r~
PATCH 17/20 target/arm: Convert LDAPR/STLR (imm) to decodetree
In reply to Peter MaydellConvert the instructions in the LDAPR/STLR (unscaled immediate) group to decodetree.
--- target/arm/tcg/a64.decode | 10 +++ target/arm/tcg/translate-a64.c | 129 +++++++++++---------------------- 2 files changed, 54 insertions(+), 85 deletions(-)
target/arm/tcg/a64.decode +10 -0
@@ -464,3 +464,13 @@ LDAPR sz:2 111 0 00 1 0 1 11111 1100 00 rn:5 rt:5 %ldra_imm 22:s1 12:9 !function=times_2 LDRA 11 111 0 00 m:1 . 1 ......... w:1 1 rn:5 rt:5 imm=%ldra_imm + +&ldapr_stlr_i rn rt imm sz sign ext +@ldapr_stlr_i .. ...... .. . imm:9 .. rn:5 rt:5 &ldapr_stlr_i +STLR_i sz:2 011001 00 0 ......... 00 ..... ..... @ldapr_stlr_i sign=0 ext=0 +LDAPR_i sz:2 011001 01 0 ......... 00 ..... ..... @ldapr_stlr_i sign=0 ext=0 +LDAPR_i 00 011001 10 0 ......... 00 ..... ..... @ldapr_stlr_i sign=1 ext=0 sz=0 +LDAPR_i 01 011001 10 0 ......... 00 ..... ..... @ldapr_stlr_i sign=1 ext=0 sz=1 +LDAPR_i 10 011001 10 0 ......... 00 ..... ..... @ldapr_stlr_i sign=1 ext=0 sz=2 +LDAPR_i 00 011001 11 0 ......... 00 ..... ..... @ldapr_stlr_i sign=1 ext=1 sz=0 +LDAPR_i 01 011001 11 0 ......... 00 ..... ..... @ldapr_stlr_i sign=1 ext=1 sz=1
target/arm/tcg/translate-a64.c +44 -85
163 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH 17/20] target/arm: Convert LDAPR/STLR (imm) to decodetree
Quoted 8 lines · Peter Maydell
Convert the instructions in the LDAPR/STLR (unscaled immediate) group to decodetree.
Signed-off-by Peter Maydell<[email protected]>--- target/arm/tcg/a64.decode | 10 +++ target/arm/tcg/translate-a64.c | 129 +++++++++++---------------------- 2 files changed, 54 insertions(+), 85 deletions(-)
r~
PATCH 18/20 target/arm: Convert load/store (multiple structures) to decodetree
In reply to Peter MaydellConvert the instructions in the ASIMD load/store multiple structures instruction classes to decodetree.
--- target/arm/tcg/a64.decode | 20 +++ target/arm/tcg/translate-a64.c | 220 ++++++++++++++++----------------- 2 files changed, 129 insertions(+), 111 deletions(-)
target/arm/tcg/a64.decode +20 -0
@@ -474,3 +474,23 @@ LDAPR_i 01 011001 10 0 ......... 00 ..... ..... @ldapr_stlr_i sign=1 ext LDAPR_i 10 011001 10 0 ......... 00 ..... ..... @ldapr_stlr_i sign=1 ext=0 sz=2 LDAPR_i 00 011001 11 0 ......... 00 ..... ..... @ldapr_stlr_i sign=1 ext=1 sz=0 LDAPR_i 01 011001 11 0 ......... 00 ..... ..... @ldapr_stlr_i sign=1 ext=1 sz=1 + +# Load/store multiple structures +# The 4-bit opcode in [15:12] encodes repeat count and structure elements +&ldst_mult rm rn rt sz q p rpt selem +@ldst_mult . q:1 ...... p:1 . . rm:5 .... sz:2 rn:5 rt:5 &ldst_mult +ST_mult 0 . 001100 . 0 0 ..... 0000 .. ..... ..... @ldst_mult rpt=1 selem=4 +ST_mult 0 . 001100 . 0 0 ..... 0010 .. ..... ..... @ldst_mult rpt=4 selem=1 +ST_mult 0 . 001100 . 0 0 ..... 0100 .. ..... ..... @ldst_mult rpt=1 selem=3 +ST_mult 0 . 001100 . 0 0 ..... 0110 .. ..... ..... @ldst_mult rpt=3 selem=1 +ST_mult 0 . 001100 . 0 0 ..... 0111 .. ..... ..... @ldst_mult rpt=1 selem=1 +ST_mult 0 . 001100 . 0 0 ..... 1000 .. ..... ..... @ldst_mult rpt=1 selem=2 +ST_mult 0 . 001100 . 0 0 ..... 1010 .. ..... ..... @ldst_mult rpt=2 selem=1 + +LD_mult 0 . 001100 . 1 0 ..... 0000 .. ..... ..... @ldst_mult rpt=1 selem=4 +LD_mult 0 . 001100 . 1 0 ..... 0010 .. ..... ..... @ldst_mult rpt=4 selem=1 +LD_mult 0 . 001100 . 1 0 ..... 0100 .. ..... ..... @ldst_mult rpt=1 selem=3 +LD_mult 0 . 001100 . 1 0 ..... 0110 .. ..... ..... @ldst_mult rpt=3 selem=1 +LD_mult 0 . 001100 . 1 0 ..... 0111 .. ..... ..... @ldst_mult rpt=1 selem=1 +LD_mult 0 . 001100 . 1 0 ..... 1000 .. ..... ..... @ldst_mult rpt=1 selem=2 +LD_mult 0 . 001100 . 1 0 ..... 1010 .. ..... ..... @ldst_mult rpt=2 selem=1
target/arm/tcg/translate-a64.c +109 -111
284 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH 18/20] target/arm: Convert load/store (multiple structures) to decodetree
Quoted 8 lines · Peter Maydell
Convert the instructions in the ASIMD load/store multiple structures instruction classes to decodetree.
Signed-off-by Peter Maydell<[email protected]>--- target/arm/tcg/a64.decode | 20 +++ target/arm/tcg/translate-a64.c | 220 ++++++++++++++++----------------- 2 files changed, 129 insertions(+), 111 deletions(-)
r~
PATCH 19/20 target/arm: Convert load/store single structure to decodetree
In reply to Peter MaydellConvert the ASIMD load/store single structure insns to decodetree.
---
I note that compared to the old decoder this is rather harder to compare against the pseudocode; the old hand-decode can follow the pseudocode quite closely with its switch on 'scale', whereas here quite a lot of magic is happening in the calculation of 'index'.
--- target/arm/tcg/a64.decode | 37 ++++++ target/arm/tcg/translate-a64.c | 228 ++++++++++++++++----------------- 2 files changed, 148 insertions(+), 117 deletions(-)
target/arm/tcg/a64.decode +37 -0
@@ -494,3 +494,40 @@ LD_mult 0 . 001100 . 1 0 ..... 0110 .. ..... ..... @ldst_mult rpt=3 sele LD_mult 0 . 001100 . 1 0 ..... 0111 .. ..... ..... @ldst_mult rpt=1 selem=1 LD_mult 0 . 001100 . 1 0 ..... 1000 .. ..... ..... @ldst_mult rpt=1 selem=2 LD_mult 0 . 001100 . 1 0 ..... 1010 .. ..... ..... @ldst_mult rpt=2 selem=1 + +# Load/store single structure + +%ldst_single_selem 13:1 21:1 !function=plus_1 +# The index is made up from bits Q, S and the size; we may then need to scale +# it down by the size. +%ldst_single_index q:1 s:1 sz:2 +%ldst_single_index_scaled q:1 s:1 sz:2 scale:3 !function=uimm_scaled_down +%ldst_single_repl_scale 10:2 + +# We don't care about S in the trans functions (the decode folds it into +# the calculation of index), but we have to list it here so that we can +# handle the S-must-be-0 pattern lines. Similarly we don't care about sz +# once it has been used to calculate index. +&ldst_single rm rn rt sz p q s selem index scale repl + +@ldst_single . q:1 ...... p:1 . . rm:5 ... . .. rn:5 rt:5 \ + &ldst_single index=%ldst_single_index_scaled \ + selem=%ldst_single_selem repl=0 +@ldst_single_repl . q:1 ...... p:1 . . rm:5 ... . sz:2 rn:5 rt:5 \ + &ldst_single index=%ldst_single_index \ + scale=%ldst_single_repl_scale selem=%ldst_single_selem repl=1 + + +ST_single 0 . 001101 . 0 . ..... 00 . s:1 sz:2 ..... ..... @ldst_single scale=0 +ST_single 0 . 001101 . 0 . ..... 01 . s:1 00 ..... ..... @ldst_single scale=1 sz=0 +ST_single 0 . 001101 . 0 . ..... 01 . s:1 10 ..... ..... @ldst_single scale=1 sz=2 +ST_single 0 . 001101 . 0 . ..... 10 . s:1 00 ..... ..... @ldst_single scale=2 sz=0 +ST_single 0 . 001101 . 0 . ..... 10 . 0 01 ..... ..... @ldst_single scale=3 sz=1 s=0 + +LD_single 0 . 001101 . 1 . ..... 00 . s:1 sz:2 ..... ..... @ldst_single scale=0 +LD_single 0 . 001101 . 1 . ..... 01 . s:1 00 ..... ..... @ldst_single scale=1 sz=0 +LD_single 0 . 001101 . 1 . ..... 01 . s:1 10 ..... ..... @ldst_single scale=1 sz=2 +LD_single 0 . 001101 . 1 . ..... 10 . s:1 00 ..... ..... @ldst_single scale=2 sz=0 +LD_single 0 . 001101 . 1 . ..... 10 . 0 01 ..... ..... @ldst_single scale=3 sz=1 s=0 +# Replicating load case +LD_single_repl 0 . 001101 . 1 . ..... 11 . 0 .. ..... ..... @ldst_single_repl s=0
target/arm/tcg/translate-a64.c +111 -117
266 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH 19/20] target/arm: Convert load/store single structure to decodetree
Quoted 18 lines · Peter Maydell
target/arm/tcg/a64.decode +18
-0+# Load/store single structure + +%ldst_single_selem 13:1 21:1 !function=plus_1 +# The index is made up from bits Q, S and the size; we may then need to scale +# it down by the size. +%ldst_single_index q:1 s:1 sz:2 +%ldst_single_index_scaled q:1 s:1 sz:2 scale:3 !function=uimm_scaled_down +%ldst_single_repl_scale 10:2 + +# We don't care about S in the trans functions (the decode folds it into +# the calculation of index), but we have to list it here so that we can +# handle the S-must-be-0 pattern lines. Similarly we don't care about sz +# once it has been used to calculate index. +&ldst_single rm rn rt sz p q s selem index scale repl + +@ldst_single . q:1 ...... p:1 . . rm:5 ... . .. rn:5 rt:5 \ + &ldst_single index=%ldst_single_index_scaled \ + selem=%ldst_single_selem repl=0
target/arm/tcg/a64.decode LD_mult 0 . 001100 . 1 0 ..... 0110 .. ..... ..... @ldst_mult rpt=3 sele · line 525
Quoted 10 lines
target/arm/tcg/a64.decode +10
-0+@ldst_single_repl . q:1 ...... p:1 . . rm:5 ... . sz:2 rn:5 rt:5 \ + &ldst_single index=%ldst_single_index \ + scale=%ldst_single_repl_scale selem=%ldst_single_selem repl=1 + + +ST_single 0 . 001101 . 0 . ..... 00 . s:1 sz:2 ..... ..... @ldst_single scale=0 +ST_single 0 . 001101 . 0 . ..... 01 . s:1 00 ..... ..... @ldst_single scale=1 sz=0 +ST_single 0 . 001101 . 0 . ..... 01 . s:1 10 ..... ..... @ldst_single scale=1 sz=2 +ST_single 0 . 001101 . 0 . ..... 10 . s:1 00 ..... ..... @ldst_single scale=2 sz=0 +ST_single 0 . 001101 . 0 . ..... 10 . 0 01 ..... ..... @ldst_single scale=3 sz=1 s=0
Wow, that's hard to follow. How about
%ldst_single_selem 13:1 21:1 !function=plus_1 %ldst_single_index_b 30:1 10:3 %ldst_single_index_h 30:1 11:2 %ldst_single_index_s 30:1 12:1
@ldst_single_b .. ...... p:1 . . rm:5 ...... rn:5 rt:5 \
&ldst_single scale=0 selem=%ldst_single_selem \
index=%ldst_single_index_b
@ldst_single_h .. ...... p:1 . . rm:5 ...... rn:5 rt:5 \
&ldst_single scale=1 selem=%ldst_single_selem \
index=%ldst_single_index_h
@ldst_single_s .. ...... p:1 .. rm:5 ...... rn:5 rt:5 \
&ldst_single scale=2 selem=%ldst_single_selem \
index=%ldst_single_index_s@ldst_single_d . index:1 ...... p:1 .. rm:5 ...... rn:5 rt:5 \
&ldst_single scale=3 selem=%ldst_single_selem
ST_single 0 . 001101 . 0 . ..... 00 . ... ..... ..... @ldst_single_b ST_single 0 . 001101 . 0 . ..... 01 . ..0 ..... ..... @ldst_single_h ST_single 0 . 001101 . 0 . ..... 10 . .00 ..... ..... @ldst_single_s ST_single 0 . 001101 . 0 . ..... 10 . 001 ..... ..... @ldst_single_d
LD_single 0 . 001101 . 1 . ..... 00 . ... ..... ..... @ldst_single_b LD_single 0 . 001101 . 1 . ..... 01 . ..0 ..... ..... @ldst_single_h LD_single 0 . 001101 . 1 . ..... 10 . .00 ..... ..... @ldst_single_s LD_single 0 . 001101 . 1 . ..... 10 . 001 ..... ..... @ldst_single_d
# Different unnamed argument set -- there is no index for repl.LD_single_repl 0 . 001101 p:1 1 . rm:5 11 00 scale:2 rn:5 rt:5 \
selem=%ldst_single_selem
This is similar to how I handle similar situations in SVE, e.g. PSEL.
r~
PATCH 20/20 target/arm: Convert load/store tags insns to decodetree
In reply to Peter MaydellConvert the instructions in the load/store memory tags instruction group to decodetree.
--- target/arm/tcg/a64.decode | 25 +++ target/arm/tcg/translate-a64.c | 352 ++++++++++++++++----------------- 2 files changed, 195 insertions(+), 182 deletions(-)
target/arm/tcg/a64.decode +25 -0
@@ -531,3 +531,28 @@ LD_single 0 . 001101 . 1 . ..... 10 . s:1 00 ..... ..... @ldst_single scal LD_single 0 . 001101 . 1 . ..... 10 . 0 01 ..... ..... @ldst_single scale=3 sz=1 s=0 # Replicating load case LD_single_repl 0 . 001101 . 1 . ..... 11 . 0 .. ..... ..... @ldst_single_repl s=0 + +%tag_offset 12:s9 !function=scale_by_log2_tag_granule +&ldst_tag rn rt imm p w +@ldst_tag ........ .. . ......... .. rn:5 rt:5 &ldst_tag imm=%tag_offset +@ldst_tag_mult ........ .. . 000000000 .. rn:5 rt:5 &ldst_tag imm=0 + +STZGM 11011001 00 1 ......... 00 ..... ..... @ldst_tag_mult p=0 w=0 +STG 11011001 00 1 ......... 01 ..... ..... @ldst_tag p=1 w=1 +STG 11011001 00 1 ......... 10 ..... ..... @ldst_tag p=0 w=0 +STG 11011001 00 1 ......... 11 ..... ..... @ldst_tag p=0 w=1 + +LDG 11011001 01 1 ......... 00 ..... ..... @ldst_tag p=0 w=0 +STZG 11011001 01 1 ......... 01 ..... ..... @ldst_tag p=1 w=1 +STZG 11011001 01 1 ......... 10 ..... ..... @ldst_tag p=0 w=0 +STZG 11011001 01 1 ......... 11 ..... ..... @ldst_tag p=0 w=1 + +STGM 11011001 10 1 ......... 00 ..... ..... @ldst_tag_mult p=0 w=0 +ST2G 11011001 10 1 ......... 01 ..... ..... @ldst_tag p=1 w=1 +ST2G 11011001 10 1 ......... 10 ..... ..... @ldst_tag p=0 w=0 +ST2G 11011001 10 1 ......... 11 ..... ..... @ldst_tag p=0 w=1 + +LDGM 11011001 11 1 ......... 00 ..... ..... @ldst_tag_mult p=0 w=0 +STZ2G 11011001 11 1 ......... 01 ..... ..... @ldst_tag p=1 w=1 +STZ2G 11011001 11 1 ......... 10 ..... ..... @ldst_tag p=0 w=0 +STZ2G 11011001 11 1 ......... 11 ..... ..... @ldst_tag p=0 w=1
target/arm/tcg/translate-a64.c +170 -182
401 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH 20/20] target/arm: Convert load/store tags insns to decodetree
Quoted 8 lines · Peter Maydell
Convert the instructions in the load/store memory tags instruction group to decodetree.
Signed-off-by Peter Maydell<[email protected]>--- target/arm/tcg/a64.decode | 25 +++ target/arm/tcg/translate-a64.c | 352 ++++++++++++++++----------------- 2 files changed, 195 insertions(+), 182 deletions(-)
r~