target/arm/tcg: Remove inclusions of 'exec/helper-[proto/gen].h'
cover target/arm/tcg: Remove inclusions of 'exec/helper-[proto/gen].h'
Hi,
This series tries to do what Richard suggested in [*]:
Targets that have a tcg/ subdir should have helper.h.inc moved into there. At the end, include/exec/helper-gen.h and include/exec/helper-proto.h become unused and go away.
but only for the ARM target, to first see if this is heading in the correct direction.
Instead of having TCG generated helpers included by all translate/helper units, they are reduced to the few places really needing them. I expect the build step to be slighly improved, since the compiler doesn't have to compile and track unused helpers definitions.
[*] https://lore.kernel.org/qemu-devel/[email protected]/
Philippe Mathieu-Daudé (22):
plugins: Remove unused 'exec/helper-proto.h' header accel/tcg/cpu-exec: Use generic 'helper-proto-common.h' header target/arm/tcg: Remove CONFIG_TCG #ifdef'ry check target/arm/tcg: Rename helper template headers as '.h.inc' target/arm/tcg: Extract iwMMXt helpers from the generic 'helper.h' target/arm/tcg: Fix iwmmxt-related code style target/arm/tcg: Expose some iwmmxt methods in 'translate.h' target/arm/tcg: Extract iwmmxt code to translate-iwmmxt.c target/arm/tcg: Reduce 'helper-iwmmxt.h.inc' inclusion target/arm/tcg: Extract VFP definitions to 'helper-vfp.h.inc' target/arm/tcg: Reduce 'helper-vfp.h.inc' inclusion target/arm/tcg: Move neon_tbl() from op_helper.c to neon_helper.c target/arm/tcg: Extract NEON definitions to 'helper-neon.h.inc' target/arm/tcg: Reduce 'helper-neon.h.inc' inclusion target/arm/tcg: Extract SVE2 definitions to 'helper-sve.h.inc' target/arm/tcg: Reduce 'helper-sve.h.inc' inclusion target/arm/tcg: Reduce 'helper-mve.h.inc' inclusion target/arm/tcg: Define SME set_svcr() helper in common 'helper.h' target/arm/tcg: Reduce 'helper-sme.h.inc' inclusion target/arm/tcg: Reduce 'helper-a64.h.inc' inclusion target/arm/tcg: Remove inclusions of 'exec/helper-[proto/gen].h' tests/tcg/aarch64: Rename bti-crt.inc.c -> bti-crt.c.inc
target/arm/tcg/translate.h | 11 +-
.../tcg/{helper-a64.h => helper-a64.h.inc} | 0
target/arm/tcg/helper-iwmmxt.h.inc | 114 ++
.../tcg/{helper-mve.h => helper-mve.h.inc} | 0
target/arm/tcg/helper-neon.h.inc | 205 +++
.../tcg/{helper-sme.h => helper-sme.h.inc} | 2 -
.../tcg/{helper-sve.h => helper-sve.h.inc} | 46 +
target/arm/tcg/helper-vfp.h.inc | 136 ++
target/arm/{helper.h => tcg/helper.h.inc} | 488 +-----
accel/tcg/cpu-exec.c | 2 +-
plugins/core.c | 1 -
target/arm/debug_helper.c | 7 +-
target/arm/helper.c | 7 +-
target/arm/tcg/cpu32.c | 4 +-
target/arm/tcg/crypto_helper.c | 6 +-
target/arm/tcg/helper-a64.c | 11 +-
target/arm/tcg/hflags.c | 6 +-
target/arm/tcg/iwmmxt_helper.c | 6 +-
target/arm/tcg/m_helper.c | 12 +-
target/arm/tcg/mte_helper.c | 5 +-
target/arm/tcg/mve_helper.c | 16 +-
target/arm/tcg/neon_helper.c | 28 +-
target/arm/tcg/op_helper.c | 28 +-
target/arm/tcg/pauth_helper.c | 5 +-
target/arm/tcg/psci.c | 6 +-
target/arm/tcg/sme_helper.c | 11 +-
target/arm/tcg/sve_helper.c | 20 +-
target/arm/tcg/tlb_helper.c | 5 +-
target/arm/tcg/translate-a64.c | 16 +
target/arm/tcg/translate-iwmmxt.c | 1340 +++++++++++++++++
target/arm/tcg/translate-mve.c | 6 +
target/arm/tcg/translate-neon.c | 11 +
target/arm/tcg/translate-sme.c | 16 +
target/arm/tcg/translate-sve.c | 5 +
target/arm/tcg/translate-vfp.c | 6 +
target/arm/tcg/translate.c | 1274 +---------------
target/arm/tcg/vec_helper.c | 26 +-
target/arm/vfp_helper.c | 11 +-
tests/tcg/aarch64/bti-1.c | 2 +-
tests/tcg/aarch64/bti-3.c | 2 +-
.../aarch64/{bti-crt.inc.c => bti-crt.c.inc} | 0
target/arm/tcg/meson.build | 1 +
42 files changed, 2100 insertions(+), 1804 deletions(-)
rename target/arm/tcg/{helper-a64.h => helper-a64.h.inc} (100%)
create mode 100644 target/arm/tcg/helper-iwmmxt.h.inc
rename target/arm/tcg/{helper-mve.h => helper-mve.h.inc} (100%)
create mode 100644 target/arm/tcg/helper-neon.h.inc
rename target/arm/tcg/{helper-sme.h => helper-sme.h.inc} (99%)
rename target/arm/tcg/{helper-sve.h => helper-sve.h.inc} (98%)
create mode 100644 target/arm/tcg/helper-vfp.h.inc
rename target/arm/{helper.h => tcg/helper.h.inc} (56%)
create mode 100644 target/arm/tcg/translate-iwmmxt.c
rename tests/tcg/aarch64/{bti-crt.inc.c => bti-crt.c.inc} (100%)Signature · 1 line
2.38.1
PATCH 1/22 plugins: Remove unused 'exec/helper-proto.h' header
--- plugins/core.c | 1 - 1 file changed, 1 deletion(-)
plugins/core.c +0 -1
@@ -25,7 +25,6 @@#include "exec/exec-all.h" #include "exec/tb-flush.h" -#include "exec/helper-proto.h" #include "tcg/tcg.h" #include "tcg/tcg-op.h" #include "plugin.h"
Signature · 1 line
2.38.1
Re: [PATCH 01/22] plugins: Remove unused 'exec/helper-proto.h' header
Quoted 4 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- plugins/core.c | 1 - 1 file changed, 1 deletion(-)
r~
PATCH 2/22 accel/tcg/cpu-exec: Use generic 'helper-proto-common.h' header
In reply to Philippe Mathieu-DaudéWe only need lookup_tb_ptr() typedef.
--- accel/tcg/cpu-exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
accel/tcg/cpu-exec.c +1 -1
@@ -38,7 +38,7 @@#include "sysemu/cpu-timers.h" #include "exec/replay-core.h" #include "sysemu/tcg.h" -#include "exec/helper-proto.h" +#include "exec/helper-proto-common.h" #include "tb-jmp-cache.h" #include "tb-hash.h" #include "tb-context.h"
Signature · 1 line
2.38.1
Re: [PATCH 02/22] accel/tcg/cpu-exec: Use generic 'helper-proto-common.h' header
Quoted 6 lines · Philippe Mathieu-Daudé
We only need
lookup_tb_ptr()typedef.Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- accel/tcg/cpu-exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
prototype, not typedef.
r~
PATCH 3/22 target/arm/tcg: Remove CONFIG_TCG #ifdef'ry check
In reply to Philippe Mathieu-DaudéCONFIG_TCG is always defined within target/arm/tcg/.
--- target/arm/tcg/cpu32.c | 4 +--- target/arm/tcg/m_helper.c | 6 ------ 2 files changed, 1 insertion(+), 9 deletions(-)
target/arm/tcg/cpu32.c +1 -3
@@ -13,11 +13,9 @@#include "hw/core/tcg-cpu-ops.h" #include "internals.h" #include "target/arm/idau.h" +#include "cpregs.h" #if !defined(CONFIG_USER_ONLY )#include "hw/boards.h" -#endif -#include "cpregs.h" -#if !defined(CONFIG_USER_ONLY ) && defined(CONFIG_TCG )#include "hw/intc/armv7m_nvic.h" #endif
target/arm/tcg/m_helper.c +0 -6
@@ -15,10 +15,8 @@#include "qemu/bitops.h" #include "qemu/log.h" #include "exec/exec-all.h" -#ifdef CONFIG_TCG #include "exec/cpu_ldst.h" #include "semihosting/common-semi.h" -#endif #if !defined(CONFIG_USER_ONLY )#include "hw/intc/armv7m_nvic.h" #endif
@@ -2345,11 +2343,7 @@ void arm_v7m_cpu_do_interrupt(CPUState *cs)qemu_log_mask (CPU_LOG_INT ,"...handling as semihosting call 0x%x\n" , env->regs[0 ]); -#ifdef CONFIG_TCG do_common_semihosting (cs); -#else -g_assert_not_reached (); -#endif env->regs[15 ] += env->thumb ?2 :4 ;return ;case EXCP_BKPT :
Signature · 1 line
2.38.1
Re: [PATCH 03/22] target/arm/tcg: Remove CONFIG_TCG #ifdef'ry check
Quoted 7 lines · Philippe Mathieu-Daudé
CONFIG_TCGis always defined within target/arm/tcg/.Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- target/arm/tcg/cpu32.c | 4 +--- target/arm/tcg/m_helper.c | 6 ------ 2 files changed, 1 insertion(+), 9 deletions(-)
r~
PATCH 4/22 target/arm/tcg: Rename helper template headers as '.h.inc'
In reply to Philippe Mathieu-DaudéSince commit 139c1837db ("meson: rename included C source files to .c.inc"), QEMU standard procedure for included C files is to use *.c.inc.
Besides, since commit 6a0057aa22 ("docs/devel: make a statement about includes") this is documented as the Coding Style:
If you do use template header files they should be named with the ``.c.inc`` or ``.h.inc`` suffix to make it clear they are being included for expansion.
Therefore rename the included templates as '.h.inc'.
---
target/arm/helper.h | 8 ++++----
target/arm/tcg/{helper-a64.h => helper-a64.h.inc} | 0
target/arm/tcg/{helper-mve.h => helper-mve.h.inc} | 0
target/arm/tcg/{helper-sme.h => helper-sme.h.inc} | 0
target/arm/tcg/{helper-sve.h => helper-sve.h.inc} | 0
5 files changed, 4 insertions(+), 4 deletions(-)
rename target/arm/tcg/{helper-a64.h => helper-a64.h.inc} (100%)
rename target/arm/tcg/{helper-mve.h => helper-mve.h.inc} (100%)
rename target/arm/tcg/{helper-sme.h => helper-sme.h.inc} (100%)
rename target/arm/tcg/{helper-sve.h => helper-sve.h.inc} (100%)target/arm/helper.h +4 -4
@@ -1039,9 +1039,9 @@ DEF_HELPER_FLAGS_5(gvec_uclamp_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) #ifdef TARGET_AARCH64 -#include "tcg/helper-a64.h" -#include "tcg/helper-sve.h" -#include "tcg/helper-sme.h" +#include "tcg/helper-a64.h.inc" +#include "tcg/helper-sve.h.inc" +#include "tcg/helper-sme.h.inc" #endif -#include "tcg/helper-mve.h" +#include "tcg/helper-mve.h.inc"
target/arm/tcg/helper-a64.h.inc renamed from target/arm/tcg/helper-a64.h +0 -0
target/arm/tcg/helper-mve.h.inc renamed from target/arm/tcg/helper-mve.h +0 -0
target/arm/tcg/helper-sme.h.inc renamed from target/arm/tcg/helper-sme.h +0 -0
target/arm/tcg/helper-sve.h.inc renamed from target/arm/tcg/helper-sve.h +0 -0
Signature · 1 line
2.38.1
PATCH 5/22 target/arm/tcg: Extract iwMMXt helpers from the generic 'helper.h'
In reply to Philippe Mathieu-Daudé--- target/arm/helper.h | 96 +----------------------- target/arm/tcg/helper-iwmmxt.h.inc | 114 +++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+), 95 deletions(-) create mode 100644 target/arm/tcg/helper-iwmmxt.h.inc
target/arm/helper.h +1 -95
@@ -445,101 +445,6 @@ DEF_HELPER_3(neon_acgt_f32, i32, i32, i32, ptr) DEF_HELPER_3(neon_acge_f64, i64, i64, i64, ptr) DEF_HELPER_3(neon_acgt_f64, i64, i64, i64, ptr) -/* iwmmxt_helper.c */ -DEF_HELPER_2(iwmmxt_maddsq, i64, i64, i64) -DEF_HELPER_2(iwmmxt_madduq, i64, i64, i64) -DEF_HELPER_2(iwmmxt_sadb, i64, i64, i64) -DEF_HELPER_2(iwmmxt_sadw, i64, i64, i64) -DEF_HELPER_2(iwmmxt_mulslw, i64, i64, i64) -DEF_HELPER_2(iwmmxt_mulshw, i64, i64, i64) -DEF_HELPER_2(iwmmxt_mululw, i64, i64, i64) -DEF_HELPER_2(iwmmxt_muluhw, i64, i64, i64) -DEF_HELPER_2(iwmmxt_macsw, i64, i64, i64) -DEF_HELPER_2(iwmmxt_macuw, i64, i64, i64) -DEF_HELPER_1(iwmmxt_setpsr_nz, i32, i64) - -#define DEF_IWMMXT_HELPER_SIZE_ENV (name) \ -DEF_HELPER_3(iwmmxt_##name##b, i64, env, i64, i64) \ -DEF_HELPER_3(iwmmxt_##name##w, i64, env, i64, i64) \ -DEF_HELPER_3(iwmmxt_##name##l, i64, env, i64, i64) \ - -DEF_IWMMXT_HELPER_SIZE_ENV(unpackl) -DEF_IWMMXT_HELPER_SIZE_ENV(unpackh) - -DEF_HELPER_2(iwmmxt_unpacklub, i64, env, i64) -DEF_HELPER_2(iwmmxt_unpackluw, i64, env, i64) -DEF_HELPER_2(iwmmxt_unpacklul, i64, env, i64) -DEF_HELPER_2(iwmmxt_unpackhub, i64, env, i64) -DEF_HELPER_2(iwmmxt_unpackhuw, i64, env, i64) -DEF_HELPER_2(iwmmxt_unpackhul, i64, env, i64) -DEF_HELPER_2(iwmmxt_unpacklsb, i64, env, i64) -DEF_HELPER_2(iwmmxt_unpacklsw, i64, env, i64) -DEF_HELPER_2(iwmmxt_unpacklsl, i64, env, i64) -DEF_HELPER_2(iwmmxt_unpackhsb, i64, env, i64) -DEF_HELPER_2(iwmmxt_unpackhsw, i64, env, i64) -DEF_HELPER_2(iwmmxt_unpackhsl, i64, env, i64) - -DEF_IWMMXT_HELPER_SIZE_ENV(cmpeq) -DEF_IWMMXT_HELPER_SIZE_ENV(cmpgtu) -DEF_IWMMXT_HELPER_SIZE_ENV(cmpgts) - -DEF_IWMMXT_HELPER_SIZE_ENV(mins) -DEF_IWMMXT_HELPER_SIZE_ENV(minu) -DEF_IWMMXT_HELPER_SIZE_ENV(maxs) -DEF_IWMMXT_HELPER_SIZE_ENV(maxu) - -DEF_IWMMXT_HELPER_SIZE_ENV(subn) -DEF_IWMMXT_HELPER_SIZE_ENV(addn) -DEF_IWMMXT_HELPER_SIZE_ENV(subu) -DEF_IWMMXT_HELPER_SIZE_ENV(addu) -DEF_IWMMXT_HELPER_SIZE_ENV(subs) -DEF_IWMMXT_HELPER_SIZE_ENV(adds) - -DEF_HELPER_3(iwmmxt_avgb0, i64, env, i64, i64) -DEF_HELPER_3(iwmmxt_avgb1, i64, env, i64, i64) -DEF_HELPER_3(iwmmxt_avgw0, i64, env, i64, i64) -DEF_HELPER_3(iwmmxt_avgw1, i64, env, i64, i64) - -DEF_HELPER_3(iwmmxt_align, i64, i64, i64, i32) -DEF_HELPER_4(iwmmxt_insr, i64, i64, i32, i32, i32) - -DEF_HELPER_1(iwmmxt_bcstb, i64, i32) -DEF_HELPER_1(iwmmxt_bcstw, i64, i32) -DEF_HELPER_1(iwmmxt_bcstl, i64, i32) - -DEF_HELPER_1(iwmmxt_addcb, i64, i64) -DEF_HELPER_1(iwmmxt_addcw, i64, i64) -DEF_HELPER_1(iwmmxt_addcl, i64, i64) - -DEF_HELPER_1(iwmmxt_msbb, i32, i64) -DEF_HELPER_1(iwmmxt_msbw, i32, i64) -DEF_HELPER_1(iwmmxt_msbl, i32, i64) - -DEF_HELPER_3(iwmmxt_srlw, i64, env, i64, i32) -DEF_HELPER_3(iwmmxt_srll, i64, env, i64, i32) -DEF_HELPER_3(iwmmxt_srlq, i64, env, i64, i32) -DEF_HELPER_3(iwmmxt_sllw, i64, env, i64, i32) -DEF_HELPER_3(iwmmxt_slll, i64, env, i64, i32) -DEF_HELPER_3(iwmmxt_sllq, i64, env, i64, i32) -DEF_HELPER_3(iwmmxt_sraw, i64, env, i64, i32) -DEF_HELPER_3(iwmmxt_sral, i64, env, i64, i32) -DEF_HELPER_3(iwmmxt_sraq, i64, env, i64, i32) -DEF_HELPER_3(iwmmxt_rorw, i64, env, i64, i32) -DEF_HELPER_3(iwmmxt_rorl, i64, env, i64, i32) -DEF_HELPER_3(iwmmxt_rorq, i64, env, i64, i32) -DEF_HELPER_3(iwmmxt_shufh, i64, env, i64, i32) - -DEF_HELPER_3(iwmmxt_packuw, i64, env, i64, i64) -DEF_HELPER_3(iwmmxt_packul, i64, env, i64, i64) -DEF_HELPER_3(iwmmxt_packuq, i64, env, i64, i64) -DEF_HELPER_3(iwmmxt_packsw, i64, env, i64, i64) -DEF_HELPER_3(iwmmxt_packsl, i64, env, i64, i64) -DEF_HELPER_3(iwmmxt_packsq, i64, env, i64, i64) - -DEF_HELPER_3(iwmmxt_muladdsl, i64, i64, i32, i32) -DEF_HELPER_3(iwmmxt_muladdsw, i64, i64, i32, i32) -DEF_HELPER_3(iwmmxt_muladdswl, i64, i64, i32, i32) - DEF_HELPER_FLAGS_2(neon_unzip8, TCG_CALL_NO_RWG, void, ptr, ptr) DEF_HELPER_FLAGS_2(neon_unzip16, TCG_CALL_NO_RWG, void, ptr, ptr)DEF_HELPER_FLAGS_2 (neon_qunzip8,TCG_CALL_NO_RWG , void, ptr, ptr)
@@ -1044,4 +949,5 @@ DEF_HELPER_FLAGS_5(gvec_uclamp_d, TCG_CALL_NO_RWG,#include "tcg/helper-sme.h.inc" #endif +#include "tcg/helper-iwmmxt.h.inc" #include "tcg/helper-mve.h.inc"
target/arm/tcg/helper-iwmmxt.h.inc new file +114 -0
114 lines not on this page · raw message
Signature · 1 line
2.38.1
Re: [PATCH 05/22] target/arm/tcg: Extract iwMMXt helpers from the generic 'helper.h'
Quoted 6 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- target/arm/helper.h | 96 +----------------------- target/arm/tcg/helper-iwmmxt.h.inc | 114 +++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+), 95 deletions(-)create mode 100644 target/arm/tcg/helper-iwmmxt.h.inc
r~
PATCH 6/22 target/arm/tcg: Fix iwmmxt-related code style
In reply to Philippe Mathieu-DaudéIn order to be able to move the iwmmxt-related code, fix its style to avoid:
ERROR: braces {} are necessary for all arms of this statement
ERROR: space prohibited before that '++' (ctx:WxB)
--- target/arm/tcg/translate.c | 227 +++++++++++++++++++++++-------------- 1 file changed, 141 insertions(+), 86 deletions(-)
target/arm/tcg/translate.c +141 -86
@@ -1441,10 +1441,11 @@ static inline int gen_iwmmxt_address(DisasContext *s, uint32_t insn, offset = (insn &0xff ) << ((insn >>7 ) &2 );if (insn & (1 <<24 )) {/* Pre indexed */ -if (insn & (1 <<23 )) +if (insn & (1 <<23 )) {tcg_gen_addi_i32 (tmp, tmp, offset); -else + }else {tcg_gen_addi_i32 (tmp, tmp, -offset); + }tcg_gen_mov_i32 (dest, tmp);if (insn & (1 <<21 )) {store_reg (s, rd, tmp);
@@ -1452,13 +1453,15 @@ static inline int gen_iwmmxt_address(DisasContext *s, uint32_t insn, }else if (insn & (1 <<21 )) {/* Post indexed */ tcg_gen_mov_i32 (dest, tmp); -if (insn & (1 <<23 )) +if (insn & (1 <<23 )) {tcg_gen_addi_i32 (tmp, tmp, offset); -else + }else {tcg_gen_addi_i32 (tmp, tmp, -offset); + }store_reg (s, rd, tmp); - }else if (!(insn & (1 <<23 ))) + }else if (!(insn & (1 <<23 ))) {return 1 ; + }return 0 ; }
@@ -1483,8 +1486,10 @@ static inline int gen_iwmmxt_shift(uint32_t insn, uint32_t mask, TCGv_i32 dest)return 0 ; } -/* Disassemble an iwMMXt instruction. Returns nonzero if an error occurred -(ie. an undefined instruction). */ +/* +* Disassemble an iwMMXt instruction. +* Returns nonzero if an error occurred (ie. an undefined instruction). +*/ static int disas_iwmmxt_insn (DisasContext *s,uint32_t insn) {int rd, wrd;
@@ -1570,8 +1575,9 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)return 0 ; } -if ((insn &0x0f000000 ) !=0x0e000000 ) +if ((insn &0x0f000000 ) !=0x0e000000 ) {return 1 ; + }switch (((insn >>12 ) &0xf00 ) | ((insn >>4 ) &0xff )) {case 0x000 :/* WOR */
@@ -1586,8 +1592,9 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_op_iwmmxt_set_cup ();break ;case 0x011 :/* TMCR */ -if (insn &0xf ) +if (insn &0xf ) {return 1 ; + } rd = (insn >>12 ) &0xf ; wrd = (insn >>16 ) &0xf ;switch (wrd) {
@@ -1627,8 +1634,9 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_op_iwmmxt_set_cup ();break ;case 0x111 :/* TMRC */ -if (insn &0xf ) +if (insn &0xf ) {return 1 ; + } rd = (insn >>12 ) &0xf ; wrd = (insn >>16 ) &0xf ; tmp =iwmmxt_load_creg (wrd);
@@ -1662,10 +1670,11 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn) rd0 = (insn >>0 ) &0xf ; rd1 = (insn >>16 ) &0xf ;gen_op_iwmmxt_movq_M0_wRn (rd0); -if (insn & (1 <<21 )) +if (insn & (1 <<21 )) {gen_op_iwmmxt_maddsq_M0_wRn (rd1); -else + }else {gen_op_iwmmxt_madduq_M0_wRn (rd1); + }gen_op_iwmmxt_movq_wRn_M0 (wrd);gen_op_iwmmxt_set_mup ();break ;
@@ -1718,12 +1727,14 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn) rd0 = (insn >>16 ) &0xf ; rd1 = (insn >>0 ) &0xf ;gen_op_iwmmxt_movq_M0_wRn (rd0); -if (insn & (1 <<22 )) +if (insn & (1 <<22 )) {gen_op_iwmmxt_sadw_M0_wRn (rd1); -else + }else {gen_op_iwmmxt_sadb_M0_wRn (rd1); -if (!(insn & (1 <<20 ))) + } +if (!(insn & (1 <<20 ))) {gen_op_iwmmxt_addl_M0_wRn (wrd); + }gen_op_iwmmxt_movq_wRn_M0 (wrd);gen_op_iwmmxt_set_mup ();break ;
@@ -1733,15 +1744,17 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn) rd1 = (insn >>0 ) &0xf ;gen_op_iwmmxt_movq_M0_wRn (rd0);if (insn & (1 <<21 )) { -if (insn & (1 <<20 )) +if (insn & (1 <<20 )) {gen_op_iwmmxt_mulshw_M0_wRn (rd1); -else + }else {gen_op_iwmmxt_mulslw_M0_wRn (rd1); + } }else { -if (insn & (1 <<20 )) +if (insn & (1 <<20 )) {gen_op_iwmmxt_muluhw_M0_wRn (rd1); -else + }else {gen_op_iwmmxt_mululw_M0_wRn (rd1); + } }gen_op_iwmmxt_movq_wRn_M0 (wrd);gen_op_iwmmxt_set_mup ();
@@ -1751,10 +1764,11 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn) rd0 = (insn >>16 ) &0xf ; rd1 = (insn >>0 ) &0xf ;gen_op_iwmmxt_movq_M0_wRn (rd0); -if (insn & (1 <<21 )) +if (insn & (1 <<21 )) {gen_op_iwmmxt_macsw_M0_wRn (rd1); -else + }else {gen_op_iwmmxt_macuw_M0_wRn (rd1); + }if (!(insn & (1 <<20 ))) {iwmmxt_load_reg (cpu_V1, wrd);tcg_gen_add_i64 (cpu_M0, cpu_M0, cpu_V1);
@@ -1790,15 +1804,17 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn) rd1 = (insn >>0 ) &0xf ;gen_op_iwmmxt_movq_M0_wRn (rd0);if (insn & (1 <<22 )) { -if (insn & (1 <<20 )) +if (insn & (1 <<20 )) {gen_op_iwmmxt_avgw1_M0_wRn (rd1); -else + }else {gen_op_iwmmxt_avgw0_M0_wRn (rd1); + } }else { -if (insn & (1 <<20 )) +if (insn & (1 <<20 )) {gen_op_iwmmxt_avgb1_M0_wRn (rd1); -else + }else {gen_op_iwmmxt_avgb0_M0_wRn (rd1); + } }gen_op_iwmmxt_movq_wRn_M0 (wrd);gen_op_iwmmxt_set_mup ();
@@ -1817,8 +1833,9 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_op_iwmmxt_set_mup ();break ;case 0x601 :case 0x605 :case 0x609 :case 0x60d :/* TINSR */ -if (((insn >>6 ) &3 ) ==3 ) +if (((insn >>6 ) &3 ) ==3 ) {return 1 ; + } rd = (insn >>12 ) &0xf ; wrd = (insn >>16 ) &0xf ; tmp =load_reg (s, rd);
@@ -1846,8 +1863,9 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)case 0x107 :case 0x507 :case 0x907 :case 0xd07 :/* TEXTRM */ rd = (insn >>12 ) &0xf ; wrd = (insn >>16 ) &0xf ; -if (rd ==15 || ((insn >>22 ) &3 ) ==3 ) +if (rd ==15 || ((insn >>22 ) &3 ) ==3 ) {return 1 ; + }gen_op_iwmmxt_movq_M0_wRn (wrd); tmp =tcg_temp_new_i32 ();switch ((insn >>22 ) &3 ) {
@@ -1877,8 +1895,9 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)store_reg (s, rd, tmp);break ;case 0x117 :case 0x517 :case 0x917 :case 0xd17 :/* TEXTRC */ -if ((insn &0x000ff008 ) !=0x0003f000 || ((insn >>22 ) &3 ) ==3 ) +if ((insn &0x000ff008 ) !=0x0003f000 || ((insn >>22 ) &3 ) ==3 ) {return 1 ; + } tmp =iwmmxt_load_creg (ARM_IWMMXT_wCASF);switch ((insn >>22 ) &3 ) {case 0 :
@@ -1895,8 +1914,9 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_set_nzcv (tmp);break ;case 0x401 :case 0x405 :case 0x409 :case 0x40d :/* TBCST */ -if (((insn >>6 ) &3 ) ==3 ) +if (((insn >>6 ) &3 ) ==3 ) {return 1 ; + } rd = (insn >>12 ) &0xf ; wrd = (insn >>16 ) &0xf ; tmp =load_reg (s, rd);
@@ -1915,20 +1935,21 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_op_iwmmxt_set_mup ();break ;case 0x113 :case 0x513 :case 0x913 :case 0xd13 :/* TANDC */ -if ((insn &0x000ff00f ) !=0x0003f000 || ((insn >>22 ) &3 ) ==3 ) +if ((insn &0x000ff00f ) !=0x0003f000 || ((insn >>22 ) &3 ) ==3 ) {return 1 ; + } tmp =iwmmxt_load_creg (ARM_IWMMXT_wCASF); tmp2 =tcg_temp_new_i32 ();tcg_gen_mov_i32 (tmp2, tmp);switch ((insn >>22 ) &3 ) {case 0 : -for (i =0 ; i <7 ; i ++) { +for (i =0 ; i <7 ; i++) {tcg_gen_shli_i32 (tmp2, tmp2,4 );tcg_gen_and_i32 (tmp, tmp, tmp2); }break ;case 1 : -for (i =0 ; i <3 ; i ++) { +for (i =0 ; i <3 ; i++) {tcg_gen_shli_i32 (tmp2, tmp2,8 );tcg_gen_and_i32 (tmp, tmp, tmp2); }
@@ -1961,20 +1982,21 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_op_iwmmxt_set_mup ();break ;case 0x115 :case 0x515 :case 0x915 :case 0xd15 :/* TORC */ -if ((insn &0x000ff00f ) !=0x0003f000 || ((insn >>22 ) &3 ) ==3 ) +if ((insn &0x000ff00f ) !=0x0003f000 || ((insn >>22 ) &3 ) ==3 ) {return 1 ; + } tmp =iwmmxt_load_creg (ARM_IWMMXT_wCASF); tmp2 =tcg_temp_new_i32 ();tcg_gen_mov_i32 (tmp2, tmp);switch ((insn >>22 ) &3 ) {case 0 : -for (i =0 ; i <7 ; i ++) { +for (i =0 ; i <7 ; i++) {tcg_gen_shli_i32 (tmp2, tmp2,4 );tcg_gen_or_i32 (tmp, tmp, tmp2); }break ;case 1 : -for (i =0 ; i <3 ; i ++) { +for (i =0 ; i <3 ; i++) {tcg_gen_shli_i32 (tmp2, tmp2,8 );tcg_gen_or_i32 (tmp, tmp, tmp2); }
@@ -1989,8 +2011,9 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)case 0x103 :case 0x503 :case 0x903 :case 0xd03 :/* TMOVMSK */ rd = (insn >>12 ) &0xf ; rd0 = (insn >>16 ) &0xf ; -if ((insn &0xf ) !=0 || ((insn >>22 ) &3 ) ==3 ) +if ((insn &0xf ) !=0 || ((insn >>22 ) &3 ) ==3 ) {return 1 ; + }gen_op_iwmmxt_movq_M0_wRn (rd0); tmp =tcg_temp_new_i32 ();switch ((insn >>22 ) &3 ) {
@@ -2014,22 +2037,25 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_op_iwmmxt_movq_M0_wRn (rd0);switch ((insn >>22 ) &3 ) {case 0 : -if (insn & (1 <<21 )) +if (insn & (1 <<21 )) {gen_op_iwmmxt_cmpgtsb_M0_wRn (rd1); -else + }else {gen_op_iwmmxt_cmpgtub_M0_wRn (rd1); + }break ;case 1 : -if (insn & (1 <<21 )) +if (insn & (1 <<21 )) {gen_op_iwmmxt_cmpgtsw_M0_wRn (rd1); -else + }else {gen_op_iwmmxt_cmpgtuw_M0_wRn (rd1); + }break ;case 2 : -if (insn & (1 <<21 )) +if (insn & (1 <<21 )) {gen_op_iwmmxt_cmpgtsl_M0_wRn (rd1); -else + }else {gen_op_iwmmxt_cmpgtul_M0_wRn (rd1); + }break ;case 3 :return 1 ;
@@ -2045,22 +2071,25 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_op_iwmmxt_movq_M0_wRn (rd0);switch ((insn >>22 ) &3 ) {case 0 : -if (insn & (1 <<21 )) +if (insn & (1 <<21 )) {gen_op_iwmmxt_unpacklsb_M0 (); -else + }else {gen_op_iwmmxt_unpacklub_M0 (); + }break ;case 1 : -if (insn & (1 <<21 )) +if (insn & (1 <<21 )) {gen_op_iwmmxt_unpacklsw_M0 (); -else + }else {gen_op_iwmmxt_unpackluw_M0 (); + }break ;case 2 : -if (insn & (1 <<21 )) +if (insn & (1 <<21 )) {gen_op_iwmmxt_unpacklsl_M0 (); -else + }else {gen_op_iwmmxt_unpacklul_M0 (); + }break ;case 3 :return 1 ;
@@ -2076,22 +2105,25 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_op_iwmmxt_movq_M0_wRn (rd0);switch ((insn >>22 ) &3 ) {case 0 : -if (insn & (1 <<21 )) +if (insn & (1 <<21 )) {gen_op_iwmmxt_unpackhsb_M0 (); -else + }else {gen_op_iwmmxt_unpackhub_M0 (); + }break ;case 1 : -if (insn & (1 <<21 )) +if (insn & (1 <<21 )) {gen_op_iwmmxt_unpackhsw_M0 (); -else + }else {gen_op_iwmmxt_unpackhuw_M0 (); + }break ;case 2 : -if (insn & (1 <<21 )) +if (insn & (1 <<21 )) {gen_op_iwmmxt_unpackhsl_M0 (); -else + }else {gen_op_iwmmxt_unpackhul_M0 (); + }break ;case 3 :return 1 ;
@@ -2102,8 +2134,9 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)break ;case 0x204 :case 0x604 :case 0xa04 :case 0xe04 :/* WSRL */ case 0x214 :case 0x614 :case 0xa14 :case 0xe14 : -if (((insn >>22 ) &3 ) ==0 ) +if (((insn >>22 ) &3 ) ==0 ) {return 1 ; + } wrd = (insn >>12 ) &0xf ; rd0 = (insn >>16 ) &0xf ;gen_op_iwmmxt_movq_M0_wRn (rd0);
@@ -2128,8 +2161,9 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)break ;case 0x004 :case 0x404 :case 0x804 :case 0xc04 :/* WSRA */ case 0x014 :case 0x414 :case 0x814 :case 0xc14 : -if (((insn >>22 ) &3 ) ==0 ) +if (((insn >>22 ) &3 ) ==0 ) {return 1 ; + } wrd = (insn >>12 ) &0xf ; rd0 = (insn >>16 ) &0xf ;gen_op_iwmmxt_movq_M0_wRn (rd0);
@@ -2154,8 +2188,9 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)break ;case 0x104 :case 0x504 :case 0x904 :case 0xd04 :/* WSLL */ case 0x114 :case 0x514 :case 0x914 :case 0xd14 : -if (((insn >>22 ) &3 ) ==0 ) +if (((insn >>22 ) &3 ) ==0 ) {return 1 ; + } wrd = (insn >>12 ) &0xf ; rd0 = (insn >>16 ) &0xf ;gen_op_iwmmxt_movq_M0_wRn (rd0);
@@ -2180,8 +2215,9 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)break ;case 0x304 :case 0x704 :case 0xb04 :case 0xf04 :/* WROR */ case 0x314 :case 0x714 :case 0xb14 :case 0xf14 : -if (((insn >>22 ) &3 ) ==0 ) +if (((insn >>22 ) &3 ) ==0 ) {return 1 ; + } wrd = (insn >>12 ) &0xf ; rd0 = (insn >>16 ) &0xf ;gen_op_iwmmxt_movq_M0_wRn (rd0);
@@ -2218,22 +2254,25 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_op_iwmmxt_movq_M0_wRn (rd0);switch ((insn >>22 ) &3 ) {case 0 : -if (insn & (1 <<21 )) +if (insn & (1 <<21 )) {gen_op_iwmmxt_minsb_M0_wRn (rd1); -else + }else {gen_op_iwmmxt_minub_M0_wRn (rd1); + }break ;case 1 : -if (insn & (1 <<21 )) +if (insn & (1 <<21 )) {gen_op_iwmmxt_minsw_M0_wRn (rd1); -else + }else {gen_op_iwmmxt_minuw_M0_wRn (rd1); + }break ;case 2 : -if (insn & (1 <<21 )) +if (insn & (1 <<21 )) {gen_op_iwmmxt_minsl_M0_wRn (rd1); -else + }else {gen_op_iwmmxt_minul_M0_wRn (rd1); + }break ;case 3 :return 1 ;
@@ -2249,22 +2288,25 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_op_iwmmxt_movq_M0_wRn (rd0);switch ((insn >>22 ) &3 ) {case 0 : -if (insn & (1 <<21 )) +if (insn & (1 <<21 )) {gen_op_iwmmxt_maxsb_M0_wRn (rd1); -else + }else {gen_op_iwmmxt_maxub_M0_wRn (rd1); + }break ;case 1 : -if (insn & (1 <<21 )) +if (insn & (1 <<21 )) {gen_op_iwmmxt_maxsw_M0_wRn (rd1); -else + }else {gen_op_iwmmxt_maxuw_M0_wRn (rd1); + }break ;case 2 : -if (insn & (1 <<21 )) +if (insn & (1 <<21 )) {gen_op_iwmmxt_maxsl_M0_wRn (rd1); -else + }else {gen_op_iwmmxt_maxul_M0_wRn (rd1); + }break ;case 3 :return 1 ;
@@ -2387,30 +2429,34 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)case 0x408 :case 0x508 :case 0x608 :case 0x708 :case 0x808 :case 0x908 :case 0xa08 :case 0xb08 :case 0xc08 :case 0xd08 :case 0xe08 :case 0xf08 : -if (!(insn & (1 <<20 )) || ((insn >>22 ) &3 ) ==0 ) +if (!(insn & (1 <<20 )) || ((insn >>22 ) &3 ) ==0 ) {return 1 ; + } wrd = (insn >>12 ) &0xf ; rd0 = (insn >>16 ) &0xf ; rd1 = (insn >>0 ) &0xf ;gen_op_iwmmxt_movq_M0_wRn (rd0);switch ((insn >>22 ) &3 ) {case 1 : -if (insn & (1 <<21 )) +if (insn & (1 <<21 )) {gen_op_iwmmxt_packsw_M0_wRn (rd1); -else + }else {gen_op_iwmmxt_packuw_M0_wRn (rd1); + }break ;case 2 : -if (insn & (1 <<21 )) +if (insn & (1 <<21 )) {gen_op_iwmmxt_packsl_M0_wRn (rd1); -else + }else {gen_op_iwmmxt_packul_M0_wRn (rd1); + }break ;case 3 : -if (insn & (1 <<21 )) +if (insn & (1 <<21 )) {gen_op_iwmmxt_packsq_M0_wRn (rd1); -else + }else {gen_op_iwmmxt_packuq_M0_wRn (rd1); + }break ; }gen_op_iwmmxt_movq_wRn_M0 (wrd);
@@ -2424,8 +2470,9 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn) wrd = (insn >>5 ) &0xf ; rd0 = (insn >>12 ) &0xf ; rd1 = (insn >>0 ) &0xf ; -if (rd0 ==0xf || rd1 ==0xf ) +if (rd0 ==0xf || rd1 ==0xf ) {return 1 ; + }gen_op_iwmmxt_movq_M0_wRn (wrd); tmp =load_reg (s, rd0); tmp2 =load_reg (s, rd1);
@@ -2437,10 +2484,12 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_helper_iwmmxt_muladdsw (cpu_M0, cpu_M0, tmp, tmp2);break ;case 0xc :case 0xd :case 0xe :case 0xf :/* TMIAxy */ -if (insn & (1 <<16 )) +if (insn & (1 <<16 )) {tcg_gen_shri_i32 (tmp, tmp,16 ); -if (insn & (1 <<17 )) + } +if (insn & (1 <<17 )) {tcg_gen_shri_i32 (tmp2, tmp2,16 ); + }gen_helper_iwmmxt_muladdswl (cpu_M0, cpu_M0, tmp, tmp2);break ;default :
@@ -2456,8 +2505,10 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)return 0 ; } -/* Disassemble an XScale DSP instruction. Returns nonzero if an error occurred -(ie. an undefined instruction). */ +/* +* Disassemble an XScale DSP instruction. +* Returns nonzero if an error occurred (ie. an undefined instruction). +*/ static int disas_dsp_insn (DisasContext *s,uint32_t insn) {int acc, rd0, rd1, rdhi, rdlo;
@@ -2469,8 +2520,9 @@ static int disas_dsp_insn(DisasContext *s, uint32_t insn) rd1 = insn &0xf ; acc = (insn >>5 ) &7 ; -if (acc !=0 ) +if (acc !=0 ) {return 1 ; + } tmp =load_reg (s, rd0); tmp2 =load_reg (s, rd1);
@@ -2485,10 +2537,12 @@ static int disas_dsp_insn(DisasContext *s, uint32_t insn)case 0xd :/* MIABT */ case 0xe :/* MIATB */ case 0xf :/* MIATT */ -if (insn & (1 <<16 )) +if (insn & (1 <<16 )) {tcg_gen_shri_i32 (tmp, tmp,16 ); -if (insn & (1 <<17 )) + } +if (insn & (1 <<17 )) {tcg_gen_shri_i32 (tmp2, tmp2,16 ); + }gen_helper_iwmmxt_muladdswl (cpu_M0, cpu_M0, tmp, tmp2);break ;default :
@@ -2505,8 +2559,9 @@ static int disas_dsp_insn(DisasContext *s, uint32_t insn) rdlo = (insn >>12 ) &0xf ; acc = insn &7 ; -if (acc !=0 ) +if (acc !=0 ) {return 1 ; + }if (insn &ARM_CP_RW_BIT ) {/* MRA */ iwmmxt_load_reg (cpu_V0, acc);
Signature · 1 line
2.38.1
Re: [PATCH 06/22] target/arm/tcg: Fix iwmmxt-related code style
Quoted 10 lines · Philippe Mathieu-Daudé
In order to be able to move the iwmmxt-related code, fix its style to avoid:
ERROR: braces {} are necessary for all arms of this statement
ERROR: space prohibited before that '++' (ctx:WxB)Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- target/arm/tcg/translate.c | 227 +++++++++++++++++++++++-------------- 1 file changed, 141 insertions(+), 86 deletions(-)
r~
PATCH 7/22 target/arm/tcg: Expose some iwmmxt methods in 'translate.h'
In reply to Philippe Mathieu-DaudéExpose a few methods and variables before extracting iwmmxt code from translate.c.
--- target/arm/tcg/translate.h | 6 ++++++ target/arm/tcg/translate.c | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-)
target/arm/tcg/translate.h +6 -0
@@ -165,6 +165,7 @@ typedef struct DisasCompare { } DisasCompare;/* Share the TCG temporaries common between 32 and 64 bit modes. */ +extern TCGv_i32 cpu_R[16 ];extern TCGv_i32 cpu_NF, cpu_ZF, cpu_CF, cpu_VF;extern TCGv_i64 cpu_exclusive_addr;extern TCGv_i64 cpu_exclusive_val;
@@ -298,6 +299,11 @@ static inline int curr_insn_len(DisasContext *s)/* CPU state was modified dynamically; no need to exit, but do not chain. */ #define DISAS_UPDATE_NOCHAIN DISAS_TARGET_10 +/* These are TCG temporaries used only by the legacy iwMMXt decoder */ +extern TCGv_i64 cpu_V0, cpu_V1, cpu_M0; +int disas_iwmmxt_insn (DisasContext *s,uint32_t insn); +int disas_dsp_insn (DisasContext *s,uint32_t insn); +#ifdef TARGET_AARCH64 void a64_translate_init (void );void gen_a64_update_pc (DisasContext *s,target_long diff);
target/arm/tcg/translate.c +4 -4
@@ -45,9 +45,9 @@#define ENABLE_ARCH_8 arm_dc_feature(s, ARM_FEATURE_V8)/* These are TCG temporaries used only by the legacy iwMMXt decoder */ -static TCGv_i64 cpu_V0, cpu_V1, cpu_M0; +TCGv_i64 cpu_V0, cpu_V1, cpu_M0;/* These are TCG globals which alias CPUARMState fields */ -static TCGv_i32 cpu_R[16 ]; +TCGv_i32 cpu_R[16 ];TCGv_i32 cpu_CF, cpu_NF, cpu_VF, cpu_ZF;TCGv_i64 cpu_exclusive_addr;TCGv_i64 cpu_exclusive_val;
@@ -1490,7 +1490,7 @@ static inline int gen_iwmmxt_shift(uint32_t insn, uint32_t mask, TCGv_i32 dest)* Disassemble an iwMMXt instruction. * Returns nonzero if an error occurred (ie. an undefined instruction). */ -static int disas_iwmmxt_insn (DisasContext *s,uint32_t insn) +int disas_iwmmxt_insn (DisasContext *s,uint32_t insn) {int rd, wrd;int rdhi, rdlo, rd0, rd1, i;
@@ -2509,7 +2509,7 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)* Disassemble an XScale DSP instruction. * Returns nonzero if an error occurred (ie. an undefined instruction). */ -static int disas_dsp_insn (DisasContext *s,uint32_t insn) +int disas_dsp_insn (DisasContext *s,uint32_t insn) {int acc, rd0, rd1, rdhi, rdlo;TCGv_i32 tmp, tmp2;
Signature · 1 line
2.38.1
Re: [PATCH 07/22] target/arm/tcg: Expose some iwmmxt methods in 'translate.h'
Quoted 8 lines · Philippe Mathieu-Daudé
Expose a few methods and variables before extracting iwmmxt code from
translate.c.Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- target/arm/tcg/translate.h | 6 ++++++ target/arm/tcg/translate.c | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-)
PATCH 8/22 target/arm/tcg: Extract iwmmxt code to translate-iwmmxt.c
In reply to Philippe Mathieu-DaudéExtract 1300 lines from the big enough translate.c.
--- target/arm/tcg/translate-iwmmxt.c | 1334 +++++++++++++++++++++++++++++ target/arm/tcg/translate.c | 1312 ---------------------------- target/arm/tcg/meson.build | 1 + 3 files changed, 1335 insertions(+), 1312 deletions(-) create mode 100644 target/arm/tcg/translate-iwmmxt.c
target/arm/tcg/translate-iwmmxt.c new file +1334 -0
@@ -0,0 +1,1334 @@ +/* +* AArch64 SVE translation +* +* Copyright (c) 2018 Linaro, Ltd +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; either +* version 2.1 of the License, or (at your option) any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, see <http://www.gnu.org/licenses/>. +*/ + +#include "qemu/osdep.h" +#include "translate.h" +#include "translate-a32.h" + +#define ARM_CP_RW_BIT (1 << 20) + +static inline void iwmmxt_load_reg (TCGv_i64 var,int reg) +{ + tcg_gen_ld_i64(var, cpu_env, offsetof(CPUARMState, iwmmxt.regs[reg])); +} + +static inline void iwmmxt_store_reg (TCGv_i64 var,int reg) +{ + tcg_gen_st_i64(var, cpu_env, offsetof(CPUARMState, iwmmxt.regs[reg])); +} + +static inline TCGv_i32 iwmmxt_load_creg (int reg) +{ +TCGv_i32 var =tcg_temp_new_i32 (); + tcg_gen_ld_i32(var, cpu_env, offsetof(CPUARMState, iwmmxt.cregs[reg])); +return var; +} + +static inline void iwmmxt_store_creg (int reg,TCGv_i32 var) +{ + tcg_gen_st_i32(var, cpu_env, offsetof(CPUARMState, iwmmxt.cregs[reg])); +} + +static inline void gen_op_iwmmxt_movq_wRn_M0 (int rn) +{ +iwmmxt_store_reg (cpu_M0, rn); +} + +static inline void gen_op_iwmmxt_movq_M0_wRn (int rn) +{ +iwmmxt_load_reg (cpu_M0, rn); +} + +static inline void gen_op_iwmmxt_orq_M0_wRn (int rn) +{ +iwmmxt_load_reg (cpu_V1, rn); +tcg_gen_or_i64 (cpu_M0, cpu_M0, cpu_V1); +} + +static inline void gen_op_iwmmxt_andq_M0_wRn (int rn) +{ +iwmmxt_load_reg (cpu_V1, rn); +tcg_gen_and_i64 (cpu_M0, cpu_M0, cpu_V1); +} + +static inline void gen_op_iwmmxt_xorq_M0_wRn (int rn) +{ +iwmmxt_load_reg (cpu_V1, rn); +tcg_gen_xor_i64 (cpu_M0, cpu_M0, cpu_V1); +} + +#define IWMMXT_OP (name) \ +static inline void gen_op_iwmmxt_##name##_M0_wRn(int rn) \ +{ \ + iwmmxt_load_reg(cpu_V1, rn); \ + gen_helper_iwmmxt_##name(cpu_M0, cpu_M0, cpu_V1); \ +} + +#define IWMMXT_OP_ENV (name) \ +static inline void gen_op_iwmmxt_##name##_M0_wRn(int rn) \ +{ \ + iwmmxt_load_reg(cpu_V1, rn); \ + gen_helper_iwmmxt_##name(cpu_M0, cpu_env, cpu_M0, cpu_V1); \ +} + +#define IWMMXT_OP_ENV_SIZE (name) \ +IWMMXT_OP_ENV(name##b) \ +IWMMXT_OP_ENV(name##w) \ +IWMMXT_OP_ENV(name##l) + +#define IWMMXT_OP_ENV1 (name) \ +static inline void gen_op_iwmmxt_##name##_M0(void) \ +{ \ + gen_helper_iwmmxt_##name(cpu_M0, cpu_env, cpu_M0); \ +} + +IWMMXT_OP (maddsq) +IWMMXT_OP (madduq ) +IWMMXT_OP (sadb) +IWMMXT_OP (sadw) +IWMMXT_OP (mulslw) +IWMMXT_OP (mulshw) +IWMMXT_OP (mululw) +IWMMXT_OP (muluhw) +IWMMXT_OP (macsw) +IWMMXT_OP (macuw) + +IWMMXT_OP_ENV_SIZE (unpackl) +IWMMXT_OP_ENV_SIZE (unpackh) + +IWMMXT_OP_ENV1 (unpacklub) +IWMMXT_OP_ENV1 (unpackluw) +IWMMXT_OP_ENV1 (unpacklul) +IWMMXT_OP_ENV1 (unpackhub) +IWMMXT_OP_ENV1 (unpackhuw) +IWMMXT_OP_ENV1 (unpackhul) +IWMMXT_OP_ENV1 (unpacklsb) +IWMMXT_OP_ENV1 (unpacklsw) +IWMMXT_OP_ENV1 (unpacklsl) +IWMMXT_OP_ENV1 (unpackhsb) +IWMMXT_OP_ENV1 (unpackhsw) +IWMMXT_OP_ENV1 (unpackhsl) + +IWMMXT_OP_ENV_SIZE (cmpeq) +IWMMXT_OP_ENV_SIZE (cmpgtu) +IWMMXT_OP_ENV_SIZE (cmpgts) + +IWMMXT_OP_ENV_SIZE (mins) +IWMMXT_OP_ENV_SIZE (minu) +IWMMXT_OP_ENV_SIZE (maxs) +IWMMXT_OP_ENV_SIZE (maxu) + +IWMMXT_OP_ENV_SIZE (subn) +IWMMXT_OP_ENV_SIZE (addn) +IWMMXT_OP_ENV_SIZE (subu) +IWMMXT_OP_ENV_SIZE (addu) +IWMMXT_OP_ENV_SIZE (subs) +IWMMXT_OP_ENV_SIZE (adds) + +IWMMXT_OP_ENV (avgb0) +IWMMXT_OP_ENV (avgb1) +IWMMXT_OP_ENV (avgw0) +IWMMXT_OP_ENV (avgw1) + +IWMMXT_OP_ENV (packuw) +IWMMXT_OP_ENV (packul) +IWMMXT_OP_ENV (packuq) +IWMMXT_OP_ENV (packsw) +IWMMXT_OP_ENV (packsl) +IWMMXT_OP_ENV (packsq) + +static voidgen_op_iwmmxt_set_mup (void) +{ +TCGv_i32 tmp; + tmp =load_cpu_field (iwmmxt.cregs[ARM_IWMMXT_wCon]); +tcg_gen_ori_i32 (tmp, tmp,2 ); +store_cpu_field (tmp, iwmmxt.cregs[ARM_IWMMXT_wCon]); +} + +static void gen_op_iwmmxt_set_cup (void ) +{ +TCGv_i32 tmp; + tmp =load_cpu_field (iwmmxt.cregs[ARM_IWMMXT_wCon]); +tcg_gen_ori_i32 (tmp, tmp,1 ); +store_cpu_field (tmp, iwmmxt.cregs[ARM_IWMMXT_wCon]); +} + +static void gen_op_iwmmxt_setpsr_nz (void ) +{ +TCGv_i32 tmp =tcg_temp_new_i32 (); +gen_helper_iwmmxt_setpsr_nz (tmp, cpu_M0); +store_cpu_field (tmp, iwmmxt.cregs[ARM_IWMMXT_wCASF]); +} + +static inline void gen_op_iwmmxt_addl_M0_wRn (int rn) +{ +iwmmxt_load_reg (cpu_V1, rn); +tcg_gen_ext32u_i64 (cpu_V1, cpu_V1); +tcg_gen_add_i64 (cpu_M0, cpu_M0, cpu_V1); +} + +static inline int gen_iwmmxt_address (DisasContext *s,uint32_t insn, +TCGv_i32 dest) +{ +int rd; +uint32_t offset; +TCGv_i32 tmp; + + rd = (insn >>16 ) &0xf ; + tmp =load_reg (s, rd); + + offset = (insn &0xff ) << ((insn >>7 ) &2 ); +if (insn & (1 <<24 )) { +/* Pre indexed */ +if (insn & (1 <<23 )) { +tcg_gen_addi_i32 (tmp, tmp, offset); + }else { +tcg_gen_addi_i32 (tmp, tmp, -offset); + } +tcg_gen_mov_i32 (dest, tmp); +if (insn & (1 <<21 )) { +store_reg (s, rd, tmp); + } + }else if (insn & (1 <<21 )) { +/* Post indexed */ +tcg_gen_mov_i32 (dest, tmp); +if (insn & (1 <<23 )) { +tcg_gen_addi_i32 (tmp, tmp, offset); + }else { +tcg_gen_addi_i32 (tmp, tmp, -offset); + } +store_reg (s, rd, tmp); + }else if (!(insn & (1 <<23 ))) { +return 1 ; + } +return 0 ; +} + +static inline int gen_iwmmxt_shift (uint32_t insn,uint32_t mask,TCGv_i32 dest) +{ +int rd = (insn >>0 ) &0xf ; +TCGv_i32 tmp; + +if (insn & (1 <<8 )) { +if (rd < ARM_IWMMXT_wCGR0 || rd > ARM_IWMMXT_wCGR3) { +return 1 ; + }else { + tmp =iwmmxt_load_creg (rd); + } + }else { + tmp =tcg_temp_new_i32 (); +iwmmxt_load_reg (cpu_V0, rd); +tcg_gen_extrl_i64_i32 (tmp, cpu_V0); + } +tcg_gen_andi_i32 (tmp, tmp, mask); +tcg_gen_mov_i32 (dest, tmp); +return 0 ; +} + +/* +* Disassemble an iwMMXt instruction. +* Returns nonzero if an error occurred (ie. an undefined instruction). +*/ +int disas_iwmmxt_insn (DisasContext *s,uint32_t insn) +{ +int rd, wrd; +int rdhi, rdlo, rd0, rd1, i; +TCGv_i32 addr; +TCGv_i32 tmp, tmp2, tmp3; + +if ((insn &0x0e000e00 ) ==0x0c000000 ) { +if ((insn &0x0fe00ff0 ) ==0x0c400000 ) { + wrd = insn &0xf ; + rdlo = (insn >>12 ) &0xf ; + rdhi = (insn >>16 ) &0xf ; +if (insn &ARM_CP_RW_BIT ) {/* TMRRC */ +iwmmxt_load_reg (cpu_V0, wrd); +tcg_gen_extrl_i64_i32 (cpu_R[rdlo], cpu_V0); +tcg_gen_extrh_i64_i32 (cpu_R[rdhi], cpu_V0); + }else {/* TMCRR */ +tcg_gen_concat_i32_i64 (cpu_V0, cpu_R[rdlo], cpu_R[rdhi]); +iwmmxt_store_reg (cpu_V0, wrd); +gen_op_iwmmxt_set_mup (); + } +return 0 ; + } + + wrd = (insn >>12 ) &0xf ; + addr =tcg_temp_new_i32 (); +if (gen_iwmmxt_address (s, insn, addr)) { +return 1 ; + } +if (insn &ARM_CP_RW_BIT ) { +if ((insn >>28 ) ==0xf ) {/* WLDRW wCx */ + tmp =tcg_temp_new_i32 (); +gen_aa32_ld32u (s, tmp, addr,get_mem_index (s)); +iwmmxt_store_creg (wrd, tmp); + }else { + i =1 ; +if (insn & (1 <<8 )) { +if (insn & (1 <<22 )) {/* WLDRD */ +gen_aa32_ld64 (s, cpu_M0, addr,get_mem_index (s)); + i =0 ; + }else {/* WLDRW wRd */ + tmp =tcg_temp_new_i32 (); +gen_aa32_ld32u (s, tmp, addr,get_mem_index (s)); + } + }else { + tmp =tcg_temp_new_i32 (); +if (insn & (1 <<22 )) {/* WLDRH */ +gen_aa32_ld16u (s, tmp, addr,get_mem_index (s)); + }else {/* WLDRB */ +gen_aa32_ld8u (s, tmp, addr,get_mem_index (s)); + } + } +if (i) { +tcg_gen_extu_i32_i64 (cpu_M0, tmp); + } +gen_op_iwmmxt_movq_wRn_M0 (wrd); + } + }else { +if ((insn >>28 ) ==0xf ) {/* WSTRW wCx */ + tmp =iwmmxt_load_creg (wrd); +gen_aa32_st32 (s, tmp, addr,get_mem_index (s)); + }else { +gen_op_iwmmxt_movq_M0_wRn (wrd); + tmp =tcg_temp_new_i32 (); +if (insn & (1 <<8 )) { +if (insn & (1 <<22 )) {/* WSTRD */ +gen_aa32_st64 (s, cpu_M0, addr,get_mem_index (s)); + }else {/* WSTRW wRd */ +tcg_gen_extrl_i64_i32 (tmp, cpu_M0); +gen_aa32_st32 (s, tmp, addr,get_mem_index (s)); + } + }else { +if (insn & (1 <<22 )) {/* WSTRH */ +tcg_gen_extrl_i64_i32 (tmp, cpu_M0); +gen_aa32_st16 (s, tmp, addr,get_mem_index (s)); + }else {/* WSTRB */ +tcg_gen_extrl_i64_i32 (tmp, cpu_M0); +gen_aa32_st8 (s, tmp, addr,get_mem_index (s)); + } + } + } + } +return 0 ; + } + +if ((insn &0x0f000000 ) !=0x0e000000 ) { +return 1 ; + } + +switch (((insn >>12 ) &0xf00 ) | ((insn >>4 ) &0xff )) { +case 0x000 :/* WOR */ + wrd = (insn >>12 ) &0xf ; + rd0 = (insn >>0 ) &0xf ; + rd1 = (insn >>16 ) &0xf ; +gen_op_iwmmxt_movq_M0_wRn (rd0); +gen_op_iwmmxt_orq_M0_wRn (rd1); +gen_op_iwmmxt_setpsr_nz (); +gen_op_iwmmxt_movq_wRn_M0 (wrd); +gen_op_iwmmxt_set_mup (); +gen_op_iwmmxt_set_cup (); +break ; +case 0x011 :/* TMCR */ +if (insn &0xf ) { +return 1 ; + } + rd = (insn >>12 ) &0xf ; + wrd = (insn >>16 ) &0xf ; +switch (wrd) { +case ARM_IWMMXT_wCID: +case ARM_IWMMXT_wCASF: +break ; +case ARM_IWMMXT_wCon: +gen_op_iwmmxt_set_cup (); +/* Fall through. */ +case ARM_IWMMXT_wCSSF: + tmp =iwmmxt_load_creg (wrd); + tmp2 =load_reg (s, rd); +tcg_gen_andc_i32 (tmp, tmp, tmp2); +iwmmxt_store_creg (wrd, tmp); +break ; +case ARM_IWMMXT_wCGR0: +case ARM_IWMMXT_wCGR1: +case ARM_IWMMXT_wCGR2: +case ARM_IWMMXT_wCGR3: +gen_op_iwmmxt_set_cup (); + tmp =load_reg (s, rd); +iwmmxt_store_creg (wrd, tmp); +break ; +default : +return 1 ; + } +break ; +case 0x100 :/* WXOR */ + wrd = (insn >>12 ) &0xf ; + rd0 = (insn >>0 ) &0xf ; + rd1 = (insn >>16 ) &0xf ; +gen_op_iwmmxt_movq_M0_wRn (rd0); +gen_op_iwmmxt_xorq_M0_wRn (rd1); +gen_op_iwmmxt_setpsr_nz (); +gen_op_iwmmxt_movq_wRn_M0 (wrd); +gen_op_iwmmxt_set_mup (); +gen_op_iwmmxt_set_cup (); +break ; +case 0x111 :/* TMRC */ +if (insn &0xf ) { +return 1 ; + } + rd = (insn >>12 ) &0xf ; + wrd = (insn >>16 ) &0xf ; + tmp =iwmmxt_load_creg (wrd); +store_reg (s, rd, tmp); +break ; +case 0x300 :/* WANDN */ + wrd = (insn >>12 ) &0xf ; + rd0 = (insn >>0 ) &0xf ; + rd1 = (insn >>16 ) &0xf ; +gen_op_iwmmxt_movq_M0_wRn (rd0); +tcg_gen_neg_i64 (cpu_M0, cpu_M0); +gen_op_iwmmxt_andq_M0_wRn (rd1); +gen_op_iwmmxt_setpsr_nz (); +gen_op_iwmmxt_movq_wRn_M0 (wrd); +gen_op_iwmmxt_set_mup (); +gen_op_iwmmxt_set_cup (); +break ; +case 0x200 :/* WAND */ + wrd = (insn >>12 ) &0xf ; + rd0 = (insn >>0 ) &0xf ; + rd1 = (insn >>16 ) &0xf ; +gen_op_iwmmxt_movq_M0_wRn (rd0); +gen_op_iwmmxt_andq_M0_wRn (rd1); +gen_op_iwmmxt_setpsr_nz (); +gen_op_iwmmxt_movq_wRn_M0 (wrd); +gen_op_iwmmxt_set_mup (); +gen_op_iwmmxt_set_cup (); +break ; +case 0x810 :case 0xa10 :/* WMADD */ + wrd = (insn >>12 ) &0xf ; + rd0 = (insn >>0 ) &0xf ; + rd1 = (insn >>16 ) &0xf ; +gen_op_iwmmxt_movq_M0_wRn (rd0); +if (insn & (1 <<21 )) { +gen_op_iwmmxt_maddsq_M0_wRn (rd1); + }else { +gen_op_iwmmxt_madduq_M0_wRn (rd1); + } +gen_op_iwmmxt_movq_wRn_M0 (wrd); +gen_op_iwmmxt_set_mup (); +break ; +case 0x10e :case 0x50e :case 0x90e :case 0xd0e :/* WUNPCKIL */ + wrd = (insn >>12 ) &0xf ; + rd0 = (insn >>16 ) &0xf ; + rd1 = (insn >>0 ) &0xf ; +gen_op_iwmmxt_movq_M0_wRn (rd0); +switch ((insn >>22 ) &3 ) { +case 0 : +gen_op_iwmmxt_unpacklb_M0_wRn (rd1); +break ; +case 1 : +gen_op_iwmmxt_unpacklw_M0_wRn (rd1); +break ; +case 2 : +gen_op_iwmmxt_unpackll_M0_wRn (rd1); +break ; +case 3 : +return 1 ; + } +gen_op_iwmmxt_movq_wRn_M0 (wrd); +gen_op_iwmmxt_set_mup (); +gen_op_iwmmxt_set_cup (); +break ; +case 0x10c :case 0x50c :case 0x90c :case 0xd0c :/* WUNPCKIH */ + wrd = (insn >>12 ) &0xf ; + rd0 = (insn >>16 ) &0xf ; + rd1 = (insn >>0 ) &0xf ; +gen_op_iwmmxt_movq_M0_wRn (rd0); +switch ((insn >>22 ) &3 ) { +case 0 : +gen_op_iwmmxt_unpackhb_M0_wRn (rd1); +break ; +case 1 : +gen_op_iwmmxt_unpackhw_M0_wRn (rd1); +break ; +case 2 : +gen_op_iwmmxt_unpackhl_M0_wRn (rd1); +break ; +case 3 : +return 1 ; + } +gen_op_iwmmxt_movq_wRn_M0 (wrd); +gen_op_iwmmxt_set_mup (); +gen_op_iwmmxt_set_cup (); +break ; +case 0x012 :case 0x112 :case 0x412 :case 0x512 :/* WSAD */ + wrd = (insn >>12 ) &0xf ; + rd0 = (insn >>16 ) &0xf ; + rd1 = (insn >>0 ) &0xf ; +gen_op_iwmmxt_movq_M0_wRn (rd0); +if (insn & (1 <<22 )) { +gen_op_iwmmxt_sadw_M0_wRn (rd1); + }else { +gen_op_iwmmxt_sadb_M0_wRn (rd1); + } +if (!(insn & (1 <<20 ))) { +gen_op_iwmmxt_addl_M0_wRn (wrd); + } +gen_op_iwmmxt_movq_wRn_M0 (wrd); +gen_op_iwmmxt_set_mup (); +break ; +case 0x010 :case 0x110 :case 0x210 :case 0x310 :/* WMUL */ + wrd = (insn >>12 ) &0xf ; + rd0 = (insn >>16 ) &0xf ; + rd1 = (insn >>0 ) &0xf ; +gen_op_iwmmxt_movq_M0_wRn (rd0); +if (insn & (1 <<21 )) { +if (insn & (1 <<20 )) { +gen_op_iwmmxt_mulshw_M0_wRn (rd1); + }else { +gen_op_iwmmxt_mulslw_M0_wRn (rd1); + } + }else { +if (insn & (1 <<20 )) { +gen_op_iwmmxt_muluhw_M0_wRn (rd1); + }else { +gen_op_iwmmxt_mululw_M0_wRn (rd1); + } + } +gen_op_iwmmxt_movq_wRn_M0 (wrd); +gen_op_iwmmxt_set_mup (); +break ; +case 0x410 :case 0x510 :case 0x610 :case 0x710 :/* WMAC */ + wrd = (insn >>12 ) &0xf ; + rd0 = (insn >>16 ) &0xf ; + rd1 = (insn >>0 ) &0xf ; +gen_op_iwmmxt_movq_M0_wRn (rd0); +if (insn & (1 <<21 )) { +gen_op_iwmmxt_macsw_M0_wRn (rd1); + }else { +gen_op_iwmmxt_macuw_M0_wRn (rd1); + } +if (!(insn & (1 <<20 ))) { +iwmmxt_load_reg (cpu_V1, wrd); +tcg_gen_add_i64 (cpu_M0, cpu_M0, cpu_V1); + } +gen_op_iwmmxt_movq_wRn_M0 (wrd); +gen_op_iwmmxt_set_mup (); +break ; +case 0x006 :case 0x406 :case 0x806 :case 0xc06 :/* WCMPEQ */ + wrd = (insn >>12 ) &0xf ; + rd0 = (insn >>16 ) &0xf ; + rd1 = (insn >>0 ) &0xf ; +gen_op_iwmmxt_movq_M0_wRn (rd0); +switch ((insn >>22 ) &3 ) { +case 0 : +gen_op_iwmmxt_cmpeqb_M0_wRn (rd1); +break ; +case 1 : +gen_op_iwmmxt_cmpeqw_M0_wRn (rd1); +break ; +case 2 : +gen_op_iwmmxt_cmpeql_M0_wRn (rd1); +break ; +case 3 : +return 1 ; + } +gen_op_iwmmxt_movq_wRn_M0 (wrd); +gen_op_iwmmxt_set_mup (); +gen_op_iwmmxt_set_cup (); +break ; +case 0x800 :case 0x900 :case 0xc00 :case 0xd00 :/* WAVG2 */ + wrd = (insn >>12 ) &0xf ; + rd0 = (insn >>16 ) &0xf ; + rd1 = (insn >>0 ) &0xf ; +gen_op_iwmmxt_movq_M0_wRn (rd0); +if (insn & (1 <<22 )) { +if (insn & (1 <<20 )) { +gen_op_iwmmxt_avgw1_M0_wRn (rd1); + }else { +gen_op_iwmmxt_avgw0_M0_wRn (rd1); + } + }else { +if (insn & (1 <<20 )) { +gen_op_iwmmxt_avgb1_M0_wRn (rd1); + }else { +gen_op_iwmmxt_avgb0_M0_wRn (rd1); + } + } +gen_op_iwmmxt_movq_wRn_M0 (wrd); +gen_op_iwmmxt_set_mup (); +gen_op_iwmmxt_set_cup (); +break ; +case 0x802 :case 0x902 :case 0xa02 :case 0xb02 :/* WALIGNR */ + wrd = (insn >>12 ) &0xf ; + rd0 = (insn >>16 ) &0xf ; + rd1 = (insn >>0 ) &0xf ; +gen_op_iwmmxt_movq_M0_wRn (rd0); + tmp =iwmmxt_load_creg (ARM_IWMMXT_wCGR0 + ((insn >>20 ) &3 )); +tcg_gen_andi_i32 (tmp, tmp,7 ); +iwmmxt_load_reg (cpu_V1, rd1); +gen_helper_iwmmxt_align (cpu_M0, cpu_M0, cpu_V1, tmp); +gen_op_iwmmxt_movq_wRn_M0 (wrd); +gen_op_iwmmxt_set_mup (); +break ; +case 0x601 :case 0x605 :case 0x609 :case 0x60d :/* TINSR */ +if (((insn >>6 ) &3 ) ==3 ) { +return 1 ; + } + rd = (insn >>12 ) &0xf ; + wrd = (insn >>16 ) &0xf ; + tmp =load_reg (s, rd); +gen_op_iwmmxt_movq_M0_wRn (wrd); +switch ((insn >>6 ) &3 ) { +case 0 : + tmp2 =tcg_constant_i32 (0xff ); + tmp3 =tcg_constant_i32 ((insn &7 ) <<3 ); +break ; +case 1 : + tmp2 =tcg_constant_i32 (0xffff ); + tmp3 =tcg_constant_i32 ((insn &3 ) <<4 ); +break ; +case 2 : + tmp2 =tcg_constant_i32 (0xffffffff ); + tmp3 =tcg_constant_i32 ((insn &1 ) <<5 ); +break ; +default : +g_assert_not_reached (); + } +gen_helper_iwmmxt_insr (cpu_M0, cpu_M0, tmp, tmp2, tmp3); +gen_op_iwmmxt_movq_wRn_M0 (wrd); +gen_op_iwmmxt_set_mup (); +break ; +case 0x107 :case 0x507 :case 0x907 :case 0xd07 :/* TEXTRM */ + rd = (insn >>12 ) &0xf ; + wrd = (insn >>16 ) &0xf ; +if (rd ==15 || ((insn >>22 ) &3 ) ==3 ) { +return 1 ; + } +gen_op_iwmmxt_movq_M0_wRn (wrd); + tmp =tcg_temp_new_i32 (); +switch ((insn >>22 ) &3 ) { +case 0 : +tcg_gen_shri_i64 (cpu_M0, cpu_M0, (insn &7 ) <<3 ); +tcg_gen_extrl_i64_i32 (tmp, cpu_M0); +if (insn &8 ) { +tcg_gen_ext8s_i32 (tmp, tmp); + }else { +tcg_gen_andi_i32 (tmp, tmp,0xff ); + } +break ; +case 1 : +tcg_gen_shri_i64 (cpu_M0, cpu_M0, (insn &3 ) <<4 ); +tcg_gen_extrl_i64_i32 (tmp, cpu_M0); +if (insn &8 ) { +tcg_gen_ext16s_i32 (tmp, tmp); + }else { +tcg_gen_andi_i32 (tmp, tmp,0xffff ); + } +break ; +case 2 : +tcg_gen_shri_i64 (cpu_M0, cpu_M0, (insn &1 ) <<5 ); +tcg_gen_extrl_i64_i32 (tmp, cpu_M0); +break ; + } +store_reg (s, rd, tmp); +break ; +case 0x117 :case 0x517 :case 0x917 :case 0xd17 :/* TEXTRC */ +if ((insn &0x000ff008 ) !=0x0003f000 || ((insn >>22 ) &3 ) ==3 ) { +return 1 ; + } + tmp =iwmmxt_load_creg (ARM_IWMMXT_wCASF); +switch ((insn >>22 ) &3 ) { +case 0 : +tcg_gen_shri_i32 (tmp, tmp, ((insn &7 ) <<2 ) +0 ); +break ; +case 1 : +tcg_gen_shri_i32 (tmp, tmp, ((insn &3 ) <<3 ) +4 ); +break ; +case 2 : +tcg_gen_shri_i32 (tmp, tmp, ((insn &1 ) <<4 ) +12 ); +break ; + } +tcg_gen_shli_i32 (tmp, tmp,28 ); +gen_set_nzcv (tmp); +break ; +case 0x401 :case 0x405 :case 0x409 :case 0x40d :/* TBCST */ +if (((insn >>6 ) &3 ) ==3 ) { +return 1 ; + } + rd = (insn >>12 ) &0xf ; + wrd = (insn >>16 ) &0xf ; + tmp =load_reg (s, rd); +switch ((insn >>6 ) &3 ) { +case 0 : +gen_helper_iwmmxt_bcstb (cpu_M0, tmp); +break ; +case 1 : +gen_helper_iwmmxt_bcstw (cpu_M0, tmp); +break ; +case 2 : +gen_helper_iwmmxt_bcstl (cpu_M0, tmp); +break ; + } +gen_op_iwmmxt_movq_wRn_M0 (wrd); +gen_op_iwmmxt_set_mup (); +break ; +case 0x113 :case 0x513 :case 0x913 :case 0xd13 :/* TANDC */ +if ((insn &0x000ff00f ) !=0x0003f000 || ((insn >>22 ) &3 ) ==3 ) { +return 1 ; + } + tmp =iwmmxt_load_creg (ARM_IWMMXT_wCASF); + tmp2 =tcg_temp_new_i32 (); +tcg_gen_mov_i32 (tmp2, tmp); +switch ((insn >>22 ) &3 ) { +case 0 : +for (i =0 ; i <7 ; i++) { +tcg_gen_shli_i32 (tmp2, tmp2,4 ); +tcg_gen_and_i32 (tmp, tmp, tmp2); + } +break ; +case 1 : +for (i =0 ; i <3 ; i++) { +tcg_gen_shli_i32 (tmp2, tmp2,8 ); +tcg_gen_and_i32 (tmp, tmp, tmp2); + } +break ; +case 2 : +tcg_gen_shli_i32 (tmp2, tmp2,16 ); +tcg_gen_and_i32 (tmp, tmp, tmp2); +break ; + } +gen_set_nzcv (tmp); +break ; +case 0x01c :case 0x41c :case 0x81c :case 0xc1c :/* WACC */ + wrd = (insn >>12 ) &0xf ; + rd0 = (insn >>16 ) &0xf ; +gen_op_iwmmxt_movq_M0_wRn (rd0); +switch ((insn >>22 ) &3 ) { +case 0 : +gen_helper_iwmmxt_addcb (cpu_M0, cpu_M0); +break ; +case 1 : +gen_helper_iwmmxt_addcw (cpu_M0, cpu_M0); +break ; +case 2 : +gen_helper_iwmmxt_addcl (cpu_M0, cpu_M0); +break ; +case 3 : +return 1 ; + } +gen_op_iwmmxt_movq_wRn_M0 (wrd); +gen_op_iwmmxt_set_mup (); +break ; +case 0x115 :case 0x515 :case 0x915 :case 0xd15 :/* TORC */ +if ((insn &0x000ff00f ) !=0x0003f000 || ((insn >>22 ) &3 ) ==3 ) { +return 1 ; + } + tmp =iwmmxt_load_creg (ARM_IWMMXT_wCASF); + tmp2 =tcg_temp_new_i32 (); +tcg_gen_mov_i32 (tmp2, tmp); +switch ((insn >>22 ) &3 ) { +case 0 : +for (i =0 ; i <7 ; i++) { +tcg_gen_shli_i32 (tmp2, tmp2,4 ); +tcg_gen_or_i32 (tmp, tmp, tmp2); + } +break ; +case 1 : +for (i =0 ; i <3 ; i++) { +tcg_gen_shli_i32 (tmp2, tmp2,8 ); +tcg_gen_or_i32 (tmp, tmp, tmp2); + } +break ; +case 2 : +tcg_gen_shli_i32 (tmp2, tmp2,16 ); +tcg_gen_or_i32 (tmp, tmp, tmp2); +break ; + } +gen_set_nzcv (tmp); +break ; +case 0x103 :case 0x503 :case 0x903 :case 0xd03 :/* TMOVMSK */ + rd = (insn >>12 ) &0xf ; + rd0 = (insn >>16 ) &0xf ; +if ((insn &0xf ) !=0 || ((insn >>22 ) &3 ) ==3 ) { +return 1 ; + } +gen_op_iwmmxt_movq_M0_wRn (rd0); + tmp =tcg_temp_new_i32 (); +switch ((insn >>22 ) &3 ) { +case 0 : +gen_helper_iwmmxt_msbb (tmp, cpu_M0); +break ; +case 1 : +gen_helper_iwmmxt_msbw (tmp, cpu_M0); +break ; +case 2 : +gen_helper_iwmmxt_msbl (tmp, cpu_M0); +break ; + } +store_reg (s, rd, tmp); +break ; +case 0x106 :case 0x306 :case 0x506 :case 0x706 :/* WCMPGT */ +case 0x906 :case 0xb06 :case 0xd06 :case 0xf06 : + wrd = (insn >>12 ) &0xf ; + rd0 = (insn >>16 ) &0xf ; + rd1 = (insn >>0 ) &0xf ; +gen_op_iwmmxt_movq_M0_wRn (rd0); +switch ((insn >>22 ) &3 ) { +case 0 : +if (insn & (1 <<21 )) { +gen_op_iwmmxt_cmpgtsb_M0_wRn (rd1); + }else { +gen_op_iwmmxt_cmpgtub_M0_wRn (rd1); + } +break ; +case 1 : +if (insn & (1 <<21 )) { +gen_op_iwmmxt_cmpgtsw_M0_wRn (rd1); + }else { +gen_op_iwmmxt_cmpgtuw_M0_wRn (rd1); + } +break ; +case 2 : +if (insn & (1 <<21 )) { +gen_op_iwmmxt_cmpgtsl_M0_wRn (rd1); + }else { +gen_op_iwmmxt_cmpgtul_M0_wRn (rd1); + } +break ; +case 3 : +return 1 ; + } +gen_op_iwmmxt_movq_wRn_M0 (wrd); +gen_op_iwmmxt_set_mup (); +gen_op_iwmmxt_set_cup (); +break ; +case 0x00e :case 0x20e :case 0x40e :case 0x60e :/* WUNPCKEL */ +case 0x80e :case 0xa0e :case 0xc0e :case 0xe0e : + wrd = (insn >>12 ) &0xf ; + rd0 = (insn >>16 ) &0xf ; +gen_op_iwmmxt_movq_M0_wRn (rd0); +switch ((insn >>22 ) &3 ) { +case 0 : +if (insn & (1 <<21 )) { +gen_op_iwmmxt_unpacklsb_M0 (); + }else { +gen_op_iwmmxt_unpacklub_M0 (); + } +break ; +case 1 : +if (insn & (1 <<21 )) { +gen_op_iwmmxt_unpacklsw_M0 (); + }else { +gen_op_iwmmxt_unpackluw_M0 (); + } +break ; +case 2 : +if (insn & (1 <<21 )) { +gen_op_iwmmxt_unpacklsl_M0 (); + }else { +gen_op_iwmmxt_unpacklul_M0 (); + } +break ; +case 3 : +return 1 ; + } +gen_op_iwmmxt_movq_wRn_M0 (wrd); +gen_op_iwmmxt_set_mup (); +gen_op_iwmmxt_set_cup (); +break ; +case 0x00c :case 0x20c :case 0x40c :case 0x60c :/* WUNPCKEH */ +case 0x80c :case 0xa0c :case 0xc0c :case 0xe0c : + wrd = (insn >>12 ) &0xf ; + rd0 = (insn >>16 ) &0xf ; +gen_op_iwmmxt_movq_M0_wRn (rd0); +switch ((insn >>22 ) &3 ) { +case 0 : +if (insn & (1 <<21 )) { +gen_op_iwmmxt_unpackhsb_M0 (); + }else { +gen_op_iwmmxt_unpackhub_M0 (); + } +break ; +case 1 : +if (insn & (1 <<21 )) { +gen_op_iwmmxt_unpackhsw_M0 (); + }else { +gen_op_iwmmxt_unpackhuw_M0 (); + } +break ; +case 2 : +if (insn & (1 <<21 )) { +gen_op_iwmmxt_unpackhsl_M0 (); + }else { +gen_op_iwmmxt_unpackhul_M0 (); + } +break ; +case 3 : +return 1 ; + } +gen_op_iwmmxt_movq_wRn_M0 (wrd); +gen_op_iwmmxt_set_mup (); +gen_op_iwmmxt_set_cup (); +break ; +case 0x204 :case 0x604 :case 0xa04 :case 0xe04 :/* WSRL */ +case 0x214 :case 0x614 :case 0xa14 :case 0xe14 : +if (((insn >>22 ) &3 ) ==0 ) { +return 1 ; + } + wrd = (insn >>12 ) &0xf ; + rd0 = (insn >>16 ) &0xf ; +gen_op_iwmmxt_movq_M0_wRn (rd0); + tmp =tcg_temp_new_i32 (); +if (gen_iwmmxt_shift (insn,0xff , tmp)) { +return 1 ; + } +switch ((insn >>22 ) &3 ) { +case 1 : +gen_helper_iwmmxt_srlw (cpu_M0, cpu_env, cpu_M0, tmp); +break ; +case 2 : +gen_helper_iwmmxt_srll (cpu_M0, cpu_env, cpu_M0, tmp); +break ; +case 3 : +gen_helper_iwmmxt_srlq (cpu_M0, cpu_env, cpu_M0, tmp); +break ; + } +gen_op_iwmmxt_movq_wRn_M0 (wrd); +gen_op_iwmmxt_set_mup (); +gen_op_iwmmxt_set_cup (); +break ; +case 0x004 :case 0x404 :case 0x804 :case 0xc04 :/* WSRA */ +case 0x014 :case 0x414 :case 0x814 :case 0xc14 : +if (((insn >>22 ) &3 ) ==0 ) { +return 1 ; + } + wrd = (insn >>12 ) &0xf ; + rd0 = (insn >>16 ) &0xf ; +gen_op_iwmmxt_movq_M0_wRn (rd0); + tmp =tcg_temp_new_i32 (); +if (gen_iwmmxt_shift (insn,0xff , tmp)) { +return 1 ; + } +switch ((insn >>22 ) &3 ) { +case 1 : +gen_helper_iwmmxt_sraw (cpu_M0, cpu_env, cpu_M0, tmp); +break ; +case 2 : +gen_helper_iwmmxt_sral (cpu_M0, cpu_env, cpu_M0, tmp); +break ; +case 3 : +gen_helper_iwmmxt_sraq (cpu_M0, cpu_env, cpu_M0, tmp); +break ; + } +gen_op_iwmmxt_movq_wRn_M0 (wrd); +gen_op_iwmmxt_set_mup (); +gen_op_iwmmxt_set_cup (); +break ; +case 0x104 :case 0x504 :case 0x904 :case 0xd04 :/* WSLL */ +case 0x114 :case 0x514 :case 0x914 :case 0xd14 : +if (((insn >>22 ) &3 ) ==0 ) { +return 1 ; + } + wrd = (insn >>12 ) &0xf ; + rd0 = (insn >>16 ) &0xf ; +gen_op_iwmmxt_movq_M0_wRn (rd0); + tmp =tcg_temp_new_i32 (); +if (gen_iwmmxt_shift (insn,0xff , tmp)) { +return 1 ; + } +switch ((insn >>22 ) &3 ) { +case 1 : +gen_helper_iwmmxt_sllw (cpu_M0, cpu_env, cpu_M0, tmp); +break ; +case 2 : +gen_helper_iwmmxt_slll (cpu_M0, cpu_env, cpu_M0, tmp); +break ; +case 3 : +gen_helper_iwmmxt_sllq (cpu_M0, cpu_env, cpu_M0, tmp); +break ; + } +gen_op_iwmmxt_movq_wRn_M0 (wrd); +gen_op_iwmmxt_set_mup (); +gen_op_iwmmxt_set_cup (); +break ; +case 0x304 :case 0x704 :case 0xb04 :case 0xf04 :/* WROR */ +case 0x314 :case 0x714 :case 0xb14 :case 0xf14 : +if (((insn >>22 ) &3 ) ==0 ) { +return 1 ; + } + wrd = (insn >>12 ) &0xf ; + rd0 = (insn >>16 ) &0xf ; +gen_op_iwmmxt_movq_M0_wRn (rd0); + tmp =tcg_temp_new_i32 (); +switch ((insn >>22 ) &3 ) { +case 1 : +if (gen_iwmmxt_shift (insn,0xf , tmp)) { +return 1 ; + } +gen_helper_iwmmxt_rorw (cpu_M0, cpu_env, cpu_M0, tmp); +break ; +case 2 : +if (gen_iwmmxt_shift (insn,0x1f , tmp)) { +return 1 ; + } +gen_helper_iwmmxt_rorl (cpu_M0, cpu_env, cpu_M0, tmp); +break ; +case 3 : +if (gen_iwmmxt_shift (insn,0x3f , tmp)) { +return 1 ; + } +gen_helper_iwmmxt_rorq (cpu_M0, cpu_env, cpu_M0, tmp); +break ; + } +gen_op_iwmmxt_movq_wRn_M0 (wrd); +gen_op_iwmmxt_set_mup (); +gen_op_iwmmxt_set_cup (); +break ; +case 0x116 :case 0x316 :case 0x516 :case 0x716 :/* WMIN */ +case 0x916 :case 0xb16 :case 0xd16 :case 0xf16 : + wrd = (insn >>12 ) &0xf ; + rd0 = (insn >>16 ) &0xf ; + rd1 = (insn >>0 ) &0xf ; +gen_op_iwmmxt_movq_M0_wRn (rd0); +switch ((insn >>22 ) &3 ) { +case 0 : +if (insn & (1 <<21 )) { +gen_op_iwmmxt_minsb_M0_wRn (rd1); + }else { +gen_op_iwmmxt_minub_M0_wRn (rd1); + } +break ; +case 1 : +if (insn & (1 <<21 )) { +gen_op_iwmmxt_minsw_M0_wRn (rd1); + }else { +gen_op_iwmmxt_minuw_M0_wRn (rd1); + } +break ; +case 2 : +if (insn & (1 <<21 )) { +gen_op_iwmmxt_minsl_M0_wRn (rd1); + }else { +gen_op_iwmmxt_minul_M0_wRn (rd1); + } +break ; +case 3 : +return 1 ; + } +gen_op_iwmmxt_movq_wRn_M0 (wrd); +gen_op_iwmmxt_set_mup (); +break ; +case 0x016 :case 0x216 :case 0x416 :case 0x616 :/* WMAX */ +case 0x816 :case 0xa16 :case 0xc16 :case 0xe16 : + wrd = (insn >>12 ) &0xf ; + rd0 = (insn >>16 ) &0xf ; + rd1 = (insn >>0 ) &0xf ; +gen_op_iwmmxt_movq_M0_wRn (rd0); +switch ((insn >>22 ) &3 ) { +case 0 : +if (insn & (1 <<21 )) { +gen_op_iwmmxt_maxsb_M0_wRn (rd1); + }else { +gen_op_iwmmxt_maxub_M0_wRn (rd1); + } +break ; +case 1 : +if (insn & (1 <<21 )) { +gen_op_iwmmxt_maxsw_M0_wRn (rd1); + }else { +gen_op_iwmmxt_maxuw_M0_wRn (rd1); + } +break ; +case 2 : +if (insn & (1 <<21 )) { +gen_op_iwmmxt_maxsl_M0_wRn (rd1); + }else { +gen_op_iwmmxt_maxul_M0_wRn (rd1); + } +break ; +case 3 : +return 1 ; + } +gen_op_iwmmxt_movq_wRn_M0 (wrd); +gen_op_iwmmxt_set_mup (); +break ; +case 0x002 :case 0x102 :case 0x202 :case 0x302 :/* WALIGNI */ +case 0x402 :case 0x502 :case 0x602 :case 0x702 : + wrd = (insn >>12 ) &0xf ; + rd0 = (insn >>16 ) &0xf ; + rd1 = (insn >>0 ) &0xf ; +gen_op_iwmmxt_movq_M0_wRn (rd0); +iwmmxt_load_reg (cpu_V1, rd1); +gen_helper_iwmmxt_align (cpu_M0, cpu_M0, cpu_V1, +tcg_constant_i32 ((insn >>20 ) &3 )); +gen_op_iwmmxt_movq_wRn_M0 (wrd); +gen_op_iwmmxt_set_mup (); +break ; +case 0x01a :case 0x11a :case 0x21a :case 0x31a :/* WSUB */ +case 0x41a :case 0x51a :case 0x61a :case 0x71a : +case 0x81a :case 0x91a :case 0xa1a :case 0xb1a : +case 0xc1a :case 0xd1a :case 0xe1a :case 0xf1a : + wrd = (insn >>12 ) &0xf ; + rd0 = (insn >>16 ) &0xf ; + rd1 = (insn >>0 ) &0xf ; +gen_op_iwmmxt_movq_M0_wRn (rd0); +switch ((insn >>20 ) &0xf ) { +case 0x0 : +gen_op_iwmmxt_subnb_M0_wRn (rd1); +break ; +case 0x1 : +gen_op_iwmmxt_subub_M0_wRn (rd1); +break ; +case 0x3 : +gen_op_iwmmxt_subsb_M0_wRn (rd1); +break ; +case 0x4 : +gen_op_iwmmxt_subnw_M0_wRn (rd1); +break ; +case 0x5 : +gen_op_iwmmxt_subuw_M0_wRn (rd1); +break ; +case 0x7 : +gen_op_iwmmxt_subsw_M0_wRn (rd1); +break ; +case 0x8 : +gen_op_iwmmxt_subnl_M0_wRn (rd1); +break ; +case 0x9 : +gen_op_iwmmxt_subul_M0_wRn (rd1); +break ; +case 0xb : +gen_op_iwmmxt_subsl_M0_wRn (rd1); +break ; +default : +return 1 ; + } +gen_op_iwmmxt_movq_wRn_M0 (wrd); +gen_op_iwmmxt_set_mup (); +gen_op_iwmmxt_set_cup (); +break ; +case 0x01e :case 0x11e :case 0x21e :case 0x31e :/* WSHUFH */ +case 0x41e :case 0x51e :case 0x61e :case 0x71e : +case 0x81e :case 0x91e :case 0xa1e :case 0xb1e : +case 0xc1e :case 0xd1e :case 0xe1e :case 0xf1e : + wrd = (insn >>12 ) &0xf ; + rd0 = (insn >>16 ) &0xf ; +gen_op_iwmmxt_movq_M0_wRn (rd0); + tmp =tcg_constant_i32 (((insn >>16 ) &0xf0 ) | (insn &0x0f )); +gen_helper_iwmmxt_shufh (cpu_M0, cpu_env, cpu_M0, tmp); +gen_op_iwmmxt_movq_wRn_M0 (wrd); +gen_op_iwmmxt_set_mup (); +gen_op_iwmmxt_set_cup (); +break ; +case 0x018 :case 0x118 :case 0x218 :case 0x318 :/* WADD */ +case 0x418 :case 0x518 :case 0x618 :case 0x718 : +case 0x818 :case 0x918 :case 0xa18 :case 0xb18 : +case 0xc18 :case 0xd18 :case 0xe18 :case 0xf18 : + wrd = (insn >>12 ) &0xf ; + rd0 = (insn >>16 ) &0xf ; + rd1 = (insn >>0 ) &0xf ; +gen_op_iwmmxt_movq_M0_wRn (rd0); +switch ((insn >>20 ) &0xf ) { +case 0x0 : +gen_op_iwmmxt_addnb_M0_wRn (rd1); +break ; +case 0x1 : +gen_op_iwmmxt_addub_M0_wRn (rd1); +break ; +case 0x3 : +gen_op_iwmmxt_addsb_M0_wRn (rd1); +break ; +case 0x4 : +gen_op_iwmmxt_addnw_M0_wRn (rd1); +break ; +case 0x5 : +gen_op_iwmmxt_adduw_M0_wRn (rd1); +break ; +case 0x7 : +gen_op_iwmmxt_addsw_M0_wRn (rd1); +break ; +case 0x8 : +gen_op_iwmmxt_addnl_M0_wRn (rd1); +break ; +case 0x9 : +gen_op_iwmmxt_addul_M0_wRn (rd1); +break ; +case 0xb : +gen_op_iwmmxt_addsl_M0_wRn (rd1); +break ; +default : +return 1 ; + } +gen_op_iwmmxt_movq_wRn_M0 (wrd); +gen_op_iwmmxt_set_mup (); +gen_op_iwmmxt_set_cup (); +break ; +case 0x008 :case 0x108 :case 0x208 :case 0x308 :/* WPACK */ +case 0x408 :case 0x508 :case 0x608 :case 0x708 : +case 0x808 :case 0x908 :case 0xa08 :case 0xb08 : +case 0xc08 :case 0xd08 :case 0xe08 :case 0xf08 : +if (!(insn & (1 <<20 )) || ((insn >>22 ) &3 ) ==0 ) { +return 1 ; + } + wrd = (insn >>12 ) &0xf ; + rd0 = (insn >>16 ) &0xf ; + rd1 = (insn >>0 ) &0xf ; +gen_op_iwmmxt_movq_M0_wRn (rd0); +switch ((insn >>22 ) &3 ) { +case 1 : +if (insn & (1 <<21 )) { +gen_op_iwmmxt_packsw_M0_wRn (rd1); + }else { +gen_op_iwmmxt_packuw_M0_wRn (rd1); + } +break ; +case 2 : +if (insn & (1 <<21 )) { +gen_op_iwmmxt_packsl_M0_wRn (rd1); + }else { +gen_op_iwmmxt_packul_M0_wRn (rd1); + } +break ; +case 3 : +if (insn & (1 <<21 )) { +gen_op_iwmmxt_packsq_M0_wRn (rd1); + }else { +gen_op_iwmmxt_packuq_M0_wRn (rd1); + } +break ; + } +gen_op_iwmmxt_movq_wRn_M0 (wrd); +gen_op_iwmmxt_set_mup (); +gen_op_iwmmxt_set_cup (); +break ; +case 0x201 :case 0x203 :case 0x205 :case 0x207 : +case 0x209 :case 0x20b :case 0x20d :case 0x20f : +case 0x211 :case 0x213 :case 0x215 :case 0x217 : +case 0x219 :case 0x21b :case 0x21d :case 0x21f : + wrd = (insn >>5 ) &0xf ; + rd0 = (insn >>12 ) &0xf ; + rd1 = (insn >>0 ) &0xf ; +if (rd0 ==0xf || rd1 ==0xf ) { +return 1 ; + } +gen_op_iwmmxt_movq_M0_wRn (wrd); + tmp =load_reg (s, rd0); + tmp2 =load_reg (s, rd1); +switch ((insn >>16 ) &0xf ) { +case 0x0 :/* TMIA */ +gen_helper_iwmmxt_muladdsl (cpu_M0, cpu_M0, tmp, tmp2); +break ; +case 0x8 :/* TMIAPH */ +gen_helper_iwmmxt_muladdsw (cpu_M0, cpu_M0, tmp, tmp2); +break ; +case 0xc :case 0xd :case 0xe :case 0xf :/* TMIAxy */ +if (insn & (1 <<16 )) { +tcg_gen_shri_i32 (tmp, tmp,16 ); + } +if (insn & (1 <<17 )) { +tcg_gen_shri_i32 (tmp2, tmp2,16 ); + } +gen_helper_iwmmxt_muladdswl (cpu_M0, cpu_M0, tmp, tmp2); +break ; +default : +return 1 ; + } +gen_op_iwmmxt_movq_wRn_M0 (wrd); +gen_op_iwmmxt_set_mup (); +break ; +default : +return 1 ; + } + +return 0 ; +} + +/* +* Disassemble an XScale DSP instruction. +* Returns nonzero if an error occurred (ie. an undefined instruction). +*/ +int disas_dsp_insn (DisasContext *s,uint32_t insn) +{ +int acc, rd0, rd1, rdhi, rdlo; +TCGv_i32 tmp, tmp2; + +if ((insn &0x0ff00f10 ) ==0x0e200010 ) { +/* Multiply with Internal Accumulate Format */ + rd0 = (insn >>12 ) &0xf ; + rd1 = insn &0xf ; + acc = (insn >>5 ) &7 ; + +if (acc !=0 ) { +return 1 ; + } + + tmp =load_reg (s, rd0); + tmp2 =load_reg (s, rd1); +switch ((insn >>16 ) &0xf ) { +case 0x0 :/* MIA */ +gen_helper_iwmmxt_muladdsl (cpu_M0, cpu_M0, tmp, tmp2); +break ; +case 0x8 :/* MIAPH */ +gen_helper_iwmmxt_muladdsw (cpu_M0, cpu_M0, tmp, tmp2); +break ; +case 0xc :/* MIABB */ +case 0xd :/* MIABT */ +case 0xe :/* MIATB */ +case 0xf :/* MIATT */ +if (insn & (1 <<16 )) { +tcg_gen_shri_i32 (tmp, tmp,16 ); + } +if (insn & (1 <<17 )) { +tcg_gen_shri_i32 (tmp2, tmp2,16 ); + } +gen_helper_iwmmxt_muladdswl (cpu_M0, cpu_M0, tmp, tmp2); +break ; +default : +return 1 ; + } + +gen_op_iwmmxt_movq_wRn_M0 (acc); +return 0 ; + } + +if ((insn &0x0fe00ff8 ) ==0x0c400000 ) { +/* Internal Accumulator Access Format */ + rdhi = (insn >>16 ) &0xf ; + rdlo = (insn >>12 ) &0xf ; + acc = insn &7 ; + +if (acc !=0 ) { +return 1 ; + } + +if (insn &ARM_CP_RW_BIT ) {/* MRA */ +iwmmxt_load_reg (cpu_V0, acc); +tcg_gen_extrl_i64_i32 (cpu_R[rdlo], cpu_V0); +tcg_gen_extrh_i64_i32 (cpu_R[rdhi], cpu_V0); +tcg_gen_andi_i32 (cpu_R[rdhi], cpu_R[rdhi], (1 << (40 -32 )) -1 ); + }else {/* MAR */ +tcg_gen_concat_i32_i64 (cpu_V0, cpu_R[rdlo], cpu_R[rdhi]); +iwmmxt_store_reg (cpu_V0, acc); + } +return 0 ; + } + +return 1 ; +}
target/arm/tcg/translate.c +0 -1312
1,318 lines not on this page · raw message
target/arm/tcg/meson.build +1 -0
@@ -21,6 +21,7 @@ arm_ss.add(gen) arm_ss.add(files( 'cpu32.c', 'translate.c', + 'translate-iwmmxt.c', 'translate-m-nocp.c', 'translate-mve.c', 'translate-neon.c',
Signature · 1 line
2.38.1
Re: [PATCH 08/22] target/arm/tcg: Extract iwmmxt code to translate-iwmmxt.c
Quoted 16 lines · Philippe Mathieu-Daudé
Extract 1300 lines from the big enough
translate.c.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/arm/tcg/translate-iwmmxt.c | 1334 +++++++++++++++++++++++++++++ target/arm/tcg/translate.c | 1312 ---------------------------- target/arm/tcg/meson.build | 1 + 3 files changed, 1335 insertions(+), 1312 deletions(-)create mode 100644
target/arm/tcg/translate-iwmmxt.ctarget/arm/tcg/translate-iwmmxt.c new file +0
-0
target/arm/tcg/translate-iwmmxt.c line 4
Quoted 4 lines
target/arm/tcg/translate-iwmmxt.c new file +4
-0@@ -0,0 +1,1334 @@ +/* +* AArch64 SVE translation +* +* Copyright (c) 2018 Linaro, Ltd
Argh, wrong copy/paste!
Quoted 13 lines
target/arm/tcg/translate-iwmmxt.c new file +13
-0+* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; either +* version 2.1 of the License, or (at your option) any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, see <http://www.gnu.org/licenses/>. +*/
Re: [PATCH 08/22] target/arm/tcg: Extract iwmmxt code to translate-iwmmxt.c
In reply to Philippe Mathieu-DaudéQuoted 9 lines · Philippe Mathieu-Daudé
Extract 1300 lines from the big enough
translate.c.Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- target/arm/tcg/translate-iwmmxt.c | 1334 +++++++++++++++++++++++++++++ target/arm/tcg/translate.c | 1312 ---------------------------- target/arm/tcg/meson.build | 1 + 3 files changed, 1335 insertions(+), 1312 deletions(-)create mode 100644
target/arm/tcg/translate-iwmmxt.c
r~
PATCH 9/22 target/arm/tcg: Reduce 'helper-iwmmxt.h.inc' inclusion
In reply to Philippe Mathieu-DaudéInstead of including helper-iwmmxt.h.inc via helper.h which is included by all TCG files, restrict it to the few files that require it.
--- target/arm/helper.h | 1 - target/arm/tcg/iwmmxt_helper.c | 6 +++++- target/arm/tcg/translate-iwmmxt.c | 6 ++++++ 3 files changed, 11 insertions(+), 2 deletions(-)
target/arm/helper.h +0 -1
@@ -949,5 +949,4 @@ DEF_HELPER_FLAGS_5(gvec_uclamp_d, TCG_CALL_NO_RWG,#include "tcg/helper-sme.h.inc" #endif -#include "tcg/helper-iwmmxt.h.inc" #include "tcg/helper-mve.h.inc"
target/arm/tcg/iwmmxt_helper.c +5 -1
@@ -22,7 +22,11 @@#include "qemu/osdep.h" #include "cpu.h" -#include "exec/helper-proto.h" + +#define HELPER_H "tcg/helper-iwmmxt.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H/* iwMMXt macros extracted from GNU gdb. */
target/arm/tcg/translate-iwmmxt.c +6 -0
@@ -21,6 +21,12 @@#include "translate.h" #include "translate-a32.h" +#define HELPER_H "tcg/helper-iwmmxt.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#include "exec/helper-info.c.inc" +#undef HELPER_H +#define ARM_CP_RW_BIT (1 << 20)static inline void iwmmxt_load_reg (TCGv_i64 var,int reg)
Signature · 1 line
2.38.1
Re: [PATCH 09/22] target/arm/tcg: Reduce 'helper-iwmmxt.h.inc' inclusion
Quoted 26 lines · Philippe Mathieu-Daudé
Instead of including helper-iwmmxt.h.inc via
helper.hwhich is included by all TCG files, restrict it to the few files that require it.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/arm/helper.h | 1 - target/arm/tcg/iwmmxt_helper.c | 6 +++++- target/arm/tcg/translate-iwmmxt.c | 6 ++++++ 3 files changed, 11 insertions(+), 2 deletions(-)target/arm/helper.h +0
-1@@ -949,5 +949,4 @@ DEF_HELPER_FLAGS_5(gvec_uclamp_d, TCG_CALL_NO_RWG,#include "tcg/helper-sme.h.inc" #endif -#include "tcg/helper-iwmmxt.h.inc" #include "tcg/helper-mve.h.inc" target/arm/tcg/iwmmxt_helper.c +0
-0
target/arm/tcg/iwmmxt_helper.c line 29
Quoted 9 lines
target/arm/tcg/iwmmxt_helper.c +5
-1@@ -22,7 +22,11 @@#include "qemu/osdep.h" #include "cpu.h" -#include "exec/helper-proto.h" + +#define HELPER_H "tcg/helper-iwmmxt.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H
You should only require helper-proto.h.inc here.
Otherwise,
This was exactly the sort of thing that I had in mind.
r~
Re: [PATCH 09/22] target/arm/tcg: Reduce 'helper-iwmmxt.h.inc' inclusion
Quoted 28 lines · Richard Henderson
Quoted 27 lines · Philippe Mathieu-Daudé
Instead of including helper-iwmmxt.h.inc via
helper.hwhich is included by all TCG files, restrict it to the few files that require it.Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
target/arm/helper.h | 1 -
target/arm/tcg/iwmmxt_helper.c | 6 +++++-
target/arm/tcg/translate-iwmmxt.c| 6 ++++++3 files changed, 11 insertions(+), 2 deletions(-)target/arm/helper.h +0
-1@@ -949,5 +949,4 @@ DEF_HELPER_FLAGS_5(gvec_uclamp_d, TCG_CALL_NO_RWG, #include "tcg/helper-sme.h.inc" #endif -#include "tcg/helper-iwmmxt.h.inc" #include "tcg/helper-mve.h.inc"target/arm/tcg/iwmmxt_helper.c +0
-0@@ -22,7 +22,11 @@ #include "qemu/osdep.h" #include "cpu.h"
Quoted 8 lines
target/arm/tcg/iwmmxt_helper.c line 29
Quoted 6 lines
target/arm/tcg/iwmmxt_helper.c +5
-1-#include "exec/helper-proto.h" + +#define HELPER_H "tcg/helper-iwmmxt.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_HYou should only require helper-proto.h.inc here.
Oh, good point.
Quoted 4 lines
Otherwise,
Reviewed-by Richard Henderson <[email protected]>This was exactly the sort of thing that I had in mind.
Good :)
PATCH 10/22 target/arm/tcg: Extract VFP definitions to 'helper-vfp.h.inc'
In reply to Philippe Mathieu-Daudéhelper.h is used by all units, but not all require the VFP definitions. Move them to a new header; the next commit will remove it from the common helper.h.
--- target/arm/helper.h | 137 +------------------------------- target/arm/tcg/helper-vfp.h.inc | 136 +++++++++++++++++++++++++++++++ 2 files changed, 137 insertions(+), 136 deletions(-) create mode 100644 target/arm/tcg/helper-vfp.h.inc
target/arm/helper.h +1 -136
@@ -106,144 +106,8 @@ DEF_HELPER_FLAGS_5(probe_access, TCG_CALL_NO_WG, void, env, tl, i32, i32, i32) DEF_HELPER_1(vfp_get_fpscr, i32, env) DEF_HELPER_2(vfp_set_fpscr, void, env, i32) -DEF_HELPER_3(vfp_addh, f16, f16, f16, ptr) -DEF_HELPER_3(vfp_adds, f32, f32, f32, ptr) -DEF_HELPER_3(vfp_addd, f64, f64, f64, ptr) -DEF_HELPER_3(vfp_subh, f16, f16, f16, ptr) -DEF_HELPER_3(vfp_subs, f32, f32, f32, ptr) -DEF_HELPER_3(vfp_subd, f64, f64, f64, ptr) -DEF_HELPER_3(vfp_mulh, f16, f16, f16, ptr) -DEF_HELPER_3(vfp_muls, f32, f32, f32, ptr) -DEF_HELPER_3(vfp_muld, f64, f64, f64, ptr) -DEF_HELPER_3(vfp_divh, f16, f16, f16, ptr) -DEF_HELPER_3(vfp_divs, f32, f32, f32, ptr) -DEF_HELPER_3(vfp_divd, f64, f64, f64, ptr) -DEF_HELPER_3(vfp_maxh, f16, f16, f16, ptr) -DEF_HELPER_3(vfp_maxs, f32, f32, f32, ptr) -DEF_HELPER_3(vfp_maxd, f64, f64, f64, ptr) -DEF_HELPER_3(vfp_minh, f16, f16, f16, ptr) -DEF_HELPER_3(vfp_mins, f32, f32, f32, ptr) -DEF_HELPER_3(vfp_mind, f64, f64, f64, ptr) -DEF_HELPER_3(vfp_maxnumh, f16, f16, f16, ptr) -DEF_HELPER_3(vfp_maxnums, f32, f32, f32, ptr) -DEF_HELPER_3(vfp_maxnumd, f64, f64, f64, ptr) -DEF_HELPER_3(vfp_minnumh, f16, f16, f16, ptr) -DEF_HELPER_3(vfp_minnums, f32, f32, f32, ptr) -DEF_HELPER_3(vfp_minnumd, f64, f64, f64, ptr) -DEF_HELPER_1(vfp_negh, f16, f16) -DEF_HELPER_1(vfp_negs, f32, f32) -DEF_HELPER_1(vfp_negd, f64, f64) -DEF_HELPER_1(vfp_absh, f16, f16) -DEF_HELPER_1(vfp_abss, f32, f32) -DEF_HELPER_1(vfp_absd, f64, f64) -DEF_HELPER_2(vfp_sqrth, f16, f16, env) -DEF_HELPER_2(vfp_sqrts, f32, f32, env) -DEF_HELPER_2(vfp_sqrtd, f64, f64, env) -DEF_HELPER_3(vfp_cmph, void, f16, f16, env) -DEF_HELPER_3(vfp_cmps, void, f32, f32, env) -DEF_HELPER_3(vfp_cmpd, void, f64, f64, env) -DEF_HELPER_3(vfp_cmpeh, void, f16, f16, env) -DEF_HELPER_3(vfp_cmpes, void, f32, f32, env) -DEF_HELPER_3(vfp_cmped, void, f64, f64, env) - -DEF_HELPER_2(vfp_fcvtds, f64, f32, env) -DEF_HELPER_2(vfp_fcvtsd, f32, f64, env) -DEF_HELPER_FLAGS_2(bfcvt, TCG_CALL_NO_RWG, i32, f32, ptr) -DEF_HELPER_FLAGS_2(bfcvt_pair, TCG_CALL_NO_RWG, i32, i64, ptr) - -DEF_HELPER_2(vfp_uitoh, f16, i32, ptr) -DEF_HELPER_2(vfp_uitos, f32, i32, ptr) -DEF_HELPER_2(vfp_uitod, f64, i32, ptr) -DEF_HELPER_2(vfp_sitoh, f16, i32, ptr) -DEF_HELPER_2(vfp_sitos, f32, i32, ptr) -DEF_HELPER_2(vfp_sitod, f64, i32, ptr) - -DEF_HELPER_2(vfp_touih, i32, f16, ptr) -DEF_HELPER_2(vfp_touis, i32, f32, ptr) -DEF_HELPER_2(vfp_touid, i32, f64, ptr) -DEF_HELPER_2(vfp_touizh, i32, f16, ptr) -DEF_HELPER_2(vfp_touizs, i32, f32, ptr) -DEF_HELPER_2(vfp_touizd, i32, f64, ptr) -DEF_HELPER_2(vfp_tosih, s32, f16, ptr) -DEF_HELPER_2(vfp_tosis, s32, f32, ptr) -DEF_HELPER_2(vfp_tosid, s32, f64, ptr) -DEF_HELPER_2(vfp_tosizh, s32, f16, ptr) -DEF_HELPER_2(vfp_tosizs, s32, f32, ptr) -DEF_HELPER_2(vfp_tosizd, s32, f64, ptr) - -DEF_HELPER_3(vfp_toshh_round_to_zero, i32, f16, i32, ptr) -DEF_HELPER_3(vfp_toslh_round_to_zero, i32, f16, i32, ptr) -DEF_HELPER_3(vfp_touhh_round_to_zero, i32, f16, i32, ptr) -DEF_HELPER_3(vfp_toulh_round_to_zero, i32, f16, i32, ptr) -DEF_HELPER_3(vfp_toshs_round_to_zero, i32, f32, i32, ptr) -DEF_HELPER_3(vfp_tosls_round_to_zero, i32, f32, i32, ptr) -DEF_HELPER_3(vfp_touhs_round_to_zero, i32, f32, i32, ptr) -DEF_HELPER_3(vfp_touls_round_to_zero, i32, f32, i32, ptr) -DEF_HELPER_3(vfp_toshd_round_to_zero, i64, f64, i32, ptr) -DEF_HELPER_3(vfp_tosld_round_to_zero, i64, f64, i32, ptr) -DEF_HELPER_3(vfp_touhd_round_to_zero, i64, f64, i32, ptr) -DEF_HELPER_3(vfp_tould_round_to_zero, i64, f64, i32, ptr) -DEF_HELPER_3(vfp_touhh, i32, f16, i32, ptr) -DEF_HELPER_3(vfp_toshh, i32, f16, i32, ptr) -DEF_HELPER_3(vfp_toulh, i32, f16, i32, ptr) -DEF_HELPER_3(vfp_toslh, i32, f16, i32, ptr) -DEF_HELPER_3(vfp_touqh, i64, f16, i32, ptr) -DEF_HELPER_3(vfp_tosqh, i64, f16, i32, ptr) -DEF_HELPER_3(vfp_toshs, i32, f32, i32, ptr) -DEF_HELPER_3(vfp_tosls, i32, f32, i32, ptr) -DEF_HELPER_3(vfp_tosqs, i64, f32, i32, ptr) -DEF_HELPER_3(vfp_touhs, i32, f32, i32, ptr) -DEF_HELPER_3(vfp_touls, i32, f32, i32, ptr) -DEF_HELPER_3(vfp_touqs, i64, f32, i32, ptr) -DEF_HELPER_3(vfp_toshd, i64, f64, i32, ptr) -DEF_HELPER_3(vfp_tosld, i64, f64, i32, ptr) -DEF_HELPER_3(vfp_tosqd, i64, f64, i32, ptr) -DEF_HELPER_3(vfp_touhd, i64, f64, i32, ptr) -DEF_HELPER_3(vfp_tould, i64, f64, i32, ptr) -DEF_HELPER_3(vfp_touqd, i64, f64, i32, ptr) -DEF_HELPER_3(vfp_shtos, f32, i32, i32, ptr) -DEF_HELPER_3(vfp_sltos, f32, i32, i32, ptr) -DEF_HELPER_3(vfp_sqtos, f32, i64, i32, ptr) -DEF_HELPER_3(vfp_uhtos, f32, i32, i32, ptr) -DEF_HELPER_3(vfp_ultos, f32, i32, i32, ptr) -DEF_HELPER_3(vfp_uqtos, f32, i64, i32, ptr) -DEF_HELPER_3(vfp_shtod, f64, i64, i32, ptr) -DEF_HELPER_3(vfp_sltod, f64, i64, i32, ptr) -DEF_HELPER_3(vfp_sqtod, f64, i64, i32, ptr) -DEF_HELPER_3(vfp_uhtod, f64, i64, i32, ptr) -DEF_HELPER_3(vfp_ultod, f64, i64, i32, ptr) -DEF_HELPER_3(vfp_uqtod, f64, i64, i32, ptr) -DEF_HELPER_3(vfp_shtoh, f16, i32, i32, ptr) -DEF_HELPER_3(vfp_uhtoh, f16, i32, i32, ptr) -DEF_HELPER_3(vfp_sltoh, f16, i32, i32, ptr) -DEF_HELPER_3(vfp_ultoh, f16, i32, i32, ptr) -DEF_HELPER_3(vfp_sqtoh, f16, i64, i32, ptr) -DEF_HELPER_3(vfp_uqtoh, f16, i64, i32, ptr) - -DEF_HELPER_3(vfp_shtos_round_to_nearest, f32, i32, i32, ptr) -DEF_HELPER_3(vfp_sltos_round_to_nearest, f32, i32, i32, ptr) -DEF_HELPER_3(vfp_uhtos_round_to_nearest, f32, i32, i32, ptr) -DEF_HELPER_3(vfp_ultos_round_to_nearest, f32, i32, i32, ptr) -DEF_HELPER_3(vfp_shtod_round_to_nearest, f64, i64, i32, ptr) -DEF_HELPER_3(vfp_sltod_round_to_nearest, f64, i64, i32, ptr) -DEF_HELPER_3(vfp_uhtod_round_to_nearest, f64, i64, i32, ptr) -DEF_HELPER_3(vfp_ultod_round_to_nearest, f64, i64, i32, ptr) -DEF_HELPER_3(vfp_shtoh_round_to_nearest, f16, i32, i32, ptr) -DEF_HELPER_3(vfp_uhtoh_round_to_nearest, f16, i32, i32, ptr) -DEF_HELPER_3(vfp_sltoh_round_to_nearest, f16, i32, i32, ptr) -DEF_HELPER_3(vfp_ultoh_round_to_nearest, f16, i32, i32, ptr) - DEF_HELPER_FLAGS_2(set_rmode, TCG_CALL_NO_RWG, i32, i32, ptr) -DEF_HELPER_FLAGS_3(vfp_fcvt_f16_to_f32, TCG_CALL_NO_RWG, f32, f16, ptr, i32) -DEF_HELPER_FLAGS_3(vfp_fcvt_f32_to_f16, TCG_CALL_NO_RWG, f16, f32, ptr, i32) -DEF_HELPER_FLAGS_3(vfp_fcvt_f16_to_f64, TCG_CALL_NO_RWG, f64, f16, ptr, i32) -DEF_HELPER_FLAGS_3(vfp_fcvt_f64_to_f16, TCG_CALL_NO_RWG, f16, f64, ptr, i32) - -DEF_HELPER_4(vfp_muladdd, f64, f64, f64, f64, ptr) -DEF_HELPER_4(vfp_muladds, f32, f32, f32, f32, ptr) -DEF_HELPER_4(vfp_muladdh, f16, f16, f16, f16, ptr) - DEF_HELPER_FLAGS_2(recpe_f16, TCG_CALL_NO_RWG, f16, f16, ptr) DEF_HELPER_FLAGS_2(recpe_f32, TCG_CALL_NO_RWG, f32, f32, ptr)DEF_HELPER_FLAGS_2 (recpe_f64,TCG_CALL_NO_RWG , f64, f64, ptr)
@@ -949,4 +813,5 @@ DEF_HELPER_FLAGS_5(gvec_uclamp_d, TCG_CALL_NO_RWG,#include "tcg/helper-sme.h.inc" #endif +#include "tcg/helper-vfp.h.inc" #include "tcg/helper-mve.h.inc"
target/arm/tcg/helper-vfp.h.inc new file +136 -0
136 lines not on this page · raw message
Signature · 1 line
2.38.1
Re: [PATCH 10/22] target/arm/tcg: Extract VFP definitions to 'helper-vfp.h.inc'
Quoted 10 lines · Philippe Mathieu-Daudé
helper.his used by all units, but not all require the VFP definitions. Move them to a new header; the next commit will remove it from the commonhelper.h.Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- target/arm/helper.h | 137 +------------------------------- target/arm/tcg/helper-vfp.h.inc | 136 +++++++++++++++++++++++++++++++ 2 files changed, 137 insertions(+), 136 deletions(-)create mode 100644 target/arm/tcg/helper-vfp.h.inc
r~
PATCH 11/22 target/arm/tcg: Reduce 'helper-vfp.h.inc' inclusion
In reply to Philippe Mathieu-DaudéInstead of including helper-vfp.h.inc via helper.h which is included by all TCG files, restrict it to the few files that require it.
--- target/arm/helper.h | 1 - target/arm/tcg/mve_helper.c | 5 +++++ target/arm/tcg/sve_helper.c | 4 ++++ target/arm/tcg/translate-a64.c | 5 +++++ target/arm/tcg/translate-neon.c | 5 +++++ target/arm/tcg/translate-vfp.c | 6 ++++++ target/arm/tcg/vec_helper.c | 5 +++++ target/arm/vfp_helper.c | 5 +++++ 8 files changed, 35 insertions(+), 1 deletion(-)
target/arm/helper.h +0 -1
@@ -813,5 +813,4 @@ DEF_HELPER_FLAGS_5(gvec_uclamp_d, TCG_CALL_NO_RWG,#include "tcg/helper-sme.h.inc" #endif -#include "tcg/helper-vfp.h.inc" #include "tcg/helper-mve.h.inc"
target/arm/tcg/mve_helper.c +5 -0
@@ -27,6 +27,11 @@#include "tcg/tcg.h" #include "fpu/softfloat.h" +#define HELPER_H "tcg/helper-vfp.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H +static uint16_t mve_eci_mask (CPUARMState *env) {/*
target/arm/tcg/sve_helper.c +4 -0
@@ -29,6 +29,10 @@#include "sve_ldst_internal.h" #include "hw/core/tcg-cpu-ops.h" +#define HELPER_H "tcg/helper-vfp.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H/* Return a value for NZCV as per the ARM PredTest pseudofunction. *
target/arm/tcg/translate-a64.c +5 -0
@@ -26,6 +26,11 @@#include "semihosting/semihost.h" #include "cpregs.h" +#define HELPER_H "tcg/helper-vfp.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H +static TCGv_i64 cpu_X[32 ];static TCGv_i64 cpu_pc;
target/arm/tcg/translate-neon.c +5 -0
@@ -24,6 +24,11 @@#include "translate.h" #include "translate-a32.h" +#define HELPER_H "tcg/helper-vfp.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H +/* Include the generated Neon decoder */ #include "decode-neon-dp.c.inc" #include "decode-neon-ls.c.inc"
target/arm/tcg/translate-vfp.c +6 -0
@@ -24,6 +24,12 @@#include "translate.h" #include "translate-a32.h" +#define HELPER_H "tcg/helper-vfp.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#include "exec/helper-info.c.inc" +#undef HELPER_H +/* Include the generated VFP decoder */ #include "decode-vfp.c.inc" #include "decode-vfp-uncond.c.inc"
target/arm/tcg/vec_helper.c +5 -0
@@ -25,6 +25,11 @@#include "qemu/int128.h" #include "vec_internal.h" +#define HELPER_H "tcg/helper-vfp.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H +/* * Data for expanding active predicate bits to bytes, for byte elements. *
target/arm/vfp_helper.c +5 -0
@@ -32,6 +32,11 @@#ifdef CONFIG_TCG +#define HELPER_H "tcg/helper-vfp.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H +/* Convert host exception flags to vfp form. */ static inline int vfp_exceptbits_from_host (int host_bits) {
Signature · 1 line
2.38.1
Re: [PATCH 11/22] target/arm/tcg: Reduce 'helper-vfp.h.inc' inclusion
Quoted 31 lines · Philippe Mathieu-Daudé
Instead of including helper-vfp.h.inc via
helper.hwhich is included by all TCG files, restrict it to the few files that require it.Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- target/arm/helper.h | 1 - target/arm/tcg/mve_helper.c | 5 +++++ target/arm/tcg/sve_helper.c | 4 ++++ target/arm/tcg/translate-a64.c | 5 +++++ target/arm/tcg/translate-neon.c | 5 +++++ target/arm/tcg/translate-vfp.c | 6 ++++++ target/arm/tcg/vec_helper.c | 5 +++++ target/arm/vfp_helper.c | 5 +++++ 8 files changed, 35 insertions(+), 1 deletion(-)target/arm/helper.h +0
-1@@ -813,5 +813,4 @@ DEF_HELPER_FLAGS_5(gvec_uclamp_d, TCG_CALL_NO_RWG,#include "tcg/helper-sme.h.inc" #endif -#include "tcg/helper-vfp.h.inc" #include "tcg/helper-mve.h.inc" target/arm/tcg/mve_helper.c +0
-0
target/arm/tcg/mve_helper.c line 34
Quoted 8 lines
target/arm/tcg/mve_helper.c +5
-0@@ -27,6 +27,11 @@#include "tcg/tcg.h" #include "fpu/softfloat.h" +#define HELPER_H "tcg/helper-vfp.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H +
Again, none of the *_helper.c need helper-gen.h.inc, only prototypes.
r~
PATCH 12/22 target/arm/tcg: Move neon_tbl() from op_helper.c to neon_helper.c
In reply to Philippe Mathieu-Daudéneon_tbl() helper is only called by NEON files. No need to have it in the generic op_helper.c, move it with the rest of the NEON helpers.
--- target/arm/tcg/neon_helper.c | 22 ++++++++++++++++++++++ target/arm/tcg/op_helper.c | 22 ---------------------- 2 files changed, 22 insertions(+), 22 deletions(-)
target/arm/tcg/neon_helper.c +22 -0
@@ -1738,3 +1738,25 @@ void HELPER(neon_zip16)(void *vd, void *vm) rm[0 ] = m0; rd[0 ] = d0; } + +uint64_t HELPER (neon_tbl )(CPUARMState *env,uint32_t desc, +uint64_t ireg,uint64_t def) +{ +uint64_t tmp, val =0 ; +uint32_t maxindex = ((desc &3 ) +1 ) *8 ; +uint32_t base_reg = desc >>2 ; +uint32_t shift, index, reg; + +for (shift =0 ; shift <64 ; shift +=8 ) { + index = (ireg >> shift) &0xff ; +if (index < maxindex) { + reg = base_reg + (index >>3 ); + tmp = *aa32_vfp_dreg (env, reg); + tmp = ((tmp >> ((index &7 ) <<3 )) &0xff ) << shift; + }else { + tmp = def & (0xffull << shift); + } + val |= tmp; + } +return val; +}
target/arm/tcg/op_helper.c +0 -22
@@ -82,28 +82,6 @@ void raise_exception_ra(CPUARMState *env, uint32_t excp, uint32_t syndrome,raise_exception (env, excp, syndrome, target_el); } -uint64_t HELPER (neon_tbl )(CPUARMState *env,uint32_t desc, -uint64_t ireg,uint64_t def) -{ -uint64_t tmp, val =0 ; -uint32_t maxindex = ((desc &3 ) +1 ) *8 ; -uint32_t base_reg = desc >>2 ; -uint32_t shift, index, reg; - -for (shift =0 ; shift <64 ; shift +=8 ) { - index = (ireg >> shift) &0xff ; -if (index < maxindex) { - reg = base_reg + (index >>3 ); - tmp = *aa32_vfp_dreg (env, reg); - tmp = ((tmp >> ((index &7 ) <<3 )) &0xff ) << shift; - }else { - tmp = def & (0xffull << shift); - } - val |= tmp; - } -return val; -} -void HELPER (v8m_stackcheck )(CPUARMState *env,uint32_t newvalue) {/*
Signature · 1 line
2.38.1
Re: [PATCH 12/22] target/arm/tcg: Move neon_tbl() from op_helper.c to neon_helper.c
Quoted 9 lines · Philippe Mathieu-Daudé
neon_tbl()helper is only called by NEON files. No need to have it in the genericop_helper.c, move it with the rest of the NEON helpers.Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- target/arm/tcg/neon_helper.c | 22 ++++++++++++++++++++++ target/arm/tcg/op_helper.c | 22 ---------------------- 2 files changed, 22 insertions(+), 22 deletions(-)
r~
PATCH 13/22 target/arm/tcg: Extract NEON definitions to 'helper-neon.h.inc'
In reply to Philippe Mathieu-Daudéhelper.h is used by all units, but not all require the NEON definitions. Move them to a new header; the next commit will remove it from the common helper.h.
--- target/arm/helper.h | 206 +------------------------------ target/arm/tcg/helper-neon.h.inc | 205 ++++++++++++++++++++++++++++++ 2 files changed, 206 insertions(+), 205 deletions(-) create mode 100644 target/arm/tcg/helper-neon.h.inc
target/arm/helper.h +1 -205
@@ -116,7 +116,6 @@ DEF_HELPER_FLAGS_2(rsqrte_f32, TCG_CALL_NO_RWG, f32, f32, ptr) DEF_HELPER_FLAGS_2(rsqrte_f64, TCG_CALL_NO_RWG, f64, f64, ptr) DEF_HELPER_FLAGS_1(recpe_u32, TCG_CALL_NO_RWG, i32, i32) DEF_HELPER_FLAGS_1(rsqrte_u32, TCG_CALL_NO_RWG, i32, i32) -DEF_HELPER_FLAGS_4(neon_tbl, TCG_CALL_NO_RWG, i64, env, i32, i64, i64) DEF_HELPER_3(shl_cc, i32, env, i32, i32)DEF_HELPER_3 (shr_cc, i32, env, i32, i32)
@@ -135,191 +134,6 @@ DEF_HELPER_FLAGS_2(fjcvtzs, TCG_CALL_NO_RWG, i64, f64, ptr) DEF_HELPER_FLAGS_3(check_hcr_el2_trap, TCG_CALL_NO_WG, void, env, i32, i32) -/* neon_helper.c */ -DEF_HELPER_FLAGS_3(neon_qadd_u8, TCG_CALL_NO_RWG, i32, env, i32, i32) -DEF_HELPER_FLAGS_3(neon_qadd_s8, TCG_CALL_NO_RWG, i32, env, i32, i32) -DEF_HELPER_FLAGS_3(neon_qadd_u16, TCG_CALL_NO_RWG, i32, env, i32, i32) -DEF_HELPER_FLAGS_3(neon_qadd_s16, TCG_CALL_NO_RWG, i32, env, i32, i32) -DEF_HELPER_FLAGS_3(neon_qadd_u32, TCG_CALL_NO_RWG, i32, env, i32, i32) -DEF_HELPER_FLAGS_3(neon_qadd_s32, TCG_CALL_NO_RWG, i32, env, i32, i32) -DEF_HELPER_FLAGS_3(neon_uqadd_s8, TCG_CALL_NO_RWG, i32, env, i32, i32) -DEF_HELPER_FLAGS_3(neon_uqadd_s16, TCG_CALL_NO_RWG, i32, env, i32, i32) -DEF_HELPER_FLAGS_3(neon_uqadd_s32, TCG_CALL_NO_RWG, i32, env, i32, i32) -DEF_HELPER_FLAGS_3(neon_uqadd_s64, TCG_CALL_NO_RWG, i64, env, i64, i64) -DEF_HELPER_FLAGS_3(neon_sqadd_u8, TCG_CALL_NO_RWG, i32, env, i32, i32) -DEF_HELPER_FLAGS_3(neon_sqadd_u16, TCG_CALL_NO_RWG, i32, env, i32, i32) -DEF_HELPER_FLAGS_3(neon_sqadd_u32, TCG_CALL_NO_RWG, i32, env, i32, i32) -DEF_HELPER_FLAGS_3(neon_sqadd_u64, TCG_CALL_NO_RWG, i64, env, i64, i64) -DEF_HELPER_3(neon_qsub_u8, i32, env, i32, i32) -DEF_HELPER_3(neon_qsub_s8, i32, env, i32, i32) -DEF_HELPER_3(neon_qsub_u16, i32, env, i32, i32) -DEF_HELPER_3(neon_qsub_s16, i32, env, i32, i32) -DEF_HELPER_3(neon_qsub_u32, i32, env, i32, i32) -DEF_HELPER_3(neon_qsub_s32, i32, env, i32, i32) -DEF_HELPER_3(neon_qadd_u64, i64, env, i64, i64) -DEF_HELPER_3(neon_qadd_s64, i64, env, i64, i64) -DEF_HELPER_3(neon_qsub_u64, i64, env, i64, i64) -DEF_HELPER_3(neon_qsub_s64, i64, env, i64, i64) - -DEF_HELPER_2(neon_hadd_s8, i32, i32, i32) -DEF_HELPER_2(neon_hadd_u8, i32, i32, i32) -DEF_HELPER_2(neon_hadd_s16, i32, i32, i32) -DEF_HELPER_2(neon_hadd_u16, i32, i32, i32) -DEF_HELPER_2(neon_hadd_s32, s32, s32, s32) -DEF_HELPER_2(neon_hadd_u32, i32, i32, i32) -DEF_HELPER_2(neon_rhadd_s8, i32, i32, i32) -DEF_HELPER_2(neon_rhadd_u8, i32, i32, i32) -DEF_HELPER_2(neon_rhadd_s16, i32, i32, i32) -DEF_HELPER_2(neon_rhadd_u16, i32, i32, i32) -DEF_HELPER_2(neon_rhadd_s32, s32, s32, s32) -DEF_HELPER_2(neon_rhadd_u32, i32, i32, i32) -DEF_HELPER_2(neon_hsub_s8, i32, i32, i32) -DEF_HELPER_2(neon_hsub_u8, i32, i32, i32) -DEF_HELPER_2(neon_hsub_s16, i32, i32, i32) -DEF_HELPER_2(neon_hsub_u16, i32, i32, i32) -DEF_HELPER_2(neon_hsub_s32, s32, s32, s32) -DEF_HELPER_2(neon_hsub_u32, i32, i32, i32) - -DEF_HELPER_2(neon_pmin_u8, i32, i32, i32) -DEF_HELPER_2(neon_pmin_s8, i32, i32, i32) -DEF_HELPER_2(neon_pmin_u16, i32, i32, i32) -DEF_HELPER_2(neon_pmin_s16, i32, i32, i32) -DEF_HELPER_2(neon_pmax_u8, i32, i32, i32) -DEF_HELPER_2(neon_pmax_s8, i32, i32, i32) -DEF_HELPER_2(neon_pmax_u16, i32, i32, i32) -DEF_HELPER_2(neon_pmax_s16, i32, i32, i32) - -DEF_HELPER_2(neon_shl_u16, i32, i32, i32) -DEF_HELPER_2(neon_shl_s16, i32, i32, i32) -DEF_HELPER_2(neon_rshl_u8, i32, i32, i32) -DEF_HELPER_2(neon_rshl_s8, i32, i32, i32) -DEF_HELPER_2(neon_rshl_u16, i32, i32, i32) -DEF_HELPER_2(neon_rshl_s16, i32, i32, i32) -DEF_HELPER_2(neon_rshl_u32, i32, i32, i32) -DEF_HELPER_2(neon_rshl_s32, i32, i32, i32) -DEF_HELPER_2(neon_rshl_u64, i64, i64, i64) -DEF_HELPER_2(neon_rshl_s64, i64, i64, i64) -DEF_HELPER_3(neon_qshl_u8, i32, env, i32, i32) -DEF_HELPER_3(neon_qshl_s8, i32, env, i32, i32) -DEF_HELPER_3(neon_qshl_u16, i32, env, i32, i32) -DEF_HELPER_3(neon_qshl_s16, i32, env, i32, i32) -DEF_HELPER_3(neon_qshl_u32, i32, env, i32, i32) -DEF_HELPER_3(neon_qshl_s32, i32, env, i32, i32) -DEF_HELPER_3(neon_qshl_u64, i64, env, i64, i64) -DEF_HELPER_3(neon_qshl_s64, i64, env, i64, i64) -DEF_HELPER_3(neon_qshlu_s8, i32, env, i32, i32) -DEF_HELPER_3(neon_qshlu_s16, i32, env, i32, i32) -DEF_HELPER_3(neon_qshlu_s32, i32, env, i32, i32) -DEF_HELPER_3(neon_qshlu_s64, i64, env, i64, i64) -DEF_HELPER_3(neon_qrshl_u8, i32, env, i32, i32) -DEF_HELPER_3(neon_qrshl_s8, i32, env, i32, i32) -DEF_HELPER_3(neon_qrshl_u16, i32, env, i32, i32) -DEF_HELPER_3(neon_qrshl_s16, i32, env, i32, i32) -DEF_HELPER_3(neon_qrshl_u32, i32, env, i32, i32) -DEF_HELPER_3(neon_qrshl_s32, i32, env, i32, i32) -DEF_HELPER_3(neon_qrshl_u64, i64, env, i64, i64) -DEF_HELPER_3(neon_qrshl_s64, i64, env, i64, i64) - -DEF_HELPER_2(neon_add_u8, i32, i32, i32) -DEF_HELPER_2(neon_add_u16, i32, i32, i32) -DEF_HELPER_2(neon_padd_u8, i32, i32, i32) -DEF_HELPER_2(neon_padd_u16, i32, i32, i32) -DEF_HELPER_2(neon_sub_u8, i32, i32, i32) -DEF_HELPER_2(neon_sub_u16, i32, i32, i32) -DEF_HELPER_2(neon_mul_u8, i32, i32, i32) -DEF_HELPER_2(neon_mul_u16, i32, i32, i32) - -DEF_HELPER_2(neon_tst_u8, i32, i32, i32) -DEF_HELPER_2(neon_tst_u16, i32, i32, i32) -DEF_HELPER_2(neon_tst_u32, i32, i32, i32) - -DEF_HELPER_1(neon_clz_u8, i32, i32) -DEF_HELPER_1(neon_clz_u16, i32, i32) -DEF_HELPER_1(neon_cls_s8, i32, i32) -DEF_HELPER_1(neon_cls_s16, i32, i32) -DEF_HELPER_1(neon_cls_s32, i32, i32) -DEF_HELPER_1(neon_cnt_u8, i32, i32) -DEF_HELPER_FLAGS_1(neon_rbit_u8, TCG_CALL_NO_RWG_SE, i32, i32) - -DEF_HELPER_3(neon_qdmulh_s16, i32, env, i32, i32) -DEF_HELPER_3(neon_qrdmulh_s16, i32, env, i32, i32) -DEF_HELPER_4(neon_qrdmlah_s16, i32, env, i32, i32, i32) -DEF_HELPER_4(neon_qrdmlsh_s16, i32, env, i32, i32, i32) -DEF_HELPER_3(neon_qdmulh_s32, i32, env, i32, i32) -DEF_HELPER_3(neon_qrdmulh_s32, i32, env, i32, i32) -DEF_HELPER_4(neon_qrdmlah_s32, i32, env, s32, s32, s32) -DEF_HELPER_4(neon_qrdmlsh_s32, i32, env, s32, s32, s32) - -DEF_HELPER_1(neon_narrow_u8, i32, i64) -DEF_HELPER_1(neon_narrow_u16, i32, i64) -DEF_HELPER_2(neon_unarrow_sat8, i32, env, i64) -DEF_HELPER_2(neon_narrow_sat_u8, i32, env, i64) -DEF_HELPER_2(neon_narrow_sat_s8, i32, env, i64) -DEF_HELPER_2(neon_unarrow_sat16, i32, env, i64) -DEF_HELPER_2(neon_narrow_sat_u16, i32, env, i64) -DEF_HELPER_2(neon_narrow_sat_s16, i32, env, i64) -DEF_HELPER_2(neon_unarrow_sat32, i32, env, i64) -DEF_HELPER_2(neon_narrow_sat_u32, i32, env, i64) -DEF_HELPER_2(neon_narrow_sat_s32, i32, env, i64) -DEF_HELPER_1(neon_narrow_high_u8, i32, i64) -DEF_HELPER_1(neon_narrow_high_u16, i32, i64) -DEF_HELPER_1(neon_narrow_round_high_u8, i32, i64) -DEF_HELPER_1(neon_narrow_round_high_u16, i32, i64) -DEF_HELPER_1(neon_widen_u8, i64, i32) -DEF_HELPER_1(neon_widen_s8, i64, i32) -DEF_HELPER_1(neon_widen_u16, i64, i32) -DEF_HELPER_1(neon_widen_s16, i64, i32) - -DEF_HELPER_2(neon_addl_u16, i64, i64, i64) -DEF_HELPER_2(neon_addl_u32, i64, i64, i64) -DEF_HELPER_2(neon_paddl_u16, i64, i64, i64) -DEF_HELPER_2(neon_paddl_u32, i64, i64, i64) -DEF_HELPER_2(neon_subl_u16, i64, i64, i64) -DEF_HELPER_2(neon_subl_u32, i64, i64, i64) -DEF_HELPER_3(neon_addl_saturate_s32, i64, env, i64, i64) -DEF_HELPER_3(neon_addl_saturate_s64, i64, env, i64, i64) -DEF_HELPER_2(neon_abdl_u16, i64, i32, i32) -DEF_HELPER_2(neon_abdl_s16, i64, i32, i32) -DEF_HELPER_2(neon_abdl_u32, i64, i32, i32) -DEF_HELPER_2(neon_abdl_s32, i64, i32, i32) -DEF_HELPER_2(neon_abdl_u64, i64, i32, i32) -DEF_HELPER_2(neon_abdl_s64, i64, i32, i32) -DEF_HELPER_2(neon_mull_u8, i64, i32, i32) -DEF_HELPER_2(neon_mull_s8, i64, i32, i32) -DEF_HELPER_2(neon_mull_u16, i64, i32, i32) -DEF_HELPER_2(neon_mull_s16, i64, i32, i32) - -DEF_HELPER_1(neon_negl_u16, i64, i64) -DEF_HELPER_1(neon_negl_u32, i64, i64) - -DEF_HELPER_FLAGS_2(neon_qabs_s8, TCG_CALL_NO_RWG, i32, env, i32) -DEF_HELPER_FLAGS_2(neon_qabs_s16, TCG_CALL_NO_RWG, i32, env, i32) -DEF_HELPER_FLAGS_2(neon_qabs_s32, TCG_CALL_NO_RWG, i32, env, i32) -DEF_HELPER_FLAGS_2(neon_qabs_s64, TCG_CALL_NO_RWG, i64, env, i64) -DEF_HELPER_FLAGS_2(neon_qneg_s8, TCG_CALL_NO_RWG, i32, env, i32) -DEF_HELPER_FLAGS_2(neon_qneg_s16, TCG_CALL_NO_RWG, i32, env, i32) -DEF_HELPER_FLAGS_2(neon_qneg_s32, TCG_CALL_NO_RWG, i32, env, i32) -DEF_HELPER_FLAGS_2(neon_qneg_s64, TCG_CALL_NO_RWG, i64, env, i64) - -DEF_HELPER_3(neon_ceq_f32, i32, i32, i32, ptr) -DEF_HELPER_3(neon_cge_f32, i32, i32, i32, ptr) -DEF_HELPER_3(neon_cgt_f32, i32, i32, i32, ptr) -DEF_HELPER_3(neon_acge_f32, i32, i32, i32, ptr) -DEF_HELPER_3(neon_acgt_f32, i32, i32, i32, ptr) -DEF_HELPER_3(neon_acge_f64, i64, i64, i64, ptr) -DEF_HELPER_3(neon_acgt_f64, i64, i64, i64, ptr) - -DEF_HELPER_FLAGS_2(neon_unzip8, TCG_CALL_NO_RWG, void, ptr, ptr) -DEF_HELPER_FLAGS_2(neon_unzip16, TCG_CALL_NO_RWG, void, ptr, ptr) -DEF_HELPER_FLAGS_2(neon_qunzip8, TCG_CALL_NO_RWG, void, ptr, ptr) -DEF_HELPER_FLAGS_2(neon_qunzip16, TCG_CALL_NO_RWG, void, ptr, ptr) -DEF_HELPER_FLAGS_2(neon_qunzip32, TCG_CALL_NO_RWG, void, ptr, ptr) -DEF_HELPER_FLAGS_2(neon_zip8, TCG_CALL_NO_RWG, void, ptr, ptr) -DEF_HELPER_FLAGS_2(neon_zip16, TCG_CALL_NO_RWG, void, ptr, ptr) -DEF_HELPER_FLAGS_2(neon_qzip8, TCG_CALL_NO_RWG, void, ptr, ptr) -DEF_HELPER_FLAGS_2(neon_qzip16, TCG_CALL_NO_RWG, void, ptr, ptr) -DEF_HELPER_FLAGS_2(neon_qzip32, TCG_CALL_NO_RWG, void, ptr, ptr) - DEF_HELPER_FLAGS_4(crypto_aese, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)DEF_HELPER_FLAGS_3 (crypto_aesmc,TCG_CALL_NO_RWG , void, ptr, ptr, i32)
@@ -421,13 +235,6 @@ DEF_HELPER_FLAGS_6(gvec_fcmlas_idx, TCG_CALL_NO_RWG,DEF_HELPER_FLAGS_6 (gvec_fcmlad,TCG_CALL_NO_RWG , void, ptr, ptr, ptr, ptr, ptr, i32) -DEF_HELPER_FLAGS_5(neon_paddh, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) -DEF_HELPER_FLAGS_5(neon_pmaxh, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) -DEF_HELPER_FLAGS_5(neon_pminh, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) -DEF_HELPER_FLAGS_5(neon_padds, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) -DEF_HELPER_FLAGS_5(neon_pmaxs, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) -DEF_HELPER_FLAGS_5(neon_pmins, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) - DEF_HELPER_FLAGS_4(gvec_sstoh, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_sitos, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)DEF_HELPER_FLAGS_4 (gvec_ustoh,TCG_CALL_NO_RWG , void, ptr, ptr, ptr, i32)
@@ -648,8 +455,6 @@ DEF_HELPER_FLAGS_4(gvec_ushl_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_pmul_b, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_pmull_q, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) -DEF_HELPER_FLAGS_4(neon_pmull_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) - DEF_HELPER_FLAGS_3(gvec_ssra_b, TCG_CALL_NO_RWG, void, ptr, ptr, i32) DEF_HELPER_FLAGS_3(gvec_ssra_h, TCG_CALL_NO_RWG, void, ptr, ptr, i32)DEF_HELPER_FLAGS_3 (gvec_ssra_s,TCG_CALL_NO_RWG , void, ptr, ptr, i32)
@@ -728,16 +533,6 @@ DEF_HELPER_FLAGS_5(gvec_mls_idx_s, TCG_CALL_NO_RWG,DEF_HELPER_FLAGS_5 (gvec_mls_idx_d,TCG_CALL_NO_RWG , void, ptr, ptr, ptr, ptr, i32) -DEF_HELPER_FLAGS_5 (neon_sqdmulh_h,TCG_CALL_NO_RWG , - void, ptr, ptr, ptr, ptr, i32) -DEF_HELPER_FLAGS_5 (neon_sqdmulh_s,TCG_CALL_NO_RWG , - void, ptr, ptr, ptr, ptr, i32) - -DEF_HELPER_FLAGS_5 (neon_sqrdmulh_h,TCG_CALL_NO_RWG , - void, ptr, ptr, ptr, ptr, i32) -DEF_HELPER_FLAGS_5 (neon_sqrdmulh_s,TCG_CALL_NO_RWG , - void, ptr, ptr, ptr, ptr, i32) - DEF_HELPER_FLAGS_4(sve2_sqdmulh_b, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(sve2_sqdmulh_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)DEF_HELPER_FLAGS_4 (sve2_sqdmulh_s,TCG_CALL_NO_RWG , void, ptr, ptr, ptr, i32)
@@ -813,4 +608,5 @@ DEF_HELPER_FLAGS_5(gvec_uclamp_d, TCG_CALL_NO_RWG,#include "tcg/helper-sme.h.inc" #endif +#include "tcg/helper-neon.h.inc" #include "tcg/helper-mve.h.inc"
target/arm/tcg/helper-neon.h.inc new file +205 -0
205 lines not on this page · raw message
Signature · 1 line
2.38.1
Re: [PATCH 13/22] target/arm/tcg: Extract NEON definitions to 'helper-neon.h.inc'
Quoted 10 lines · Philippe Mathieu-Daudé
helper.his used by all units, but not all require the NEON definitions. Move them to a new header; the next commit will remove it from the commonhelper.h.Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- target/arm/helper.h | 206 +------------------------------ target/arm/tcg/helper-neon.h.inc | 205 ++++++++++++++++++++++++++++++ 2 files changed, 206 insertions(+), 205 deletions(-)create mode 100644 target/arm/tcg/helper-neon.h.inc
r~
PATCH 14/22 target/arm/tcg: Reduce 'helper-neon.h.inc' inclusion
In reply to Philippe Mathieu-DaudéInstead of including helper-neon.h.inc via helper.h which is included by all TCG files, restrict it to the few files that require it.
--- target/arm/helper.h | 1 - target/arm/tcg/neon_helper.c | 6 +++++- target/arm/tcg/translate-a64.c | 5 +++++ target/arm/tcg/translate-neon.c | 6 ++++++ target/arm/tcg/translate-sme.c | 5 +++++ target/arm/tcg/translate.c | 5 +++++ target/arm/tcg/vec_helper.c | 5 +++++ 7 files changed, 31 insertions(+), 2 deletions(-)
target/arm/helper.h +0 -1
@@ -608,5 +608,4 @@ DEF_HELPER_FLAGS_5(gvec_uclamp_d, TCG_CALL_NO_RWG,#include "tcg/helper-sme.h.inc" #endif -#include "tcg/helper-neon.h.inc" #include "tcg/helper-mve.h.inc"
target/arm/tcg/neon_helper.c +5 -1
@@ -9,10 +9,14 @@#include "qemu/osdep.h" #include "cpu.h" -#include "exec/helper-proto.h" #include "fpu/softfloat.h" #include "vec_internal.h" +#define HELPER_H "tcg/helper-neon.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H +#define SIGNBIT (uint32_t)0x80000000#define SIGNBIT64 ((uint64_t)1 << 63)
target/arm/tcg/translate-a64.c +5 -0
@@ -31,6 +31,11 @@#include "exec/helper-gen.h.inc" #undef HELPER_H +#define HELPER_H "tcg/helper-neon.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H +static TCGv_i64 cpu_X[32 ];static TCGv_i64 cpu_pc;
target/arm/tcg/translate-neon.c +6 -0
@@ -29,6 +29,12 @@#include "exec/helper-gen.h.inc" #undef HELPER_H +#define HELPER_H "tcg/helper-neon.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#include "exec/helper-info.c.inc" +#undef HELPER_H +/* Include the generated Neon decoder */ #include "decode-neon-dp.c.inc" #include "decode-neon-ls.c.inc"
target/arm/tcg/translate-sme.c +5 -0
@@ -21,6 +21,11 @@#include "translate.h" #include "translate-a64.h" +#define HELPER_H "tcg/helper-neon.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H +/* * Include the generated decoder. */
target/arm/tcg/translate.c +5 -0
@@ -29,6 +29,11 @@#include "cpregs.h" #include "exec/helper-proto.h" +#define HELPER_H "tcg/helper-neon.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H +#define HELPER_H "helper.h"#include "exec/helper-info.c.inc" #undef HELPER_H
target/arm/tcg/vec_helper.c +5 -0
@@ -30,6 +30,11 @@#include "exec/helper-gen.h.inc" #undef HELPER_H +#define HELPER_H "tcg/helper-neon.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H +/* * Data for expanding active predicate bits to bytes, for byte elements. *
Signature · 1 line
2.38.1
Re: [PATCH 14/22] target/arm/tcg: Reduce 'helper-neon.h.inc' inclusion
Quoted 32 lines · Philippe Mathieu-Daudé
Instead of including helper-neon.h.inc via
helper.hwhich is included by all TCG files, restrict it to the few files that require it.Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- target/arm/helper.h | 1 - target/arm/tcg/neon_helper.c | 6 +++++- target/arm/tcg/translate-a64.c | 5 +++++ target/arm/tcg/translate-neon.c | 6 ++++++ target/arm/tcg/translate-sme.c | 5 +++++ target/arm/tcg/translate.c | 5 +++++ target/arm/tcg/vec_helper.c | 5 +++++ 7 files changed, 31 insertions(+), 2 deletions(-)target/arm/helper.h +0
-1@@ -608,5 +608,4 @@ DEF_HELPER_FLAGS_5(gvec_uclamp_d, TCG_CALL_NO_RWG,#include "tcg/helper-sme.h.inc" #endif -#include "tcg/helper-neon.h.inc" #include "tcg/helper-mve.h.inc" target/arm/tcg/neon_helper.c +0
-0@@ -9,10 +9,14 @@#include "qemu/osdep.h"
target/arm/tcg/neon_helper.c line 19
Quoted 10 lines
target/arm/tcg/neon_helper.c +5
-1#include "cpu.h" -#include "exec/helper-proto.h" #include "fpu/softfloat.h" #include "vec_internal.h" +#define HELPER_H "tcg/helper-neon.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H +
Again, none of the *_helper.c need helper-gen.h.inc, only prototypes.
r~
PATCH 15/22 target/arm/tcg: Extract SVE2 definitions to 'helper-sve.h.inc'
In reply to Philippe Mathieu-Daudéhelper.h is used by all units, but not all require the SVE2 definitions. We already have helper-sve.h.inc for SVE* definitions, move them there. The next commit will remove it from the common helper.h.
--- target/arm/helper.h | 46 --------------------------------- target/arm/tcg/helper-sve.h.inc | 46 +++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 46 deletions(-)
target/arm/helper.h +0 -46
@@ -181,23 +181,6 @@ DEF_HELPER_FLAGS_5(gvec_qrdmlah_s32, TCG_CALL_NO_RWG,DEF_HELPER_FLAGS_5 (gvec_qrdmlsh_s32,TCG_CALL_NO_RWG , void, ptr, ptr, ptr, ptr, i32) -DEF_HELPER_FLAGS_5 (sve2_sqrdmlah_b,TCG_CALL_NO_RWG , - void, ptr, ptr, ptr, ptr, i32) -DEF_HELPER_FLAGS_5 (sve2_sqrdmlsh_b,TCG_CALL_NO_RWG , - void, ptr, ptr, ptr, ptr, i32) -DEF_HELPER_FLAGS_5 (sve2_sqrdmlah_h,TCG_CALL_NO_RWG , - void, ptr, ptr, ptr, ptr, i32) -DEF_HELPER_FLAGS_5 (sve2_sqrdmlsh_h,TCG_CALL_NO_RWG , - void, ptr, ptr, ptr, ptr, i32) -DEF_HELPER_FLAGS_5 (sve2_sqrdmlah_s,TCG_CALL_NO_RWG , - void, ptr, ptr, ptr, ptr, i32) -DEF_HELPER_FLAGS_5 (sve2_sqrdmlsh_s,TCG_CALL_NO_RWG , - void, ptr, ptr, ptr, ptr, i32) -DEF_HELPER_FLAGS_5 (sve2_sqrdmlah_d,TCG_CALL_NO_RWG , - void, ptr, ptr, ptr, ptr, i32) -DEF_HELPER_FLAGS_5 (sve2_sqrdmlsh_d,TCG_CALL_NO_RWG , - void, ptr, ptr, ptr, ptr, i32) - DEF_HELPER_FLAGS_5(gvec_sdot_b, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_5(gvec_udot_b, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32)DEF_HELPER_FLAGS_5 (gvec_sdot_h,TCG_CALL_NO_RWG , void, ptr, ptr, ptr, ptr, i32)
@@ -533,35 +516,6 @@ DEF_HELPER_FLAGS_5(gvec_mls_idx_s, TCG_CALL_NO_RWG,DEF_HELPER_FLAGS_5 (gvec_mls_idx_d,TCG_CALL_NO_RWG , void, ptr, ptr, ptr, ptr, i32) -DEF_HELPER_FLAGS_4(sve2_sqdmulh_b, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) -DEF_HELPER_FLAGS_4(sve2_sqdmulh_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) -DEF_HELPER_FLAGS_4(sve2_sqdmulh_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) -DEF_HELPER_FLAGS_4(sve2_sqdmulh_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) - -DEF_HELPER_FLAGS_4(sve2_sqrdmulh_b, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) -DEF_HELPER_FLAGS_4(sve2_sqrdmulh_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) -DEF_HELPER_FLAGS_4(sve2_sqrdmulh_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) -DEF_HELPER_FLAGS_4(sve2_sqrdmulh_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) - -DEF_HELPER_FLAGS_4 (sve2_sqdmulh_idx_h,TCG_CALL_NO_RWG , - void, ptr, ptr, ptr, i32) -DEF_HELPER_FLAGS_4 (sve2_sqdmulh_idx_s,TCG_CALL_NO_RWG , - void, ptr, ptr, ptr, i32) -DEF_HELPER_FLAGS_4 (sve2_sqdmulh_idx_d,TCG_CALL_NO_RWG , - void, ptr, ptr, ptr, i32) - -DEF_HELPER_FLAGS_4 (sve2_sqrdmulh_idx_h,TCG_CALL_NO_RWG , - void, ptr, ptr, ptr, i32) -DEF_HELPER_FLAGS_4 (sve2_sqrdmulh_idx_s,TCG_CALL_NO_RWG , - void, ptr, ptr, ptr, i32) -DEF_HELPER_FLAGS_4 (sve2_sqrdmulh_idx_d,TCG_CALL_NO_RWG , - void, ptr, ptr, ptr, i32) - -DEF_HELPER_FLAGS_6 (sve2_fmlal_zzzw_s,TCG_CALL_NO_RWG , - void, ptr, ptr, ptr, ptr, ptr, i32) -DEF_HELPER_FLAGS_6 (sve2_fmlal_zzxw_s,TCG_CALL_NO_RWG , - void, ptr, ptr, ptr, ptr, ptr, i32) - DEF_HELPER_FLAGS_4(gvec_xar_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_5(gvec_smmla_b, TCG_CALL_NO_RWG,
target/arm/tcg/helper-sve.h.inc +46 -0
49 lines not on this page · raw message
Signature · 1 line
2.38.1
Re: [PATCH 15/22] target/arm/tcg: Extract SVE2 definitions to 'helper-sve.h.inc'
Quoted 10 lines · Philippe Mathieu-Daudé
helper.his used by all units, but not all require the SVE2 definitions. We already have helper-sve.h.inc for SVE* definitions, move them there. The next commit will remove it from the commonhelper.h.Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- target/arm/helper.h | 46 --------------------------------- target/arm/tcg/helper-sve.h.inc | 46 +++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 46 deletions(-)
r~
PATCH 16/22 target/arm/tcg: Reduce 'helper-sve.h.inc' inclusion
In reply to Philippe Mathieu-DaudéInstead of including helper-sve.h.inc via helper.h which is included by all TCG files, restrict it to the few files that require it.
--- target/arm/helper.h | 1 - target/arm/tcg/sve_helper.c | 5 +++++ target/arm/tcg/translate-sme.c | 5 +++++ target/arm/tcg/translate-sve.c | 5 +++++ target/arm/tcg/vec_helper.c | 5 +++++ 5 files changed, 20 insertions(+), 1 deletion(-)
target/arm/helper.h +0 -1
@@ -558,7 +558,6 @@ DEF_HELPER_FLAGS_5(gvec_uclamp_d, TCG_CALL_NO_RWG,#ifdef TARGET_AARCH64 #include "tcg/helper-a64.h.inc" -#include "tcg/helper-sve.h.inc" #include "tcg/helper-sme.h.inc" #endif
target/arm/tcg/sve_helper.c +5 -0
@@ -34,6 +34,11 @@#include "exec/helper-gen.h.inc" #undef HELPER_H +#define HELPER_H "tcg/helper-sve.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H +/* Return a value for NZCV as per the ARM PredTest pseudofunction. * * The return value has bit 31 set if N is set, bit 1 set if Z is clear,
target/arm/tcg/translate-sme.c +5 -0
@@ -26,6 +26,11 @@#include "exec/helper-gen.h.inc" #undef HELPER_H +#define HELPER_H "tcg/helper-sve.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H +/* * Include the generated decoder. */
target/arm/tcg/translate-sve.c +5 -0
@@ -22,6 +22,11 @@#include "translate-a64.h" #include "fpu/softfloat.h" +#define HELPER_H "tcg/helper-sve.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#include "exec/helper-info.c.inc" +#undef HELPER_Htypedef void GVecGen2sFn (unsigned ,uint32_t ,uint32_t ,TCGv_i64 ,uint32_t ,uint32_t );
target/arm/tcg/vec_helper.c +5 -0
@@ -35,6 +35,11 @@#include "exec/helper-gen.h.inc" #undef HELPER_H +#define HELPER_H "tcg/helper-sve.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H +/* * Data for expanding active predicate bits to bytes, for byte elements. *
Signature · 1 line
2.38.1
PATCH 17/22 target/arm/tcg: Reduce 'helper-mve.h.inc' inclusion
In reply to Philippe Mathieu-DaudéInstead of including helper-mve.h.inc via helper.h which is included by all TCG files, restrict it to the few files that require it.
--- target/arm/helper.h | 2 -- target/arm/tcg/mve_helper.c | 5 +++++ target/arm/tcg/translate-mve.c | 6 ++++++ target/arm/tcg/translate.c | 5 +++++ 4 files changed, 16 insertions(+), 2 deletions(-)
target/arm/helper.h +0 -2
@@ -560,5 +560,3 @@ DEF_HELPER_FLAGS_5(gvec_uclamp_d, TCG_CALL_NO_RWG,#include "tcg/helper-a64.h.inc" #include "tcg/helper-sme.h.inc" #endif - -#include "tcg/helper-mve.h.inc"
target/arm/tcg/mve_helper.c +5 -0
@@ -32,6 +32,11 @@#include "exec/helper-gen.h.inc" #undef HELPER_H +#define HELPER_H "tcg/helper-mve.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H +static uint16_t mve_eci_mask (CPUARMState *env) {/*
target/arm/tcg/translate-mve.c +6 -0
@@ -21,6 +21,12 @@#include "translate.h" #include "translate-a32.h" +#define HELPER_H "tcg/helper-mve.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#include "exec/helper-info.c.inc" +#undef HELPER_H +static inline int vidup_imm (DisasContext *s,int x) {return 1 << x;
target/arm/tcg/translate.c +5 -0
@@ -34,6 +34,11 @@#include "exec/helper-gen.h.inc" #undef HELPER_H +#define HELPER_H "tcg/helper-mve.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H +#define HELPER_H "helper.h"#include "exec/helper-info.c.inc" #undef HELPER_H
Signature · 1 line
2.38.1
PATCH 18/22 target/arm/tcg: Define SME set_svcr() helper in common 'helper.h'
In reply to Philippe Mathieu-DaudéSME set_svcr() is called by handle_msr_i() in translate-a64.c. To be able to restrict helper-sme.h.inc to SME-specific files, move the set_svcr() helper definition into the common helper.h.
--- target/arm/helper.h | 1 + target/arm/tcg/helper-sme.h.inc | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-)
target/arm/helper.h +1 -0
@@ -558,5 +558,6 @@ DEF_HELPER_FLAGS_5(gvec_uclamp_d, TCG_CALL_NO_RWG,#ifdef TARGET_AARCH64 #include "tcg/helper-a64.h.inc" +DEF_HELPER_FLAGS_3(set_svcr, TCG_CALL_NO_RWG, void, env, i32, i32) /* SME */#include "tcg/helper-sme.h.inc" #endif
target/arm/tcg/helper-sme.h.inc +0 -2
@@ -17,8 +17,6 @@ * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ -DEF_HELPER_FLAGS_3(set_svcr, TCG_CALL_NO_RWG, void, env, i32, i32) - DEF_HELPER_FLAGS_3(sme_zero, TCG_CALL_NO_RWG, void, env, i32, i32) /* Move to/from vertical array slices, i.e. columns, so 'c'. */
Signature · 1 line
2.38.1
Re: [PATCH 18/22] target/arm/tcg: Define SME set_svcr() helper in common 'helper.h'
Quoted 9 lines · Philippe Mathieu-Daudé
SME
set_svcr()is called byhandle_msr_i()intranslate-a64.c. To be able to restrict helper-sme.h.inc to SME-specific files, move theset_svcr()helper definition into the commonhelper.h.Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- target/arm/helper.h | 1 + target/arm/tcg/helper-sme.h.inc | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-)
r~
PATCH 19/22 target/arm/tcg: Reduce 'helper-sme.h.inc' inclusion
In reply to Philippe Mathieu-DaudéInstead of including helper-sme.h.inc via helper.h which is included by all TCG files, restrict it to the few files that require it.
--- target/arm/helper.h | 1 - target/arm/tcg/sme_helper.c | 5 +++++ target/arm/tcg/translate-sme.c | 6 ++++++ 3 files changed, 11 insertions(+), 1 deletion(-)
target/arm/helper.h +0 -1
@@ -559,5 +559,4 @@ DEF_HELPER_FLAGS_5(gvec_uclamp_d, TCG_CALL_NO_RWG,#ifdef TARGET_AARCH64 #include "tcg/helper-a64.h.inc" DEF_HELPER_FLAGS_3(set_svcr, TCG_CALL_NO_RWG, void, env, i32, i32) /* SME */ -#include "tcg/helper-sme.h.inc" #endif
target/arm/tcg/sme_helper.c +5 -0
@@ -29,6 +29,11 @@#include "vec_internal.h" #include "sve_ldst_internal.h" +#define HELPER_H "tcg/helper-sme.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H +void helper_set_svcr (CPUARMState *env,uint32_t val,uint32_t mask) {aarch64_set_svcr (env, val, mask);
target/arm/tcg/translate-sme.c +6 -0
@@ -31,6 +31,12 @@#include "exec/helper-gen.h.inc" #undef HELPER_H +#define HELPER_H "tcg/helper-sme.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#include "exec/helper-info.c.inc" +#undef HELPER_H +/* * Include the generated decoder. */
Signature · 1 line
2.38.1
PATCH 20/22 target/arm/tcg: Reduce 'helper-a64.h.inc' inclusion
In reply to Philippe Mathieu-DaudéInstead of including helper-a64.h.inc via helper.h which is included by all TCG files, restrict it to the few files that require it.
--- target/arm/helper.h | 1 - target/arm/tcg/helper-a64.c | 5 +++++ target/arm/tcg/mte_helper.c | 4 ++++ target/arm/tcg/pauth_helper.c | 4 ++++ target/arm/tcg/sve_helper.c | 5 +++++ target/arm/tcg/translate-a64.c | 6 ++++++ target/arm/tcg/vec_helper.c | 5 +++++ 7 files changed, 29 insertions(+), 1 deletion(-)
target/arm/helper.h +0 -1
@@ -557,6 +557,5 @@ DEF_HELPER_FLAGS_5(gvec_uclamp_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) #ifdef TARGET_AARCH64 -#include "tcg/helper-a64.h.inc" DEF_HELPER_FLAGS_3 (set_svcr ,TCG_CALL_NO_RWG ,void ,env ,i32 ,i32 )/* SME */ #endif
target/arm/tcg/helper-a64.c +5 -0
@@ -35,6 +35,11 @@#include "fpu/softfloat.h" #include <zlib.h> /* For crc32 */ +#define HELPER_H "tcg/helper-a64.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H +/* C2.4.7 Multiply and divide */ /* special cases for 0 and LLONG_MIN are mandated by the standard */ uint64_t HELPER (udiv64 )(uint64_t num,uint64_t den)
target/arm/tcg/mte_helper.c +4 -0
@@ -29,6 +29,10 @@#include "qapi/error.h" #include "qemu/guest-random.h" +#define HELPER_H "tcg/helper-a64.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_Hstatic int choose_nonexcluded_tag (int tag,int offset,uint16_t exclude) {
target/arm/tcg/pauth_helper.c +4 -0
@@ -26,6 +26,10 @@#include "tcg/tcg-gvec-desc.h" #include "qemu/xxhash.h" +#define HELPER_H "tcg/helper-a64.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_Hstatic uint64_t pac_cell_shuffle (uint64_t i) {
target/arm/tcg/sve_helper.c +5 -0
@@ -39,6 +39,11 @@#include "exec/helper-gen.h.inc" #undef HELPER_H +#define HELPER_H "tcg/helper-a64.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H +/* Return a value for NZCV as per the ARM PredTest pseudofunction. * * The return value has bit 31 set if N is set, bit 1 set if Z is clear,
target/arm/tcg/translate-a64.c +6 -0
@@ -36,6 +36,12 @@#include "exec/helper-gen.h.inc" #undef HELPER_H +#define HELPER_H "tcg/helper-a64.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#include "exec/helper-info.c.inc" +#undef HELPER_H +static TCGv_i64 cpu_X[32 ];static TCGv_i64 cpu_pc;
target/arm/tcg/vec_helper.c +5 -0
@@ -40,6 +40,11 @@#include "exec/helper-gen.h.inc" #undef HELPER_H +#define HELPER_H "tcg/helper-a64.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H +/* * Data for expanding active predicate bits to bytes, for byte elements. *
Signature · 1 line
2.38.1
PATCH 21/22 target/arm/tcg: Remove inclusions of 'exec/helper-[proto/gen].h'
In reply to Philippe Mathieu-DaudéInline "exec/helper-proto.h" and "exec/helper-gen.h". We can then move the 'helper.h' in tcg/ directory and rename it as 'helper.h.inc'.
---
target/arm/tcg/translate.h | 5 ++++-
target/arm/{helper.h => tcg/helper.h.inc} | 0
target/arm/debug_helper.c | 7 ++++++-
target/arm/helper.c | 7 ++++++-
target/arm/tcg/crypto_helper.c | 6 +++++-
target/arm/tcg/helper-a64.c | 6 +++++-
target/arm/tcg/hflags.c | 6 +++++-
target/arm/tcg/m_helper.c | 6 +++++-
target/arm/tcg/mte_helper.c | 1 -
target/arm/tcg/mve_helper.c | 6 +++++-
target/arm/tcg/op_helper.c | 6 +++++-
target/arm/tcg/pauth_helper.c | 1 -
target/arm/tcg/psci.c | 6 +++++-
target/arm/tcg/sme_helper.c | 6 +++++-
target/arm/tcg/sve_helper.c | 6 +++++-
target/arm/tcg/tlb_helper.c | 5 ++++-
target/arm/tcg/translate.c | 3 +--
target/arm/tcg/vec_helper.c | 6 +++++-
target/arm/vfp_helper.c | 6 +++++-
19 files changed, 76 insertions(+), 19 deletions(-)
rename target/arm/{helper.h => tcg/helper.h.inc} (100%)target/arm/tcg/translate.h +4 -1
@@ -6,9 +6,12 @@#include "tcg/tcg-op-gvec.h" #include "exec/exec-all.h" #include "exec/translator.h" -#include "exec/helper-gen.h" #include "internals.h" +#define HELPER_H "tcg/helper.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H/* internal defines */
target/arm/tcg/helper.h.inc renamed from target/arm/helper.h +0 -0
target/arm/debug_helper.c +6 -1
@@ -11,10 +11,15 @@#include "internals.h" #include "cpregs.h" #include "exec/exec-all.h" -#include "exec/helper-proto.h" #include "sysemu/tcg.h" #ifdef CONFIG_TCG + +#define HELPER_H "tcg/helper.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H +/* Return the Exception Level targeted by debug exceptions. */ static int arm_debug_target_el (CPUARMState *env) {
target/arm/helper.c +6 -1
@@ -11,7 +11,6 @@#include "trace.h" #include "cpu.h" #include "internals.h" -#include "exec/helper-proto.h" #include "qemu/main-loop.h" #include "qemu/timer.h" #include "qemu/bitops.h"
@@ -26,6 +25,12 @@#include "qapi/error.h" #include "qemu/guest-random.h" #ifdef CONFIG_TCG + +#define HELPER_H "tcg/helper.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H +#include "semihosting/common-semi.h" #endif #include "cpregs.h"
target/arm/tcg/crypto_helper.c +5 -1
@@ -12,12 +12,16 @@#include "qemu/osdep.h" #include "cpu.h" -#include "exec/helper-proto.h" #include "tcg/tcg-gvec-desc.h" #include "crypto/aes.h" #include "crypto/sm4.h" #include "vec_internal.h" +#define HELPER_H "tcg/helper.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H +union CRYPTO_STATE {uint8_t bytes[16 ];uint32_t words[4 ];
target/arm/tcg/helper-a64.c +5 -1
@@ -21,7 +21,6 @@#include "qemu/units.h" #include "cpu.h" #include "gdbstub/helpers.h" -#include "exec/helper-proto.h" #include "qemu/host-utils.h" #include "qemu/log.h" #include "qemu/main-loop.h"
@@ -35,6 +34,11 @@#include "fpu/softfloat.h" #include <zlib.h> /* For crc32 */ +#define HELPER_H "tcg/helper.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H +#define HELPER_H "tcg/helper-a64.h.inc"#include "exec/helper-proto.h.inc" #include "exec/helper-gen.h.inc"
target/arm/tcg/hflags.c +5 -1
@@ -8,9 +8,13 @@#include "qemu/osdep.h" #include "cpu.h" #include "internals.h" -#include "exec/helper-proto.h" #include "cpregs.h" +#define HELPER_H "tcg/helper.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H +static inline bool fgt_svc (CPUARMState *env,int el) {/*
target/arm/tcg/m_helper.c +5 -1
@@ -10,7 +10,6 @@#include "cpu.h" #include "internals.h" #include "gdbstub/helpers.h" -#include "exec/helper-proto.h" #include "qemu/main-loop.h" #include "qemu/bitops.h" #include "qemu/log.h"
@@ -21,6 +20,11 @@#include "hw/intc/armv7m_nvic.h" #endif +#define HELPER_H "tcg/helper.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H +static void v7m_msr_xpsr (CPUARMState *env,uint32_t mask,uint32_t reg,uint32_t val) {
target/arm/tcg/mte_helper.c +0 -1
@@ -24,7 +24,6 @@#include "exec/exec-all.h" #include "exec/ram_addr.h" #include "exec/cpu_ldst.h" -#include "exec/helper-proto.h" #include "hw/core/tcg-cpu-ops.h" #include "qapi/error.h" #include "qemu/guest-random.h"
target/arm/tcg/mve_helper.c +5 -1
@@ -21,12 +21,16 @@#include "cpu.h" #include "internals.h" #include "vec_internal.h" -#include "exec/helper-proto.h" #include "exec/cpu_ldst.h" #include "exec/exec-all.h" #include "tcg/tcg.h" #include "fpu/softfloat.h" +#define HELPER_H "tcg/helper.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H +#define HELPER_H "tcg/helper-vfp.h.inc"#include "exec/helper-proto.h.inc" #include "exec/helper-gen.h.inc"
target/arm/tcg/op_helper.c +5 -1
@@ -19,12 +19,16 @@#include "qemu/osdep.h" #include "qemu/main-loop.h" #include "cpu.h" -#include "exec/helper-proto.h" #include "internals.h" #include "exec/exec-all.h" #include "exec/cpu_ldst.h" #include "cpregs.h" +#define HELPER_H "tcg/helper.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H +#define SIGNBIT (uint32_t)0x80000000#define SIGNBIT64 ((uint64_t)1 << 63)
target/arm/tcg/pauth_helper.c +0 -1
@@ -22,7 +22,6 @@#include "internals.h" #include "exec/exec-all.h" #include "exec/cpu_ldst.h" -#include "exec/helper-proto.h" #include "tcg/tcg-gvec-desc.h" #include "qemu/xxhash.h"
target/arm/tcg/psci.c +5 -1
@@ -18,13 +18,17 @@#include "qemu/osdep.h" #include "cpu.h" -#include "exec/helper-proto.h" #include "kvm-consts.h" #include "qemu/main-loop.h" #include "sysemu/runstate.h" #include "internals.h" #include "arm-powerctl.h" +#define HELPER_H "tcg/helper.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H +bool arm_is_psci_call (ARMCPU *cpu,int excp_type) {/*
target/arm/tcg/sme_helper.c +5 -1
@@ -21,7 +21,6 @@#include "cpu.h" #include "internals.h" #include "tcg/tcg-gvec-desc.h" -#include "exec/helper-proto.h" #include "exec/cpu_ldst.h" #include "exec/exec-all.h" #include "qemu/int128.h"
@@ -29,6 +28,11 @@#include "vec_internal.h" #include "sve_ldst_internal.h" +#define HELPER_H "tcg/helper.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H +#define HELPER_H "tcg/helper-sme.h.inc"#include "exec/helper-proto.h.inc" #include "exec/helper-gen.h.inc"
target/arm/tcg/sve_helper.c +5 -1
@@ -21,7 +21,6 @@#include "cpu.h" #include "internals.h" #include "exec/exec-all.h" -#include "exec/helper-proto.h" #include "tcg/tcg-gvec-desc.h" #include "fpu/softfloat.h" #include "tcg/tcg.h"
@@ -29,6 +28,11 @@#include "sve_ldst_internal.h" #include "hw/core/tcg-cpu-ops.h" +#define HELPER_H "tcg/helper.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H +#define HELPER_H "tcg/helper-vfp.h.inc"#include "exec/helper-proto.h.inc" #include "exec/helper-gen.h.inc"
target/arm/tcg/tlb_helper.c +4 -1
@@ -9,8 +9,11 @@#include "cpu.h" #include "internals.h" #include "exec/exec-all.h" -#include "exec/helper-proto.h" +#define HELPER_H "tcg/helper.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H/* * Returns true if the stage 1 translation regime is using LPAE format page
target/arm/tcg/translate.c +1 -2
@@ -27,7 +27,6 @@#include "arm_ldst.h" #include "semihosting/semihost.h" #include "cpregs.h" -#include "exec/helper-proto.h" #define HELPER_H "tcg/helper-neon.h.inc"#include "exec/helper-proto.h.inc"
@@ -39,7 +38,7 @@#include "exec/helper-gen.h.inc" #undef HELPER_H -#define HELPER_H "helper.h" +#define HELPER_H "tcg/helper.h.inc"#include "exec/helper-info.c.inc" #undef HELPER_H
target/arm/tcg/vec_helper.c +5 -1
@@ -19,12 +19,16 @@#include "qemu/osdep.h" #include "cpu.h" -#include "exec/helper-proto.h" #include "tcg/tcg-gvec-desc.h" #include "fpu/softfloat.h" #include "qemu/int128.h" #include "vec_internal.h" +#define HELPER_H "tcg/helper.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H +#define HELPER_H "tcg/helper-vfp.h.inc"#include "exec/helper-proto.h.inc" #include "exec/helper-gen.h.inc"
target/arm/vfp_helper.c +5 -1
@@ -19,7 +19,6 @@#include "qemu/osdep.h" #include "cpu.h" -#include "exec/helper-proto.h" #include "internals.h" #ifdef CONFIG_TCG #include "qemu/log.h"
@@ -32,6 +31,11 @@#ifdef CONFIG_TCG +#define HELPER_H "tcg/helper.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H +#define HELPER_H "tcg/helper-vfp.h.inc"#include "exec/helper-proto.h.inc" #include "exec/helper-gen.h.inc"
Signature · 1 line
2.38.1
Quoted 8 lines · Philippe Mathieu-Daudé
target/arm/tcg/vec_helper.c +0
-0@@ -19,12 +19,16 @@#include "qemu/osdep.h" #include "cpu.h"
target/arm/tcg/vec_helper.c line 30
Quoted 10 lines
target/arm/tcg/vec_helper.c +4
-1-#include "exec/helper-proto.h" #include "tcg/tcg-gvec-desc.h" #include "fpu/softfloat.h" #include "qemu/int128.h" #include "vec_internal.h" +#define HELPER_H "tcg/helper.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H
I am surprised that helper.h.inc would be required here and in most of the other foo_helper.c, where helper-foo.h.inc has already been used.
r~
PATCH 22/22 tests/tcg/aarch64: Rename bti-crt.inc.c -> bti-crt.c.inc
In reply to Philippe Mathieu-DaudéSince commit 139c1837db ("meson: rename included C source files to .c.inc"), QEMU standard procedure for included C files is to use *.c.inc.
Besides, since commit 6a0057aa22 ("docs/devel: make a statement about includes") this is documented as the Coding Style:
If you do use template header files they should be named with the ``.c.inc`` or ``.h.inc`` suffix to make it clear they are being included for expansion.
Therefore rename 'bti-crt.inc.c' as 'bti-crt.c.inc'.
---
tests/tcg/aarch64/bti-1.c | 2 +-
tests/tcg/aarch64/bti-3.c | 2 +-
tests/tcg/aarch64/{bti-crt.inc.c => bti-crt.c.inc} | 0
3 files changed, 2 insertions(+), 2 deletions(-)
rename tests/tcg/aarch64/{bti-crt.inc.c => bti-crt.c.inc} (100%)tests/tcg/aarch64/bti-1.c +1 -1
@@ -2,7 +2,7 @@* Branch target identification, basic notskip cases. */ -#include "bti-crt.inc.c" +#include "bti-crt.c.inc" static void skip2_sigill (int sig,siginfo_t *info,ucontext_t *uc) {
tests/tcg/aarch64/bti-3.c +1 -1
@@ -2,7 +2,7 @@* BTI vs PACIASP */ -#include "bti-crt.inc.c" +#include "bti-crt.c.inc" static void skip2_sigill (int sig,siginfo_t *info,ucontext_t *uc) {
tests/tcg/aarch64/bti-crt.c.inc renamed from tests/tcg/aarch64/bti-crt.inc.c +0 -0
Signature · 1 line
2.38.1
Quoted 18 lines · Philippe Mathieu-Daudé
Hi,
This series tries to do what Richard suggested in [*]:
Targets that have a tcg/ subdir should have helper.h.inc moved into there. At the end,
include/exec/helper-gen.handinclude/exec/helper-proto.hbecome unused and go away.but only for the ARM target, to first see if this is heading in the correct direction.
Instead of having TCG generated helpers included by all translate/helper units, they are reduced to the few places really needing them. I expect the build step to be slighly improved, since the compiler doesn't have to compile and track unused helpers definitions.
Quoted 5 lines
42 files changed, 2100 insertions(+), 1804 deletions(-)create mode 100644 target/arm/tcg/helper-iwmmxt.h.inc create mode 100644 target/arm/tcg/helper-neon.h.inc create mode 100644 target/arm/tcg/helper-vfp.h.inc create mode 100644
target/arm/tcg/translate-iwmmxt.c
Note to myself, these new files miss a license.
Perhaps we could have a check for SPDX in checkpatch.pl, along with "added, moved or deleted file(s), does MAINTAINERS need updating?".