target/arm: Remove MO_TE to compile MVE/M helpers once
v2 cover target/arm: Remove MO_TE to compile MVE/M helpers once
Missing review: #5
Replace build-time MO_TE definition by runtime mo_endian() helper, allowing to compile m_helper.c and mve_helper.c once.
Philippe Mathieu-Daudé (9):
target/arm: Ignore endianness when setting MTE tags target/arm: Explode MO_TExx -> MO_TE | MO_xx target/arm: Hoist MO_TE into mve_advance_vpt() target/arm: Hoist MO_TE into MVE DO_VSTR() macro target/arm: Introduce mo_endian() helper target/arm: Replace MO_TE -> mo_endian() for MVE helpers target/arm: Compile mve_helper.c once
target/arm: Replace MO_TE -> mo_endian() for Cortex-M helpers target/arm: Compile m_helper.c once
target/arm/internals.h | 6 +++ target/arm/tcg/helper-a64.c | 2 +- target/arm/tcg/m_helper.c | 8 +-- target/arm/tcg/mve_helper.c | 102 +++++++++++++++++++++--------------- target/arm/tcg/meson.build | 6 ++- 5 files changed, 75 insertions(+), 49 deletions(-)
Signature · 1 line
2.53.0
PATCH v2 4/9 target/arm: Hoist MO_TE into MVE DO_VSTR() macro
--- target/arm/tcg/mve_helper.c | 43 +++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 23 deletions(-)
target/arm/tcg/mve_helper.c +20 -23
@@ -235,7 +235,8 @@ DO_VSTR(vstrh_w, MO_UW, 2, stw, 4, int32_t)unsigned e; \uint32_t addr; \int mmu_idx =arm_to_core_mmu_idx (arm_mmu_idx (env)); \ -MemOpIdx oi =make_memop_idx (MFLAG |MO_ALIGN , mmu_idx); \ +MemOpIdx oi =make_memop_idx (MO_TE |MFLAG |MO_ALIGN , \ + mmu_idx); \for (e =0 ; e <16 /ESIZE ; e++, mask >>=ESIZE , eci_mask >>=ESIZE ) { \if (!(eci_mask &1 )) { \continue ; \
@@ -262,7 +263,8 @@ DO_VSTR(vstrh_w, MO_UW, 2, stw, 4, int32_t)unsigned e; \uint32_t addr; \int mmu_idx =arm_to_core_mmu_idx (arm_mmu_idx (env)); \ -MemOpIdx oi =make_memop_idx (MFLAG |MO_ALIGN , mmu_idx); \ +MemOpIdx oi =make_memop_idx (MO_TE |MFLAG |MO_ALIGN , \ + mmu_idx); \for (e =0 ; e <16 /ESIZE ; e++, mask >>=ESIZE , eci_mask >>=ESIZE ) { \if (!(eci_mask &1 )) { \continue ; \
@@ -347,47 +349,42 @@ DO_VSTR(vstrh_w, MO_UW, 2, stw, 4, int32_t) DO_VLDR_SG(vldrb_sg_sh, MO_SB, int8_t, ldb, 2, int16_t, uint16_t, ADDR_ADD, false) DO_VLDR_SG(vldrb_sg_sw, MO_SB, int8_t, ldb, 4, int32_t, uint32_t, ADDR_ADD, false) -DO_VLDR_SG (vldrh_sg_sw,MO_TE |MO_SW , int16_t, ldw,4 , - int32_t, uint32_t, ADDR_ADD, false) +DO_VLDR_SG(vldrh_sg_sw, MO_SW, int16_t, ldw, 4, int32_t, uint32_t, ADDR_ADD, false) DO_VLDR_SG(vldrb_sg_ub, MO_UB, uint8_t, ldb, 1, uint8_t, uint8_t, ADDR_ADD, false) DO_VLDR_SG(vldrb_sg_uh, MO_UB, uint8_t, ldb, 2, uint16_t, uint16_t, ADDR_ADD, false) DO_VLDR_SG(vldrb_sg_uw, MO_UB, uint8_t, ldb, 4, uint32_t, uint32_t, ADDR_ADD, false) -DO_VLDR_SG (vldrh_sg_uh,MO_TE |MO_UW , uint16_t, ldw,2 , - uint16_t, uint16_t, ADDR_ADD, false) -DO_VLDR_SG (vldrh_sg_uw,MO_TE |MO_UW , uint16_t, ldw,4 , - uint32_t, uint32_t, ADDR_ADD, false) -DO_VLDR_SG (vldrw_sg_uw,MO_TE |MO_UL , uint32_t, ldl,4 , - uint32_t, uint32_t, ADDR_ADD, false) +DO_VLDR_SG(vldrh_sg_uh, MO_UW, uint16_t, ldw, 2, uint16_t, uint16_t, ADDR_ADD, false) +DO_VLDR_SG(vldrh_sg_uw, MO_UW, uint16_t, ldw, 4, uint32_t, uint32_t, ADDR_ADD, false) +DO_VLDR_SG(vldrw_sg_uw, MO_UL, uint32_t, ldl, 4, uint32_t, uint32_t, ADDR_ADD, false) DO_VLDR64_SG(vldrd_sg_ud, ADDR_ADD, false) -DO_VLDR_SG (vldrh_sg_os_sw,MO_TE |MO_SW , int16_t, ldw,4 , +DO_VLDR_SG (vldrh_sg_os_sw,MO_SW , int16_t, ldw,4 , int32_t, uint32_t, ADDR_ADD_OSH, false) -DO_VLDR_SG (vldrh_sg_os_uh,MO_TE |MO_UW , uint16_t, ldw,2 , +DO_VLDR_SG (vldrh_sg_os_uh,MO_UW , uint16_t, ldw,2 , uint16_t, uint16_t, ADDR_ADD_OSH, false) -DO_VLDR_SG (vldrh_sg_os_uw,MO_TE |MO_UW , uint16_t, ldw,4 , +DO_VLDR_SG (vldrh_sg_os_uw,MO_UW , uint16_t, ldw,4 , uint32_t, uint32_t, ADDR_ADD_OSH, false) -DO_VLDR_SG (vldrw_sg_os_uw,MO_TE |MO_UL , uint32_t, ldl,4 , +DO_VLDR_SG (vldrw_sg_os_uw,MO_UL , uint32_t, ldl,4 , uint32_t, uint32_t, ADDR_ADD_OSW, false) DO_VLDR64_SG(vldrd_sg_os_ud, ADDR_ADD_OSD, false) DO_VSTR_SG(vstrb_sg_ub, MO_UB, stb, 1, uint8_t, ADDR_ADD, false) DO_VSTR_SG(vstrb_sg_uh, MO_UB, stb, 2, uint16_t, ADDR_ADD, false) DO_VSTR_SG(vstrb_sg_uw, MO_UB, stb, 4, uint32_t, ADDR_ADD, false) -DO_VSTR_SG(vstrh_sg_uh, MO_TE | MO_UW, stw, 2, uint16_t, ADDR_ADD, false) -DO_VSTR_SG(vstrh_sg_uw, MO_TE | MO_UW, stw, 4, uint32_t, ADDR_ADD, false) -DO_VSTR_SG(vstrw_sg_uw, MO_TE | MO_UL, stl, 4, uint32_t, ADDR_ADD, false) +DO_VSTR_SG(vstrh_sg_uh, MO_UW, stw, 2, uint16_t, ADDR_ADD, false) +DO_VSTR_SG(vstrh_sg_uw, MO_UW, stw, 4, uint32_t, ADDR_ADD, false) +DO_VSTR_SG(vstrw_sg_uw, MO_UL, stl, 4, uint32_t, ADDR_ADD, false) DO_VSTR64_SG(vstrd_sg_ud, ADDR_ADD, false) -DO_VSTR_SG(vstrh_sg_os_uh, MO_TE | MO_UW, stw, 2, uint16_t, ADDR_ADD_OSH, false) -DO_VSTR_SG(vstrh_sg_os_uw, MO_TE | MO_UW, stw, 4, uint32_t, ADDR_ADD_OSH, false) -DO_VSTR_SG(vstrw_sg_os_uw, MO_TE | MO_UL, stl, 4, uint32_t, ADDR_ADD_OSW, false) +DO_VSTR_SG(vstrh_sg_os_uh, MO_UW, stw, 2, uint16_t, ADDR_ADD_OSH, false) +DO_VSTR_SG(vstrh_sg_os_uw, MO_UW, stw, 4, uint32_t, ADDR_ADD_OSH, false) +DO_VSTR_SG(vstrw_sg_os_uw, MO_UL, stl, 4, uint32_t, ADDR_ADD_OSW, false) DO_VSTR64_SG(vstrd_sg_os_ud, ADDR_ADD_OSD, false) -DO_VLDR_SG (vldrw_sg_wb_uw,MO_TE |MO_UL , uint32_t, ldl,4 , - uint32_t, uint32_t, ADDR_ADD, true) +DO_VLDR_SG(vldrw_sg_wb_uw, MO_UL, uint32_t, ldl, 4, uint32_t, uint32_t, ADDR_ADD, true) DO_VLDR64_SG(vldrd_sg_wb_ud, ADDR_ADD, true) -DO_VSTR_SG(vstrw_sg_wb_uw, MO_TE | MO_UL, stl, 4, uint32_t, ADDR_ADD, true) +DO_VSTR_SG(vstrw_sg_wb_uw, MO_UL, stl, 4, uint32_t, ADDR_ADD, true)DO_VSTR64_SG (vstrd_sg_wb_ud,ADDR_ADD , true)/*
Signature · 1 line
2.53.0
PATCH v2 3/9 target/arm: Hoist MO_TE into mve_advance_vpt()
In reply to Philippe Mathieu-Daudé--- target/arm/tcg/mve_helper.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
target/arm/tcg/mve_helper.c +11 -9
@@ -160,7 +160,8 @@ static void mve_advance_vpt(CPUARMState *env)uint16_t eci_mask =mve_eci_mask (env); \unsigned b, e; \int mmu_idx =arm_to_core_mmu_idx (arm_mmu_idx (env)); \ -MemOpIdx oi =make_memop_idx (MFLAG |MO_ALIGN , mmu_idx); \ +MemOpIdx oi =make_memop_idx (MO_TE |MFLAG |MO_ALIGN , \ + mmu_idx); \/* \ * R_SXTM allows the dest reg to become UNKNOWN for abandoned \ * beats so we don't care if we update part of the dest and \
@@ -183,7 +184,8 @@ static void mve_advance_vpt(CPUARMState *env)uint16_t mask =mve_element_mask (env); \unsigned b, e; \int mmu_idx =arm_to_core_mmu_idx (arm_mmu_idx (env)); \ -MemOpIdx oi =make_memop_idx (MFLAG |MO_ALIGN , mmu_idx); \ +MemOpIdx oi =make_memop_idx (MO_TE |MFLAG |MO_ALIGN , \ + mmu_idx); \for (b =0 , e =0 ; b <16 ; b +=ESIZE , e++) { \if (mask & (1 << b)) { \ cpu_##STTYPE##_mmu(env, addr, d[H##ESIZE(e)], oi, GETPC()); \
@@ -194,23 +196,23 @@ static void mve_advance_vpt(CPUARMState *env) } DO_VLDR(vldrb, MO_UB, 1, uint8_t, ldb, 1, uint8_t) -DO_VLDR(vldrh, MO_TE | MO_UW, 2, uint16_t, ldw, 2, uint16_t) -DO_VLDR(vldrw, MO_TE | MO_UL, 4, uint32_t, ldl, 4, uint32_t) +DO_VLDR(vldrh, MO_UW, 2, uint16_t, ldw, 2, uint16_t) +DO_VLDR(vldrw, MO_UL, 4, uint32_t, ldl, 4, uint32_t) DO_VSTR(vstrb, MO_UB, 1, stb, 1, uint8_t) -DO_VSTR(vstrh, MO_TE | MO_UW, 2, stw, 2, uint16_t) -DO_VSTR(vstrw, MO_TE | MO_UL, 4, stl, 4, uint32_t) +DO_VSTR(vstrh, MO_UW, 2, stw, 2, uint16_t) +DO_VSTR(vstrw, MO_UL, 4, stl, 4, uint32_t) DO_VLDR(vldrb_sh, MO_SB, 1, int8_t, ldb, 2, int16_t) DO_VLDR(vldrb_sw, MO_SB, 1, int8_t, ldb, 4, int32_t) DO_VLDR(vldrb_uh, MO_UB, 1, uint8_t, ldb, 2, uint16_t) DO_VLDR(vldrb_uw, MO_UB, 1, uint8_t, ldb, 4, uint32_t) -DO_VLDR(vldrh_sw, MO_TE | MO_SW, 2, int16_t, ldw, 4, int32_t) -DO_VLDR(vldrh_uw, MO_TE | MO_UW, 2, uint16_t, ldw, 4, uint32_t) +DO_VLDR(vldrh_sw, MO_SW, 2, int16_t, ldw, 4, int32_t) +DO_VLDR(vldrh_uw, MO_UW, 2, uint16_t, ldw, 4, uint32_t) DO_VSTR(vstrb_h, MO_UB, 1, stb, 2, int16_t) DO_VSTR(vstrb_w, MO_UB, 1, stb, 4, int32_t) -DO_VSTR(vstrh_w, MO_TE | MO_UW, 2, stw, 4, int32_t) +DO_VSTR(vstrh_w, MO_UW, 2, stw, 4, int32_t)#undef DO_VLDR#undef DO_VSTR
Signature · 1 line
2.53.0
PATCH v2 2/9 target/arm: Explode MO_TExx -> MO_TE | MO_xx
In reply to Philippe Mathieu-DaudéExtract the implicit MO_TE definition in order to replace it in the next commit.
Mechanical change using:
$ for n in UW UL UQ UO SW SL SQ; do \
sed -i -e "s/MO_TE$n/MO_TE | MO_$n/" \
$(git grep -l MO_TE$n target/arm); \
done--- target/arm/tcg/m_helper.c | 6 +-- target/arm/tcg/mve_helper.c | 79 ++++++++++++++++++++----------------- 2 files changed, 45 insertions(+), 40 deletions(-)
target/arm/tcg/m_helper.c +3 -3
@@ -634,7 +634,7 @@ void HELPER(v7m_blxns)(CPUARMState *env, uint32_t dest)/* Note that these stores can throw exceptions on MPU faults */ ARMMMUIdx mmu_idx =arm_mmu_idx (env); -MemOpIdx oi =make_memop_idx (MO_TEUL |MO_ALIGN , +MemOpIdx oi =make_memop_idx (MO_TE |MO_UL |MO_ALIGN ,arm_to_core_mmu_idx (mmu_idx));cpu_stl_mmu (env, sp, nextinst, oi,GETPC ());cpu_stl_mmu (env, sp +4 , saved_psr, oi,GETPC ());
@@ -1055,7 +1055,7 @@ void HELPER(v7m_vlstm)(CPUARMState *env, uint32_t fptr)bool lspact = env->v7m.fpccr[s] &R_V7M_FPCCR_LSPACT_MASK ;uintptr_t ra =GETPC ();ARMMMUIdx mmu_idx =arm_mmu_idx (env); -MemOpIdx oi =make_memop_idx (MO_TEUL |MO_ALIGN , +MemOpIdx oi =make_memop_idx (MO_TE |MO_UL |MO_ALIGN ,arm_to_core_mmu_idx (mmu_idx));assert (env->v7m.secure);
@@ -1131,7 +1131,7 @@ void HELPER(v7m_vlldm)(CPUARMState *env, uint32_t fptr)ARMCPU *cpu =env_archcpu (env);uintptr_t ra =GETPC ();ARMMMUIdx mmu_idx =arm_mmu_idx (env); -MemOpIdx oi =make_memop_idx (MO_TEUL |MO_ALIGN , +MemOpIdx oi =make_memop_idx (MO_TE |MO_UL |MO_ALIGN ,arm_to_core_mmu_idx (mmu_idx));/* fptr is the value of Rn, the frame pointer we load the FP regs from */
target/arm/tcg/mve_helper.c +42 -37
205 lines not on this page · raw message
Signature · 1 line
2.53.0
PATCH v2 6/9 target/arm: Replace MO_TE -> mo_endian() for MVE helpers
In reply to Philippe Mathieu-Daudé--- target/arm/tcg/mve_helper.c | 47 +++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 17 deletions(-)
target/arm/tcg/mve_helper.c +30 -17
@@ -160,7 +160,7 @@ static void mve_advance_vpt(CPUARMState *env)uint16_t eci_mask =mve_eci_mask (env); \unsigned b, e; \int mmu_idx =arm_to_core_mmu_idx (arm_mmu_idx (env)); \ -MemOpIdx oi =make_memop_idx (MO_TE |MFLAG |MO_ALIGN , \ +MemOpIdx oi =make_memop_idx (mo_endian (env) |MFLAG |MO_ALIGN , \ mmu_idx); \/* \ * R_SXTM allows the dest reg to become UNKNOWN for abandoned \
@@ -184,7 +184,7 @@ static void mve_advance_vpt(CPUARMState *env)uint16_t mask =mve_element_mask (env); \unsigned b, e; \int mmu_idx =arm_to_core_mmu_idx (arm_mmu_idx (env)); \ -MemOpIdx oi =make_memop_idx (MO_TE |MFLAG |MO_ALIGN , \ +MemOpIdx oi =make_memop_idx (mo_endian (env) |MFLAG |MO_ALIGN , \ mmu_idx); \for (b =0 , e =0 ; b <16 ; b +=ESIZE , e++) { \if (mask & (1 << b)) { \
@@ -235,7 +235,7 @@ DO_VSTR(vstrh_w, MO_UW, 2, stw, 4, int32_t)unsigned e; \uint32_t addr; \int mmu_idx =arm_to_core_mmu_idx (arm_mmu_idx (env)); \ -MemOpIdx oi =make_memop_idx (MO_TE |MFLAG |MO_ALIGN , \ +MemOpIdx oi =make_memop_idx (mo_endian (env) |MFLAG |MO_ALIGN , \ mmu_idx); \for (e =0 ; e <16 /ESIZE ; e++, mask >>=ESIZE , eci_mask >>=ESIZE ) { \if (!(eci_mask &1 )) { \
@@ -263,7 +263,7 @@ DO_VSTR(vstrh_w, MO_UW, 2, stw, 4, int32_t)unsigned e; \uint32_t addr; \int mmu_idx =arm_to_core_mmu_idx (arm_mmu_idx (env)); \ -MemOpIdx oi =make_memop_idx (MO_TE |MFLAG |MO_ALIGN , \ +MemOpIdx oi =make_memop_idx (mo_endian (env) |MFLAG |MO_ALIGN , \ mmu_idx); \for (e =0 ; e <16 /ESIZE ; e++, mask >>=ESIZE , eci_mask >>=ESIZE ) { \if (!(eci_mask &1 )) { \
@@ -326,7 +326,8 @@ DO_VSTR(vstrh_w, MO_UW, 2, stw, 4, int32_t)unsigned e; \uint32_t addr; \int mmu_idx =arm_to_core_mmu_idx (arm_mmu_idx (env)); \ -MemOpIdx oi =make_memop_idx (MO_TE |MO_UL |MO_ALIGN , mmu_idx);\ +MemOpIdx oi =make_memop_idx (mo_endian (env) |MO_UL |MO_ALIGN , \ + mmu_idx); \for (e =0 ; e <16 /4 ; e++, mask >>=4 , eci_mask >>=4 ) { \if (!(eci_mask &1 )) { \continue ; \
@@ -413,7 +414,8 @@ DO_VSTR64_SG(vstrd_sg_wb_ud, ADDR_ADD, true)static const uint8_t off[4 ] = {O1 ,O2 ,O3 ,O4 }; \uint32_t addr, data; \int mmu_idx =arm_to_core_mmu_idx (arm_mmu_idx (env)); \ -MemOpIdx oi =make_memop_idx (MO_TE |MO_UL |MO_ALIGN , mmu_idx);\ +MemOpIdx oi =make_memop_idx (mo_endian (env) |MO_UL |MO_ALIGN , \ + mmu_idx); \for (beat =0 ; beat <4 ; beat++, mask >>=4 ) { \if ((mask &1 ) ==0 ) { \/* ECI says skip this beat */ \
@@ -439,7 +441,8 @@ DO_VSTR64_SG(vstrd_sg_wb_ud, ADDR_ADD, true)int y;/* y counts 0 2 0 2 */ \uint16_t *qd; \int mmu_idx =arm_to_core_mmu_idx (arm_mmu_idx (env)); \ -MemOpIdx oi =make_memop_idx (MO_TE |MO_UL |MO_ALIGN , mmu_idx);\ +MemOpIdx oi =make_memop_idx (mo_endian (env) |MO_UL |MO_ALIGN , \ + mmu_idx); \for (beat =0 , y =0 ; beat <4 ; beat++, mask >>=4 , y ^=2 ) { \if ((mask &1 ) ==0 ) { \/* ECI says skip this beat */ \
@@ -466,7 +469,8 @@ DO_VSTR64_SG(vstrd_sg_wb_ud, ADDR_ADD, true)uint32_t *qd; \int y; \int mmu_idx =arm_to_core_mmu_idx (arm_mmu_idx (env)); \ -MemOpIdx oi =make_memop_idx (MO_TE |MO_UL |MO_ALIGN , mmu_idx);\ +MemOpIdx oi =make_memop_idx (mo_endian (env) |MO_UL |MO_ALIGN , \ + mmu_idx); \for (beat =0 ; beat <4 ; beat++, mask >>=4 ) { \if ((mask &1 ) ==0 ) { \/* ECI says skip this beat */ \
@@ -505,7 +509,8 @@ DO_VLD4W(vld43w, 6, 7, 8, 9)uint32_t addr, data; \uint8_t *qd; \int mmu_idx =arm_to_core_mmu_idx (arm_mmu_idx (env)); \ -MemOpIdx oi =make_memop_idx (MO_TE |MO_UL |MO_ALIGN , mmu_idx);\ +MemOpIdx oi =make_memop_idx (mo_endian (env) |MO_UL |MO_ALIGN , \ + mmu_idx); \for (beat =0 ; beat <4 ; beat++, mask >>=4 ) { \if ((mask &1 ) ==0 ) { \/* ECI says skip this beat */ \
@@ -531,7 +536,8 @@ DO_VLD4W(vld43w, 6, 7, 8, 9)int e; \uint16_t *qd; \int mmu_idx =arm_to_core_mmu_idx (arm_mmu_idx (env)); \ -MemOpIdx oi =make_memop_idx (MO_TE |MO_UL |MO_ALIGN , mmu_idx);\ +MemOpIdx oi =make_memop_idx (mo_endian (env) |MO_UL |MO_ALIGN , \ + mmu_idx); \for (beat =0 ; beat <4 ; beat++, mask >>=4 ) { \if ((mask &1 ) ==0 ) { \/* ECI says skip this beat */ \
@@ -556,7 +562,8 @@ DO_VLD4W(vld43w, 6, 7, 8, 9)uint32_t addr, data; \uint32_t *qd; \int mmu_idx =arm_to_core_mmu_idx (arm_mmu_idx (env)); \ -MemOpIdx oi =make_memop_idx (MO_TE |MO_UL |MO_ALIGN , mmu_idx);\ +MemOpIdx oi =make_memop_idx (mo_endian (env) |MO_UL |MO_ALIGN , \ + mmu_idx); \for (beat =0 ; beat <4 ; beat++, mask >>=4 ) { \if ((mask &1 ) ==0 ) { \/* ECI says skip this beat */ \
@@ -587,7 +594,8 @@ DO_VLD2W(vld21w, 8, 12, 16, 20)static const uint8_t off[4 ] = {O1 ,O2 ,O3 ,O4 }; \uint32_t addr, data; \int mmu_idx =arm_to_core_mmu_idx (arm_mmu_idx (env)); \ -MemOpIdx oi =make_memop_idx (MO_TE |MO_UL |MO_ALIGN , mmu_idx);\ +MemOpIdx oi =make_memop_idx (mo_endian (env) |MO_UL |MO_ALIGN , \ + mmu_idx); \for (beat =0 ; beat <4 ; beat++, mask >>=4 ) { \if ((mask &1 ) ==0 ) { \/* ECI says skip this beat */ \
@@ -614,7 +622,8 @@ DO_VLD2W(vld21w, 8, 12, 16, 20)int y;/* y counts 0 2 0 2 */ \uint16_t *qd; \int mmu_idx =arm_to_core_mmu_idx (arm_mmu_idx (env)); \ -MemOpIdx oi =make_memop_idx (MO_TE |MO_UL |MO_ALIGN , mmu_idx);\ +MemOpIdx oi =make_memop_idx (mo_endian (env) |MO_UL |MO_ALIGN , \ + mmu_idx); \for (beat =0 , y =0 ; beat <4 ; beat++, mask >>=4 , y ^=2 ) { \if ((mask &1 ) ==0 ) { \/* ECI says skip this beat */ \
@@ -640,7 +649,8 @@ DO_VLD2W(vld21w, 8, 12, 16, 20)uint32_t *qd; \int y; \int mmu_idx =arm_to_core_mmu_idx (arm_mmu_idx (env)); \ -MemOpIdx oi =make_memop_idx (MO_TE |MO_UL |MO_ALIGN , mmu_idx);\ +MemOpIdx oi =make_memop_idx (mo_endian (env) |MO_UL |MO_ALIGN , \ + mmu_idx); \for (beat =0 ; beat <4 ; beat++, mask >>=4 ) { \if ((mask &1 ) ==0 ) { \/* ECI says skip this beat */ \
@@ -679,7 +689,8 @@ DO_VST4W(vst43w, 6, 7, 8, 9)uint32_t addr, data; \uint8_t *qd; \int mmu_idx =arm_to_core_mmu_idx (arm_mmu_idx (env)); \ -MemOpIdx oi =make_memop_idx (MO_TE |MO_UL |MO_ALIGN , mmu_idx);\ +MemOpIdx oi =make_memop_idx (mo_endian (env) |MO_UL |MO_ALIGN , \ + mmu_idx); \for (beat =0 ; beat <4 ; beat++, mask >>=4 ) { \if ((mask &1 ) ==0 ) { \/* ECI says skip this beat */ \
@@ -706,7 +717,8 @@ DO_VST4W(vst43w, 6, 7, 8, 9)int e; \uint16_t *qd; \int mmu_idx =arm_to_core_mmu_idx (arm_mmu_idx (env)); \ -MemOpIdx oi =make_memop_idx (MO_TE |MO_UL |MO_ALIGN , mmu_idx);\ +MemOpIdx oi =make_memop_idx (mo_endian (env) |MO_UL |MO_ALIGN , \ + mmu_idx); \for (beat =0 ; beat <4 ; beat++, mask >>=4 ) { \if ((mask &1 ) ==0 ) { \/* ECI says skip this beat */ \
@@ -732,7 +744,8 @@ DO_VST4W(vst43w, 6, 7, 8, 9)uint32_t addr, data; \uint32_t *qd; \int mmu_idx =arm_to_core_mmu_idx (arm_mmu_idx (env)); \ -MemOpIdx oi =make_memop_idx (MO_TE |MO_UL |MO_ALIGN , mmu_idx);\ +MemOpIdx oi =make_memop_idx (mo_endian (env) |MO_UL |MO_ALIGN , \ + mmu_idx); \for (beat =0 ; beat <4 ; beat++, mask >>=4 ) { \if ((mask &1 ) ==0 ) { \/* ECI says skip this beat */ \
Signature · 1 line
2.53.0
PATCH v2 5/9 target/arm: Introduce mo_endian() helper
In reply to Philippe Mathieu-Daudé--- target/arm/internals.h | 6 ++++++ target/arm/tcg/mve_helper.c | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-)
target/arm/internals.h +6 -0
@@ -28,6 +28,7 @@#include "exec/hwaddr.h" #include "exec/vaddr.h" #include "exec/breakpoint.h" +#include "exec/memop.h" #include "accel/tcg/tb-cpu-state.h" #include "hw/core/registerfields.h" #include "tcg/tcg-gvec-desc.h"
@@ -46,6 +47,11 @@#define BANK_HYP 6#define BANK_MON 7 +static inline MemOp mo_endian (CPUARMState *env) +{ +return EX_TBFLAG_ANY (env->hflags,BE_DATA ) ?MO_BE :MO_LE ; +} +static inline int arm_env_mmu_index (CPUARMState *env) {return EX_TBFLAG_ANY (env->hflags,MMUIDX );
target/arm/tcg/mve_helper.c +2 -1
@@ -299,7 +299,8 @@ DO_VSTR(vstrh_w, MO_UW, 2, stw, 4, int32_t)unsigned e; \uint32_t addr; \int mmu_idx =arm_to_core_mmu_idx (arm_mmu_idx (env)); \ -MemOpIdx oi =make_memop_idx (MO_TE |MO_UL |MO_ALIGN , mmu_idx);\ +MemOpIdx oi =make_memop_idx (mo_endian (env) |MO_UL |MO_ALIGN , \ + mmu_idx); \for (e =0 ; e <16 /4 ; e++, mask >>=4 , eci_mask >>=4 ) { \if (!(eci_mask &1 )) { \continue ; \
Signature · 1 line
2.53.0
PATCH v2 9/9 target/arm: Compile m_helper.c once
In reply to Philippe Mathieu-Daudé--- target/arm/tcg/m_helper.c | 2 +- target/arm/tcg/meson.build | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)
target/arm/tcg/m_helper.c +1 -1
@@ -17,7 +17,7 @@#include "qemu/log.h" #include "exec/page-protection.h" #ifdef CONFIG_TCG -#include "accel/tcg/cpu-ldst.h" +#include "accel/tcg/cpu-ldst-common.h" #include "semihosting/common-semi.h" #endif #if !defined(CONFIG_USER_ONLY )
target/arm/tcg/meson.build +2 -1
@@ -32,7 +32,6 @@ arm_ss.add(when: 'TARGET_AARCH64', if_false: files('stubs32.c')) arm_ss.add(files( 'cpu32.c', - 'm_helper.c', )) arm_ss.add(when: 'TARGET_AARCH64', if_true: files(
@@ -70,6 +69,7 @@ arm_common_system_ss.add( 'debug.c', 'hflags.c', 'gengvec.c', + 'm_helper.c', 'mve_helper.c', 'neon_helper.c', 'op_helper.c',
@@ -94,6 +94,7 @@ arm_user_ss.add( 'debug.c', 'gengvec.c', 'hflags.c', + 'm_helper.c', 'mve_helper.c', 'neon_helper.c', 'op_helper.c',
Signature · 1 line
2.53.0
PATCH v2 8/9 target/arm: Replace MO_TE -> mo_endian() for Cortex-M helpers
In reply to Philippe Mathieu-Daudé--- target/arm/tcg/m_helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
target/arm/tcg/m_helper.c +3 -3
@@ -634,7 +634,7 @@ void HELPER(v7m_blxns)(CPUARMState *env, uint32_t dest)/* Note that these stores can throw exceptions on MPU faults */ ARMMMUIdx mmu_idx =arm_mmu_idx (env); -MemOpIdx oi =make_memop_idx (MO_TE |MO_UL |MO_ALIGN , +MemOpIdx oi =make_memop_idx (mo_endian (env) |MO_UL |MO_ALIGN ,arm_to_core_mmu_idx (mmu_idx));cpu_stl_mmu (env, sp, nextinst, oi,GETPC ());cpu_stl_mmu (env, sp +4 , saved_psr, oi,GETPC ());
@@ -1055,7 +1055,7 @@ void HELPER(v7m_vlstm)(CPUARMState *env, uint32_t fptr)bool lspact = env->v7m.fpccr[s] &R_V7M_FPCCR_LSPACT_MASK ;uintptr_t ra =GETPC ();ARMMMUIdx mmu_idx =arm_mmu_idx (env); -MemOpIdx oi =make_memop_idx (MO_TE |MO_UL |MO_ALIGN , +MemOpIdx oi =make_memop_idx (mo_endian (env) |MO_UL |MO_ALIGN ,arm_to_core_mmu_idx (mmu_idx));assert (env->v7m.secure);
@@ -1131,7 +1131,7 @@ void HELPER(v7m_vlldm)(CPUARMState *env, uint32_t fptr)ARMCPU *cpu =env_archcpu (env);uintptr_t ra =GETPC ();ARMMMUIdx mmu_idx =arm_mmu_idx (env); -MemOpIdx oi =make_memop_idx (MO_TE |MO_UL |MO_ALIGN , +MemOpIdx oi =make_memop_idx (mo_endian (env) |MO_UL |MO_ALIGN ,arm_to_core_mmu_idx (mmu_idx));/* fptr is the value of Rn, the frame pointer we load the FP regs from */
Signature · 1 line
2.53.0
PATCH v2 7/9 target/arm: Compile mve_helper.c once
In reply to Philippe Mathieu-Daudé--- target/arm/tcg/mve_helper.c | 2 +- target/arm/tcg/meson.build | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)
target/arm/tcg/mve_helper.c +1 -1
@@ -23,7 +23,7 @@#include "helper-mve.h" #include "internals.h" #include "vec_internal.h" -#include "accel/tcg/cpu-ldst.h" +#include "accel/tcg/cpu-ldst-common.h" #include "tcg/tcg.h" #include "fpu/softfloat.h" #include "crypto/clmul.h"
target/arm/tcg/meson.build +2 -1
@@ -33,7 +33,6 @@ arm_ss.add(when: 'TARGET_AARCH64', if_false: files('stubs32.c')) arm_ss.add(files( 'cpu32.c', 'm_helper.c', - 'mve_helper.c', )) arm_ss.add(when: 'TARGET_AARCH64', if_true: files(
@@ -71,6 +70,7 @@ arm_common_system_ss.add( 'debug.c', 'hflags.c', 'gengvec.c', + 'mve_helper.c', 'neon_helper.c', 'op_helper.c', 'psci.c',
@@ -94,6 +94,7 @@ arm_user_ss.add( 'debug.c', 'gengvec.c', 'hflags.c', + 'mve_helper.c', 'neon_helper.c', 'op_helper.c', 'tlb_helper.c',
Signature · 1 line
2.53.0
PATCH v2 1/9 target/arm: Ignore endianness when setting MTE tags
In reply to Philippe Mathieu-DaudéAs mentioned by Richard in [*]:
We don't actually need any specific endianness here, because every byte has the same value. So we could simply drop MO_TE. That would produce a store in host-endianness, which will be fractionally more efficient on some hosts.
[*] https://lore.kernel.org/qemu-devel/[email protected]/
--- target/arm/tcg/helper-a64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/arm/tcg/helper-a64.c +1 -1
@@ -1019,7 +1019,7 @@ static uint64_t set_step_tags(CPUARMState *env, uint64_t toaddr,* the page dirty and will use the fast path. */ uint64_t repldata = data *0x0101010101010101ULL ; -MemOpIdx oi16 =make_memop_idx (MO_TE |MO_128 , memidx); +MemOpIdx oi16 =make_memop_idx (MO_128 , memidx);cpu_st16_mmu (env, toaddr,int128_make128 (repldata, repldata), oi16, ra);mte_mops_set_tags (env, toaddr,16 , *mtedesc);return 16 ;
Signature · 1 line
2.53.0
Re: [PATCH v2 5/9] target/arm: Introduce mo_endian() helper
In reply to Philippe Mathieu-DaudéQuoted 6 lines · Philippe Mathieu-Daudé
Suggested-by Richard Henderson <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/arm/internals.h | 6 ++++++ target/arm/tcg/mve_helper.c | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-)
r~
Quoted 39 lines
target/arm/internals.h +6
-0@@ -28,6 +28,7 @@#include "exec/hwaddr.h" #include "exec/vaddr.h" #include "exec/breakpoint.h" +#include "exec/memop.h" #include "accel/tcg/tb-cpu-state.h" #include "hw/core/registerfields.h" #include "tcg/tcg-gvec-desc.h" @@ -46,6 +47,11 @@#define BANK_HYP 6#define BANK_MON 7 +static inline MemOp mo_endian (CPUARMState *env) +{ +return EX_TBFLAG_ANY (env->hflags,BE_DATA ) ?MO_BE :MO_LE ; +} +static inline int arm_env_mmu_index (CPUARMState *env) {return EX_TBFLAG_ANY (env->hflags,MMUIDX );target/arm/tcg/mve_helper.c +2
-1@@ -299,7 +299,8 @@ DO_VSTR(vstrh_w, MO_UW, 2, stw, 4, int32_t)unsigned e; \uint32_t addr; \int mmu_idx =arm_to_core_mmu_idx (arm_mmu_idx (env)); \ -MemOpIdx oi =make_memop_idx (MO_TE |MO_UL |MO_ALIGN , mmu_idx);\ +MemOpIdx oi =make_memop_idx (mo_endian (env) |MO_UL |MO_ALIGN , \ + mmu_idx); \for (e =0 ; e <16 /4 ; e++, mask >>=4 , eci_mask >>=4 ) { \if (!(eci_mask &1 )) { \continue ; \
Quoted 10 lines · Philippe Mathieu-Daudé
Philippe Mathieu-Daudé (9):
target/arm: Ignore endianness when setting MTE tags target/arm: ExplodeMO_TExx->MO_TE|MO_xxtarget/arm: HoistMO_TEintomve_advance_vpt()target/arm: HoistMO_TEinto MVEDO_VSTR()macro target/arm: Introducemo_endian()helper target/arm: ReplaceMO_TE->mo_endian()for MVE helpers target/arm: Compilemve_helper.conce
target/arm: ReplaceMO_TE->mo_endian()for Cortex-M helpers target/arm: Compilem_helper.conce
Series fully reviewed.
Quoted 13 lines · Philippe Mathieu-Daudé
Quoted 10 lines · Philippe Mathieu-Daudé
Philippe Mathieu-Daudé (9):
target/arm: Ignore endianness when setting MTE tags target/arm: ExplodeMO_TExx->MO_TE|MO_xxtarget/arm: HoistMO_TEintomve_advance_vpt()target/arm: HoistMO_TEinto MVEDO_VSTR()macro target/arm: Introducemo_endian()helper target/arm: ReplaceMO_TE->mo_endian()for MVE helpers target/arm: Compilemve_helper.conce
target/arm: ReplaceMO_TE->mo_endian()for Cortex-M helpers target/arm: Compilem_helper.conce
Quoted 1 line
Series fully reviewed.
Checking as of master=aa15257174d, this series still applies cleanly.
Peter Maydell
AppliedQuoted 15 lines · Philippe Mathieu-Daudé
Quoted 13 lines · Philippe Mathieu-Daudé
Quoted 10 lines · Philippe Mathieu-Daudé
Philippe Mathieu-Daudé (9):
target/arm: Ignore endianness when setting MTE tags target/arm: ExplodeMO_TExx->MO_TE|MO_xxtarget/arm: HoistMO_TEintomve_advance_vpt()target/arm: HoistMO_TEinto MVEDO_VSTR()macro target/arm: Introducemo_endian()helper target/arm: ReplaceMO_TE->mo_endian()for MVE helpers target/arm: Compilemve_helper.conce
target/arm: ReplaceMO_TE->mo_endian()for Cortex-M helpers target/arm: Compilem_helper.conce
Quoted 3 lines
Quoted 1 line
Series fully reviewed.
Checking as of master=aa15257174d, this series still applies cleanly.
Applied to target-arm.next, thanks.
-- PMM