target/arm/tcg: Remove inclusions of 'exec/helper-[proto/gen].h'
v2 cover target/arm/tcg: Remove inclusions of 'exec/helper-[proto/gen].h'
Since v1:
- Addressed rth's review comments (unnecessary helper-gen)
- Added R-b
- Extract M-profile helpers
- Fixed licence in new files
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é (26):
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: Reduce 'helper-sme.h.inc' inclusion target/arm/tcg: Reduce 'helper-a64.h.inc' inclusion target/arm/tcg: Move v8m_stackcheck() from op_helper.c to m_helper.c target/arm/tcg: Extract M-profile definitions to 'helper-m.h.inc' target/arm/tcg: Reduce 'helper-m.h.inc' inclusion target/arm/tcg: Inline 'exec/helper-gen.h' target/arm/tcg: Inline 'exec/helper-proto.h' target/arm/tcg: Rename 'helper.h' -> 'tcg/helper.h.inc' tests/tcg/aarch64: Rename bti-crt.inc.c -> bti-crt.c.inc
target/arm/tcg/translate.h | 10 +-
.../tcg/{helper-a64.h => helper-a64.h.inc} | 0
target/arm/tcg/helper-iwmmxt.h.inc | 103 ++
target/arm/tcg/helper-m.h.inc | 23 +
.../tcg/{helper-mve.h => helper-mve.h.inc} | 0
target/arm/tcg/helper-neon.h.inc | 213 +++
.../tcg/{helper-sme.h => helper-sme.h.inc} | 0
.../tcg/{helper-sve.h => helper-sve.h.inc} | 46 +
target/arm/tcg/helper-vfp.h.inc | 163 ++
target/arm/{helper.h => tcg/helper.h.inc} | 524 -------
accel/tcg/cpu-exec.c | 2 +-
plugins/core.c | 1 -
target/arm/debug_helper.c | 6 +-
target/arm/helper.c | 7 +-
target/arm/tcg/cpu32.c | 4 +-
target/arm/tcg/crypto_helper.c | 5 +-
target/arm/tcg/helper-a64.c | 9 +-
target/arm/tcg/hflags.c | 5 +-
target/arm/tcg/iwmmxt_helper.c | 5 +-
target/arm/tcg/m_helper.c | 31 +-
target/arm/tcg/mte_helper.c | 4 +-
target/arm/tcg/mve_helper.c | 9 +-
target/arm/tcg/neon_helper.c | 27 +-
target/arm/tcg/op_helper.c | 43 +-
target/arm/tcg/pauth_helper.c | 4 +-
target/arm/tcg/psci.c | 5 +-
target/arm/tcg/sme_helper.c | 5 +-
target/arm/tcg/sve_helper.c | 12 +-
target/arm/tcg/tlb_helper.c | 4 +-
target/arm/tcg/translate-a64.c | 18 +
target/arm/tcg/translate-iwmmxt.c | 1331 +++++++++++++++++
target/arm/tcg/translate-m-nocp.c | 11 +
target/arm/tcg/translate-mve.c | 6 +
target/arm/tcg/translate-neon.c | 10 +
target/arm/tcg/translate-sme.c | 14 +
target/arm/tcg/translate-sve.c | 5 +
target/arm/tcg/translate-vfp.c | 10 +
target/arm/tcg/translate.c | 1278 +---------------
target/arm/tcg/vec_helper.c | 21 +-
target/arm/vfp_helper.c | 9 +-
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 +
44 files changed, 2133 insertions(+), 1855 deletions(-)
rename target/arm/tcg/{helper-a64.h => helper-a64.h.inc} (100%)
create mode 100644 target/arm/tcg/helper-iwmmxt.h.inc
create mode 100644 target/arm/tcg/helper-m.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} (100%)
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} (53%)
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 v2 1/26 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
PATCH v2 2/26 accel/tcg/cpu-exec: Use generic 'helper-proto-common.h' header
In reply to Philippe Mathieu-DaudéWe only need lookup_tb_ptr() prototype.
--- 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
PATCH v2 3/26 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
PATCH v2 4/26 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 v2 5/26 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 | 103 +++++++++++++++++++++++++++++ 2 files changed, 104 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 +103 -0
103 lines not on this page · raw message
Signature · 1 line
2.38.1
PATCH v2 6/26 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
PATCH v2 7/26 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
PATCH v2 8/26 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 | 1325 +++++++++++++++++++++++++++++ target/arm/tcg/translate.c | 1312 ---------------------------- target/arm/tcg/meson.build | 1 + 3 files changed, 1326 insertions(+), 1312 deletions(-) create mode 100644 target/arm/tcg/translate-iwmmxt.c
target/arm/tcg/translate-iwmmxt.c new file +1325 -0
@@ -0,0 +1,1325 @@ +/* +* XScale iwMMXt translation +* +* Copyright (c) 2007 OpenedHand, Ltd. +* Written by Andrzej Zaborowski <[email protected]> +* Copyright (c) 2008 CodeSourcery +* +* SPDX-License-Identifier: LGPL-2.1-or-later +*/ + +#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
PATCH v2 9/26 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 | 5 ++++- target/arm/tcg/translate-iwmmxt.c | 6 ++++++ 3 files changed, 10 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 +4 -1
@@ -22,7 +22,10 @@#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" +#undef HELPER_H/* iwMMXt macros extracted from GNU gdb. */
target/arm/tcg/translate-iwmmxt.c +6 -0
@@ -12,6 +12,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
PATCH v2 10/26 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.
---
TODO check recpe/rsqrte/rint* are VFP
--- target/arm/helper.h | 155 +----------------------------- target/arm/tcg/helper-vfp.h.inc | 163 ++++++++++++++++++++++++++++++++ 2 files changed, 164 insertions(+), 154 deletions(-) create mode 100644 target/arm/tcg/helper-vfp.h.inc
target/arm/helper.h +1 -154
@@ -103,155 +103,8 @@ DEF_HELPER_FLAGS_2(rebuild_hflags_a64, TCG_CALL_NO_RWG, void, env, int) 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) -DEF_HELPER_FLAGS_2(rsqrte_f16, TCG_CALL_NO_RWG, f16, f16, ptr) -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)
@@ -259,13 +112,6 @@ DEF_HELPER_3(shr_cc, i32, env, i32, i32) DEF_HELPER_3(sar_cc, i32, env, i32, i32) DEF_HELPER_3(ror_cc, i32, env, i32, i32) -DEF_HELPER_FLAGS_2(rinth_exact, TCG_CALL_NO_RWG, f16, f16, ptr) -DEF_HELPER_FLAGS_2(rints_exact, TCG_CALL_NO_RWG, f32, f32, ptr) -DEF_HELPER_FLAGS_2(rintd_exact, TCG_CALL_NO_RWG, f64, f64, ptr) -DEF_HELPER_FLAGS_2(rinth, TCG_CALL_NO_RWG, f16, f16, ptr) -DEF_HELPER_FLAGS_2(rints, TCG_CALL_NO_RWG, f32, f32, ptr) -DEF_HELPER_FLAGS_2(rintd, TCG_CALL_NO_RWG, f64, f64, ptr) - DEF_HELPER_FLAGS_2(vjcvt, TCG_CALL_NO_RWG, i32, f64, env)DEF_HELPER_FLAGS_2 (fjcvtzs,TCG_CALL_NO_RWG , i64, f64, ptr)
@@ -949,4 +795,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 +163 -0
163 lines not on this page · raw message
Signature · 1 line
2.38.1
Re: [PATCH v2 10/26] target/arm/tcg: Extract VFP definitions to 'helper-vfp.h.inc'
Quoted 7 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]>---
TODO check recpe/rsqrte/rint* are VFP
Yep.
r~
PATCH v2 11/26 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 | 4 ++++ target/arm/tcg/sve_helper.c | 3 +++ target/arm/tcg/translate-a64.c | 4 ++++ target/arm/tcg/translate-m-nocp.c | 5 +++++ target/arm/tcg/translate-neon.c | 4 ++++ target/arm/tcg/translate-vfp.c | 6 ++++++ target/arm/tcg/vec_helper.c | 4 ++++ target/arm/vfp_helper.c | 4 ++++ 9 files changed, 34 insertions(+), 1 deletion(-)
target/arm/helper.h +0 -1
@@ -795,5 +795,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 +4 -0
@@ -27,6 +27,10 @@#include "tcg/tcg.h" #include "fpu/softfloat.h" +#define HELPER_H "tcg/helper-vfp.h.inc" +#include "exec/helper-proto.h.inc" +#undef HELPER_H +static uint16_t mve_eci_mask (CPUARMState *env) {/*
target/arm/tcg/sve_helper.c +3 -0
@@ -29,6 +29,9 @@#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" +#undef HELPER_H/* Return a value for NZCV as per the ARM PredTest pseudofunction. *
target/arm/tcg/translate-a64.c +4 -0
@@ -26,6 +26,10 @@#include "semihosting/semihost.h" #include "cpregs.h" +#define HELPER_H "tcg/helper-vfp.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-m-nocp.c +5 -0
@@ -21,6 +21,11 @@#include "translate.h" #include "translate-a32.h" +#define HELPER_H "tcg/helper-vfp.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H + +/* Include the generated decoder */ #include "decode-m-nocp.c.inc" /*
target/arm/tcg/translate-neon.c +4 -0
@@ -24,6 +24,10 @@#include "translate.h" #include "translate-a32.h" +#define HELPER_H "tcg/helper-vfp.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 +4 -0
@@ -25,6 +25,10 @@#include "qemu/int128.h" #include "vec_internal.h" +#define HELPER_H "tcg/helper-vfp.h.inc" +#include "exec/helper-proto.h.inc" +#undef HELPER_H +/* * Data for expanding active predicate bits to bytes, for byte elements. *
target/arm/vfp_helper.c +4 -0
@@ -32,6 +32,10 @@#ifdef CONFIG_TCG +#define HELPER_H "tcg/helper-vfp.h.inc" +#include "exec/helper-proto.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 v2 11/26] target/arm/tcg: Reduce 'helper-vfp.h.inc' inclusion
Quoted 5 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]>
Quoted 11 lines
--- target/arm/helper.h | 1 - target/arm/tcg/mve_helper.c | 4 ++++ target/arm/tcg/sve_helper.c | 3 +++ target/arm/tcg/translate-a64.c | 4 ++++ target/arm/tcg/translate-m-nocp.c | 5 +++++ target/arm/tcg/translate-neon.c | 4 ++++ target/arm/tcg/translate-vfp.c | 6 ++++++ target/arm/tcg/vec_helper.c | 4 ++++ target/arm/vfp_helper.c | 4 ++++ 9 files changed, 34 insertions(+), 1 deletion(-)
r~
PATCH v2 12/26 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
PATCH v2 13/26 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 | 207 +----------------------------- target/arm/tcg/helper-neon.h.inc | 213 +++++++++++++++++++++++++++++++ 2 files changed, 214 insertions(+), 206 deletions(-) create mode 100644 target/arm/tcg/helper-neon.h.inc
target/arm/helper.h +1 -206
@@ -105,8 +105,6 @@ DEF_HELPER_FLAGS_5(probe_access, TCG_CALL_NO_WG, void, env, tl, i32, i32, i32) DEF_HELPER_FLAGS_2(set_rmode, TCG_CALL_NO_RWG, i32, i32, ptr) -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)DEF_HELPER_3 (sar_cc, i32, env, i32, i32)
@@ -117,191 +115,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)
@@ -403,13 +216,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)
@@ -630,8 +436,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)
@@ -710,16 +514,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)
@@ -795,4 +589,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 +213 -0
213 lines not on this page · raw message
Signature · 1 line
2.38.1
PATCH v2 14/26 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 | 5 ++++- target/arm/tcg/translate-a64.c | 4 ++++ target/arm/tcg/translate-neon.c | 6 ++++++ target/arm/tcg/translate-sme.c | 4 ++++ target/arm/tcg/translate.c | 4 ++++ target/arm/tcg/vec_helper.c | 4 ++++ 7 files changed, 26 insertions(+), 2 deletions(-)
target/arm/helper.h +0 -1
@@ -589,5 +589,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 +4 -1
@@ -9,10 +9,13 @@#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" +#undef HELPER_H +#define SIGNBIT (uint32_t)0x80000000#define SIGNBIT64 ((uint64_t)1 << 63)
target/arm/tcg/translate-a64.c +4 -0
@@ -30,6 +30,10 @@#include "exec/helper-gen.h.inc" #undef HELPER_H +#define HELPER_H "tcg/helper-neon.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
@@ -28,6 +28,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 +4 -0
@@ -21,6 +21,10 @@#include "translate.h" #include "translate-a64.h" +#define HELPER_H "tcg/helper-neon.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H +/* * Include the generated decoder. */
target/arm/tcg/translate.c +4 -0
@@ -29,6 +29,10 @@#include "cpregs.h" #include "exec/helper-proto.h" +#define HELPER_H "tcg/helper-neon.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 +4 -0
@@ -29,6 +29,10 @@#include "exec/helper-proto.h.inc" #undef HELPER_H +#define HELPER_H "tcg/helper-neon.h.inc" +#include "exec/helper-proto.h.inc" +#undef HELPER_H +/* * Data for expanding active predicate bits to bytes, for byte elements. *
Signature · 1 line
2.38.1
Re: [PATCH v2 14/26] target/arm/tcg: Reduce 'helper-neon.h.inc' inclusion
Quoted 5 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]>
Quoted 9 lines
--- target/arm/helper.h | 1 - target/arm/tcg/neon_helper.c | 5 ++++- target/arm/tcg/translate-a64.c | 4 ++++ target/arm/tcg/translate-neon.c | 6 ++++++ target/arm/tcg/translate-sme.c | 4 ++++ target/arm/tcg/translate.c | 4 ++++ target/arm/tcg/vec_helper.c | 4 ++++ 7 files changed, 26 insertions(+), 2 deletions(-)
r~
PATCH v2 15/26 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
@@ -162,23 +162,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)
@@ -514,35 +497,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
PATCH v2 16/26 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 | 4 ++++ target/arm/tcg/translate-sme.c | 4 ++++ target/arm/tcg/translate-sve.c | 5 +++++ target/arm/tcg/vec_helper.c | 4 ++++ 5 files changed, 17 insertions(+), 1 deletion(-)
target/arm/helper.h +0 -1
@@ -539,7 +539,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 +4 -0
@@ -33,6 +33,10 @@#include "exec/helper-proto.h.inc" #undef HELPER_H +#define HELPER_H "tcg/helper-sve.h.inc" +#include "exec/helper-proto.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 +4 -0
@@ -25,6 +25,10 @@#include "exec/helper-gen.h.inc" #undef HELPER_H +#define HELPER_H "tcg/helper-sve.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 +4 -0
@@ -33,6 +33,10 @@#include "exec/helper-proto.h.inc" #undef HELPER_H +#define HELPER_H "tcg/helper-sve.h.inc" +#include "exec/helper-proto.h.inc" +#undef HELPER_H +/* * Data for expanding active predicate bits to bytes, for byte elements. *
Signature · 1 line
2.38.1
Re: [PATCH v2 16/26] target/arm/tcg: Reduce 'helper-sve.h.inc' inclusion
Quoted 4 lines · Philippe Mathieu-Daudé
Instead of including helper-sve.h.inc via
helper.hwhich is included by all TCG files, restrict it to the few files that require it.
Quoted 8 lines
Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- target/arm/helper.h | 1 - target/arm/tcg/sve_helper.c | 4 ++++ target/arm/tcg/translate-sme.c | 4 ++++ target/arm/tcg/translate-sve.c | 5 +++++ target/arm/tcg/vec_helper.c | 4 ++++ 5 files changed, 17 insertions(+), 1 deletion(-)
r~
PATCH v2 17/26 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 | 4 ++++ 4 files changed, 14 insertions(+), 3 deletions(-)
target/arm/helper.h +0 -2
@@ -541,5 +541,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 +4 -1
@@ -21,7 +21,6 @@#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"
@@ -31,6 +30,10 @@#include "exec/helper-proto.h.inc" #undef HELPER_H +#define HELPER_H "tcg/helper-mve.h.inc" +#include "exec/helper-proto.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 +4 -0
@@ -33,6 +33,10 @@#include "exec/helper-gen.h.inc" #undef HELPER_H +#define HELPER_H "tcg/helper-mve.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
Re: [PATCH v2 17/26] target/arm/tcg: Reduce 'helper-mve.h.inc' inclusion
Quoted 11 lines · Philippe Mathieu-Daudé
Instead of including helper-mve.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 | 2 -- target/arm/tcg/mve_helper.c | 5 ++++- target/arm/tcg/translate-mve.c | 6 ++++++ target/arm/tcg/translate.c | 4 ++++ 4 files changed, 14 insertions(+), 3 deletions(-)
r~
PATCH v2 18/26 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-a64.c | 4 ++++ target/arm/tcg/translate-sme.c | 6 ++++++ 4 files changed, 14 insertions(+), 2 deletions(-)
target/arm/helper.h +0 -1
@@ -539,5 +539,4 @@ DEF_HELPER_FLAGS_5(gvec_uclamp_d, TCG_CALL_NO_RWG,#ifdef TARGET_AARCH64 #include "tcg/helper-a64.h.inc" -#include "tcg/helper-sme.h.inc" #endif
target/arm/tcg/sme_helper.c +4 -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,10 @@#include "vec_internal.h" #include "sve_ldst_internal.h" +#define HELPER_H "tcg/helper-sme.h.inc" +#include "exec/helper-proto.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-a64.c +4 -0
@@ -34,6 +34,10 @@#include "exec/helper-gen.h.inc" #undef HELPER_H +#define HELPER_H "tcg/helper-sme.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-sme.c +6 -0
@@ -29,6 +29,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
Re: [PATCH v2 18/26] target/arm/tcg: Reduce 'helper-sme.h.inc' inclusion
Quoted 11 lines · Philippe Mathieu-Daudé
Instead of including helper-sme.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/sme_helper.c | 5 ++++- target/arm/tcg/translate-a64.c | 4 ++++ target/arm/tcg/translate-sme.c | 6 ++++++ 4 files changed, 14 insertions(+), 2 deletions(-)
r~
PATCH v2 19/26 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 | 4 ---- target/arm/tcg/helper-a64.c | 4 ++++ 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 | 4 ++++ 7 files changed, 24 insertions(+), 7 deletions(-)
target/arm/helper.h +0 -4
@@ -536,7 +536,3 @@ DEF_HELPER_FLAGS_5(gvec_uclamp_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32)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" -#endif
target/arm/tcg/helper-a64.c +4 -0
@@ -35,6 +35,10 @@#include "fpu/softfloat.h" #include <zlib.h> /* For crc32 */ +#define HELPER_H "tcg/helper-a64.h.inc" +#include "exec/helper-proto.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 +3 -1
@@ -24,11 +24,13 @@#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" +#define HELPER_H "tcg/helper-a64.h.inc" +#include "exec/helper-proto.h.inc" +#undef HELPER_Hstatic int choose_nonexcluded_tag (int tag,int offset,uint16_t exclude) {
target/arm/tcg/pauth_helper.c +3 -1
@@ -22,10 +22,12 @@#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" +#define HELPER_H "tcg/helper-a64.h.inc" +#include "exec/helper-proto.h.inc" +#undef HELPER_Hstatic uint64_t pac_cell_shuffle (uint64_t i) {
target/arm/tcg/sve_helper.c +4 -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"
@@ -37,6 +36,10 @@#include "exec/helper-proto.h.inc" #undef HELPER_H +#define HELPER_H "tcg/helper-a64.h.inc" +#include "exec/helper-proto.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
@@ -38,6 +38,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 +4 -0
@@ -37,6 +37,10 @@#include "exec/helper-proto.h.inc" #undef HELPER_H +#define HELPER_H "tcg/helper-a64.h.inc" +#include "exec/helper-proto.h.inc" +#undef HELPER_H +/* * Data for expanding active predicate bits to bytes, for byte elements. *
Signature · 1 line
2.38.1
Re: [PATCH v2 19/26] target/arm/tcg: Reduce 'helper-a64.h.inc' inclusion
Quoted 5 lines · Philippe Mathieu-Daudé
Instead of including helper-a64.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]>
Quoted 9 lines
--- target/arm/helper.h | 4 ---- target/arm/tcg/helper-a64.c | 4 ++++ 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 | 4 ++++ 7 files changed, 24 insertions(+), 7 deletions(-)
r~
PATCH v2 20/26 target/arm/tcg: Move v8m_stackcheck() from op_helper.c to m_helper.c
In reply to Philippe Mathieu-DaudéNo need to have the v8m_stackcheck() helper in the generic op_helper.c, move it with the rest of the M-profile helpers.
--- target/arm/tcg/m_helper.c | 16 ++++++++++++++++ target/arm/tcg/op_helper.c | 16 ---------------- 2 files changed, 16 insertions(+), 16 deletions(-)
target/arm/tcg/m_helper.c +16 -0
@@ -2893,3 +2893,19 @@ uint32_t *arm_v7m_get_sp_ptr(CPUARMState *env, bool secure, bool threadmode, } } } + +void HELPER (v8m_stackcheck )(CPUARMState *env,uint32_t newvalue) +{ +/* +* Perform the v8M stack limit check for SP updates from translated code, +* raising an exception if the limit is breached. +*/ +if (newvalue <v7m_sp_limit (env)) { +/* +* Stack limit exceptions are a rare case, so rather than syncing +* PC/condbits before the call, we use raise_exception_ra() so +* that cpu_restore_state() will sort them out. +*/ +raise_exception_ra (env,EXCP_STKOF ,0 ,1 ,GETPC ()); + } +}
target/arm/tcg/op_helper.c +0 -16
@@ -82,22 +82,6 @@ void raise_exception_ra(CPUARMState *env, uint32_t excp, uint32_t syndrome,raise_exception (env, excp, syndrome, target_el); } -void HELPER (v8m_stackcheck )(CPUARMState *env,uint32_t newvalue) -{ -/* -* Perform the v8M stack limit check for SP updates from translated code, -* raising an exception if the limit is breached. -*/ -if (newvalue <v7m_sp_limit (env)) { -/* -* Stack limit exceptions are a rare case, so rather than syncing -* PC/condbits before the call, we use raise_exception_ra() so -* that cpu_restore_state() will sort them out. -*/ -raise_exception_ra (env,EXCP_STKOF ,0 ,1 ,GETPC ()); - } -} -uint32_t HELPER (add_setq )(CPUARMState *env,uint32_t a,uint32_t b) {uint32_t res = a + b;
Signature · 1 line
2.38.1
Re: [PATCH v2 20/26] target/arm/tcg: Move v8m_stackcheck() from op_helper.c to m_helper.c
Quoted 8 lines · Philippe Mathieu-Daudé
No need to have the
v8m_stackcheck()helper in the genericop_helper.c, move it with the rest of the M-profile helpers.Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- target/arm/tcg/m_helper.c | 16 ++++++++++++++++ target/arm/tcg/op_helper.c | 16 ---------------- 2 files changed, 16 insertions(+), 16 deletions(-)
r~
PATCH v2 21/26 target/arm/tcg: Extract M-profile definitions to 'helper-m.h.inc'
In reply to Philippe Mathieu-Daudéhelper.h is used by all units, but not all require the M-profile definitions. Move them to a new header; the next commit will remove it from the common helper.h.
--- target/arm/helper.h | 17 ++--------------- target/arm/tcg/helper-m.h.inc | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 15 deletions(-) create mode 100644 target/arm/tcg/helper-m.h.inc
target/arm/helper.h +2 -15
@@ -62,21 +62,6 @@ DEF_HELPER_3(cpsr_write, void, env, i32, i32) DEF_HELPER_2(cpsr_write_eret, void, env, i32) DEF_HELPER_1(cpsr_read, i32, env) -DEF_HELPER_3(v7m_msr, void, env, i32, i32) -DEF_HELPER_2(v7m_mrs, i32, env, i32) - -DEF_HELPER_2(v7m_bxns, void, env, i32) -DEF_HELPER_2(v7m_blxns, void, env, i32) - -DEF_HELPER_3(v7m_tt, i32, env, i32, i32) - -DEF_HELPER_1(v7m_preserve_fp_state, void, env) - -DEF_HELPER_2(v7m_vlstm, void, env, i32) -DEF_HELPER_2(v7m_vlldm, void, env, i32) - -DEF_HELPER_2(v8m_stackcheck, void, env, i32) - DEF_HELPER_FLAGS_2(check_bxj_trap, TCG_CALL_NO_WG, void, env, i32)DEF_HELPER_4 (access_check_cp_reg, cptr, env, i32, i32, i32)
@@ -536,3 +521,5 @@ DEF_HELPER_FLAGS_5(gvec_uclamp_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32)DEF_HELPER_FLAGS_5 (gvec_uclamp_d ,TCG_CALL_NO_RWG , void, ptr, ptr, ptr, ptr, i32) + +#include "tcg/helper-m.h.inc"
target/arm/tcg/helper-m.h.inc new file +23 -0
@@ -0,0 +1,23 @@ +/* + * ARM M-profile helper definitions + * + * Copyright (c) 2007 CodeSourcery. + * Written by Paul Brook + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +DEF_HELPER_3(v7m_msr, void, env, i32, i32) +DEF_HELPER_2(v7m_mrs, i32, env, i32) + +DEF_HELPER_2(v7m_bxns, void, env, i32) +DEF_HELPER_2(v7m_blxns, void, env, i32) + +DEF_HELPER_3(v7m_tt, i32, env, i32, i32) + +DEF_HELPER_1(v7m_preserve_fp_state, void, env) + +DEF_HELPER_2(v7m_vlstm, void, env, i32) +DEF_HELPER_2(v7m_vlldm, void, env, i32) + +DEF_HELPER_2(v8m_stackcheck, void, env, i32)
Signature · 1 line
2.38.1
Re: [PATCH v2 21/26] target/arm/tcg: Extract M-profile definitions to 'helper-m.h.inc'
Quoted 10 lines · Philippe Mathieu-Daudé
helper.his used by all units, but not all require the M-profile 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 | 17 ++--------------- target/arm/tcg/helper-m.h.inc | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 15 deletions(-)create mode 100644 target/arm/tcg/helper-m.h.inc
r~
PATCH v2 22/26 target/arm/tcg: Reduce 'helper-m.h.inc' inclusion
In reply to Philippe Mathieu-DaudéInstead of including helper-m.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/m_helper.c | 4 ++++ target/arm/tcg/translate-m-nocp.c | 6 ++++++ target/arm/tcg/translate-vfp.c | 4 ++++ target/arm/tcg/translate.c | 5 +++++ 5 files changed, 19 insertions(+), 2 deletions(-)
target/arm/helper.h +0 -2
@@ -521,5 +521,3 @@ DEF_HELPER_FLAGS_5(gvec_uclamp_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32)DEF_HELPER_FLAGS_5 (gvec_uclamp_d ,TCG_CALL_NO_RWG ,void ,ptr ,ptr ,ptr ,ptr ,i32 ) - -#include "tcg/helper-m.h.inc"
target/arm/tcg/m_helper.c +4 -0
@@ -21,6 +21,10 @@#include "hw/intc/armv7m_nvic.h" #endif +#define HELPER_H "tcg/helper-m.h.inc" +#include "exec/helper-proto.h.inc" +#undef HELPER_H +static void v7m_msr_xpsr (CPUARMState *env,uint32_t mask,uint32_t reg,uint32_t val) {
target/arm/tcg/translate-m-nocp.c +6 -0
@@ -25,6 +25,12 @@#include "exec/helper-gen.h.inc" #undef HELPER_H +#define HELPER_H "tcg/helper-m.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 */ #include "decode-m-nocp.c.inc"
target/arm/tcg/translate-vfp.c +4 -0
@@ -24,6 +24,10 @@#include "translate.h" #include "translate-a32.h" +#define HELPER_H "tcg/helper-m.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/translate.c +5 -0
@@ -37,6 +37,11 @@#include "exec/helper-gen.h.inc" #undef HELPER_H +#define HELPER_H "tcg/helper-m.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
Re: [PATCH v2 22/26] target/arm/tcg: Reduce 'helper-m.h.inc' inclusion
target/arm/tcg/translate-m-nocp.c line 43
Quoted 9 lines · Philippe Mathieu-Daudé
+++
b/target/arm/tcg/translate.ctarget/arm/tcg/translate-m-nocp.c +4
-0@@ -37,6 +37,11 @@#include "exec/helper-gen.h.inc" #undef HELPER_H +#define HELPER_H "tcg/helper-m.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_H
You don't need helper-proto.h here do you?
Otherwise,
r~
Re: [PATCH v2 22/26] target/arm/tcg: Reduce 'helper-m.h.inc' inclusion
Quoted 11 lines · Richard Henderson
target/arm/tcg/translate-m-nocp.c line 42
Quoted 8 lines · Philippe Mathieu-Daudé
+++
b/target/arm/tcg/translate.ctarget/arm/tcg/translate-m-nocp.c +4
-0@@ -37,6 +37,11 @@ #include "exec/helper-gen.h.inc" #undef HELPER_H +#define HELPER_H "tcg/helper-m.h.inc" +#include "exec/helper-proto.h.inc" +#include "exec/helper-gen.h.inc" +#undef HELPER_HYou don't need
helper-proto.hhere do you?
Right, rebase left-over...
Quoted 2 lines
Otherwise,
Reviewed-by Richard Henderson <[email protected]>
Thanks!
PATCH v2 23/26 target/arm/tcg: Inline 'exec/helper-gen.h'
In reply to Philippe Mathieu-Daudé---
CHECK: By extracting some inlined (FP) helpers from translate.h, we could reduce 'helper-gen.h.inc' to helper.c.
--- target/arm/tcg/translate.h | 4 +++- target/arm/helper.c | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-)
target/arm/tcg/translate.h +3 -1
@@ -6,9 +6,11 @@#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 "helper.h" +#include "exec/helper-gen.h.inc" +#undef HELPER_H/* internal defines */
target/arm/helper.c +5 -0
@@ -26,6 +26,11 @@#include "qapi/error.h" #include "qemu/guest-random.h" #ifdef CONFIG_TCG + +#define HELPER_H "helper.h" +#include "exec/helper-gen.h.inc" +#undef HELPER_H +#include "semihosting/common-semi.h" #endif #include "cpregs.h"
Signature · 1 line
2.38.1
Re: [PATCH v2 23/26] target/arm/tcg: Inline 'exec/helper-gen.h'
target/arm/helper.c line 32
Quoted 9 lines · Philippe Mathieu-Daudé
+++
b/target/arm/helper.ctarget/arm/helper.c +4
-0@@ -26,6 +26,11 @@#include "qapi/error.h" #include "qemu/guest-random.h" #ifdef CONFIG_TCG + +#define HELPER_H "helper.h" +#include "exec/helper-gen.h.inc" +#undef HELPER_H
Why is this here? helper-gen is for tcg code generation, which should not be required at all in this file. I can't see how the modification to translate.h affects this.
r~
Re: [PATCH v2 23/26] target/arm/tcg: Inline 'exec/helper-gen.h'
Quoted 13 lines · Richard Henderson
target/arm/helper.c line 32
Quoted 9 lines · Philippe Mathieu-Daudé
+++
b/target/arm/helper.ctarget/arm/helper.c +4
-0@@ -26,6 +26,11 @@ #include "qapi/error.h" #include "qemu/guest-random.h" #ifdef CONFIG_TCG + +#define HELPER_H "helper.h" +#include "exec/helper-gen.h.inc" +#undef HELPER_HWhy is this here? helper-gen is for tcg code generation, which should not be required at all in this file. I can't see how the modification to
translate.haffects this.
Indeed this is not needed.
PATCH v2 24/26 target/arm/tcg: Inline 'exec/helper-proto.h'
In reply to Philippe Mathieu-Daudé---
This mean we can extract more tcg/helper-foo.h.inc, maybe:
- gvec / simd / crypto
- exception / wfi
--- target/arm/debug_helper.c | 6 +++++- target/arm/helper.c | 2 +- target/arm/tcg/crypto_helper.c | 5 ++++- target/arm/tcg/helper-a64.c | 5 ++++- target/arm/tcg/hflags.c | 5 ++++- target/arm/tcg/m_helper.c | 5 ++++- target/arm/tcg/op_helper.c | 5 ++++- target/arm/tcg/psci.c | 5 ++++- target/arm/tcg/tlb_helper.c | 4 +++- target/arm/tcg/translate.c | 2 +- target/arm/tcg/vec_helper.c | 5 ++++- target/arm/vfp_helper.c | 5 ++++- 12 files changed, 42 insertions(+), 12 deletions(-)
target/arm/debug_helper.c +5 -1
@@ -11,10 +11,14 @@#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 "helper.h" +#include "exec/helper-proto.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 +1 -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"
@@ -28,6 +27,7 @@#ifdef CONFIG_TCG #define HELPER_H "helper.h" +#include "exec/helper-proto.h.inc" #include "exec/helper-gen.h.inc" #undef HELPER_H
target/arm/tcg/crypto_helper.c +4 -1
@@ -12,12 +12,15 @@#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 "helper.h" +#include "exec/helper-proto.h.inc" +#undef HELPER_H +union CRYPTO_STATE {uint8_t bytes[16 ];uint32_t words[4 ];
target/arm/tcg/helper-a64.c +4 -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,10 @@#include "fpu/softfloat.h" #include <zlib.h> /* For crc32 */ +#define HELPER_H "helper.h" +#include "exec/helper-proto.h.inc" +#undef HELPER_H +#define HELPER_H "tcg/helper-a64.h.inc"#include "exec/helper-proto.h.inc" #undef HELPER_H
target/arm/tcg/hflags.c +4 -1
@@ -8,9 +8,12 @@#include "qemu/osdep.h" #include "cpu.h" #include "internals.h" -#include "exec/helper-proto.h" #include "cpregs.h" +#define HELPER_H "helper.h" +#include "exec/helper-proto.h.inc" +#undef HELPER_H +static inline bool fgt_svc (CPUARMState *env,int el) {/*
target/arm/tcg/m_helper.c +4 -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"
@@ -25,6 +24,10 @@#include "exec/helper-proto.h.inc" #undef HELPER_H +#define HELPER_H "helper.h" +#include "exec/helper-proto.h.inc" +#undef HELPER_H +static void v7m_msr_xpsr (CPUARMState *env,uint32_t mask,uint32_t reg,uint32_t val) {
target/arm/tcg/op_helper.c +4 -1
@@ -19,12 +19,15 @@#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 "helper.h" +#include "exec/helper-proto.h.inc" +#undef HELPER_H +#define SIGNBIT (uint32_t)0x80000000#define SIGNBIT64 ((uint64_t)1 << 63)
target/arm/tcg/psci.c +4 -1
@@ -18,13 +18,16 @@#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 "helper.h" +#include "exec/helper-proto.h.inc" +#undef HELPER_H +bool arm_is_psci_call (ARMCPU *cpu,int excp_type) {/*
target/arm/tcg/tlb_helper.c +3 -1
@@ -9,8 +9,10 @@#include "cpu.h" #include "internals.h" #include "exec/exec-all.h" -#include "exec/helper-proto.h" +#define HELPER_H "helper.h" +#include "exec/helper-proto.h.inc" +#undef HELPER_H/* * Returns true if the stage 1 translation regime is using LPAE format page
target/arm/tcg/translate.c +1 -1
@@ -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-gen.h.inc"
@@ -43,6 +42,7 @@#undef HELPER_H#define HELPER_H "helper.h" +#include "exec/helper-proto.h.inc" #include "exec/helper-info.c.inc" #undef HELPER_H
target/arm/tcg/vec_helper.c +4 -1
@@ -19,12 +19,15 @@#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 "helper.h" +#include "exec/helper-proto.h.inc" +#undef HELPER_H +#define HELPER_H "tcg/helper-vfp.h.inc"#include "exec/helper-proto.h.inc" #undef HELPER_H
target/arm/vfp_helper.c +4 -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,10 @@#ifdef CONFIG_TCG +#define HELPER_H "helper.h" +#include "exec/helper-proto.h.inc" +#undef HELPER_H +#define HELPER_H "tcg/helper-vfp.h.inc"#include "exec/helper-proto.h.inc" #undef HELPER_H
Signature · 1 line
2.38.1
Re: [PATCH v2 24/26] target/arm/tcg: Inline 'exec/helper-proto.h'
Quoted 31 lines · Philippe Mathieu-Daudé
+++
b/target/arm/tcg/vec_helper.ctarget/arm/tcg/vec_helper.c +4
-1@@ -19,12 +19,15 @@#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 "helper.h" +#include "exec/helper-proto.h.inc" +#undef HELPER_H +#define HELPER_H "tcg/helper-vfp.h.inc"#include "exec/helper-proto.h.inc" #undef HELPER_Htarget/arm/vfp_helper.c +0
-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"
target/arm/vfp_helper.c line 40
Quoted 10 lines
target/arm/vfp_helper.c +4
-0@@ -32,6 +31,10 @@#ifdef CONFIG_TCG +#define HELPER_H "helper.h" +#include "exec/helper-proto.h.inc" +#undef HELPER_H +#define HELPER_H "tcg/helper-vfp.h.inc"#include "exec/helper-proto.h.inc" #undef HELPER_H
Are these really required, or are you simply replacing what you removed?
r~
Re: [PATCH v2 24/26] target/arm/tcg: Inline 'exec/helper-proto.h'
Quoted 31 lines · Richard Henderson
Quoted 30 lines · Philippe Mathieu-Daudé
+++
b/target/arm/tcg/vec_helper.ctarget/arm/tcg/vec_helper.c +4
-1@@ -19,12 +19,15 @@ #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 "helper.h" +#include "exec/helper-proto.h.inc" +#undef HELPER_H + #define HELPER_H "tcg/helper-vfp.h.inc" #include "exec/helper-proto.h.inc" #undef HELPER_Htarget/arm/vfp_helper.c +1
-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,10 @@ #ifdef CONFIG_TCG +#define HELPER_H "helper.h"
Quoted 8 lines
target/arm/vfp_helper.c line 38
Quoted 6 lines
target/arm/vfp_helper.c +3
-0+#include "exec/helper-proto.h.inc" +#undef HELPER_H + #define HELPER_H "tcg/helper-vfp.h.inc" #include "exec/helper-proto.h.inc" #undef HELPER_HAre these really required, or are you simply replacing what you removed?
We get:
../../target/arm/tcg/vec_helper.c:268:6: error: no previous prototype for function 'helper_gvec_qrdmlah_s16' [-Werror,-Wmissing-prototypes] ../../target/arm/tcg/vec_helper.c:293:6: error: no previous prototype for function 'helper_gvec_qrdmlsh_s16' [-Werror,-Wmissing-prototypes]
...
../../target/arm/vfp_helper.c:511:10: error: no previous prototype for function 'helper_set_rmode' [-Werror,-Wmissing-prototypes] ../../target/arm/vfp_helper.c:1127:10: error: no previous prototype for function 'helper_fjcvtzs' [-Werror,-Wmissing-prototypes]
...
../../target/arm/tcg/m_helper.c:581:9: error: call to undeclared function 'helper_exception_internal'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
../../target/arm/tcg/helper-a64.c:831:9: error: call to undeclared function 'helper_rebuild_hflags_a32'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
../../target/arm/tcg/psci.c:174:9: error: call to undeclared function 'helper_wfi'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
../../target/arm/tcg/tlb_helper.c:168:6: error: no previous prototype for function 'helper_exception_pc_alignment' [-Werror,-Wmissing-prototypes]
../../target/arm/tcg/crypto_helper.c:73:12: error: function cannot return function type 'void (void *, void *, void *, uint32_t)' (aka 'void (void *, void *, void *, unsigned int)') void HELPER(crypto_aese)(void *vd, void *vn, void *vm, uint32_t desc)
Do we need more tcg/helper-foo.h.inc?
- gvec / simd / crypto
- exception / wfi
Re: [PATCH v2 24/26] target/arm/tcg: Inline 'exec/helper-proto.h'
Quoted 16 lines · Philippe Mathieu-Daudé
We get:
../../target/arm/tcg/vec_helper.c:268:6: error: no previous prototype for function 'helper_gvec_qrdmlah_s16' [-Werror,-Wmissing-prototypes]../../target/arm/tcg/vec_helper.c:293:6: error: no previous prototype for function 'helper_gvec_qrdmlsh_s16' [-Werror,-Wmissing-prototypes]
...
../../target/arm/vfp_helper.c:511:10: error: no previous prototype for function 'helper_set_rmode' [-Werror,-Wmissing-prototypes]../../target/arm/vfp_helper.c:1127:10: error: no previous prototype for function 'helper_fjcvtzs' [-Werror,-Wmissing-prototypes]
...
../../target/arm/tcg/m_helper.c:581:9: error: call to undeclared function 'helper_exception_internal'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
../../target/arm/tcg/helper-a64.c:831:9: error: call to undeclared function 'helper_rebuild_hflags_a32'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
../../target/arm/tcg/psci.c:174:9: error: call to undeclared function 'helper_wfi'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
Quoted 8 lines
../../target/arm/tcg/tlb_helper.c:168:6: error: no previous prototype for function 'helper_exception_pc_alignment' [-Werror,-Wmissing-prototypes]
../../target/arm/tcg/crypto_helper.c:73:12: error: function cannot return function type 'void (void *, void *, void *,uint32_t)' (aka 'void (void *, void *, void *, unsigned int)') void HELPER(crypto_aese)(void *vd, void *vn, void *vm,uint32_tdesc)Do we need more tcg/helper-foo.h.inc?
- gvec / simd / crypto
- exception / wfi
crypto, pauth, mte, for sure.
gvec could go with vfp.
fjcvtzs is definitely vfp.
I doubt a separate header for exceptions would pay off.
r~
PATCH v2 25/26 target/arm/tcg: Rename 'helper.h' -> 'tcg/helper.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 'helper.h' as 'helper.h.inc'. Since this file is TCG-specific, move it to the tcg/ directory.
---
target/arm/tcg/translate.h | 2 +-
target/arm/{helper.h => tcg/helper.h.inc} | 0
target/arm/debug_helper.c | 2 +-
target/arm/helper.c | 2 +-
target/arm/tcg/crypto_helper.c | 2 +-
target/arm/tcg/helper-a64.c | 2 +-
target/arm/tcg/hflags.c | 2 +-
target/arm/tcg/m_helper.c | 2 +-
target/arm/tcg/op_helper.c | 2 +-
target/arm/tcg/psci.c | 2 +-
target/arm/tcg/tlb_helper.c | 2 +-
target/arm/tcg/translate.c | 2 +-
target/arm/tcg/vec_helper.c | 2 +-
target/arm/vfp_helper.c | 2 +-
14 files changed, 13 insertions(+), 13 deletions(-)
rename target/arm/{helper.h => tcg/helper.h.inc} (100%)target/arm/tcg/translate.h +1 -1
@@ -8,7 +8,7 @@#include "exec/translator.h" #include "internals.h" -#define HELPER_H "helper.h" +#define HELPER_H "tcg/helper.h.inc"#include "exec/helper-gen.h.inc" #undef HELPER_H
target/arm/tcg/helper.h.inc renamed from target/arm/helper.h +0 -0
target/arm/debug_helper.c +1 -1
@@ -15,7 +15,7 @@#ifdef CONFIG_TCG -#define HELPER_H "helper.h" +#define HELPER_H "tcg/helper.h.inc"#include "exec/helper-proto.h.inc" #undef HELPER_H
target/arm/helper.c +1 -1
@@ -26,7 +26,7 @@#include "qemu/guest-random.h" #ifdef CONFIG_TCG -#define HELPER_H "helper.h" +#define HELPER_H "tcg/helper.h.inc"#include "exec/helper-proto.h.inc" #include "exec/helper-gen.h.inc" #undef HELPER_H
target/arm/tcg/crypto_helper.c +1 -1
@@ -17,7 +17,7 @@#include "crypto/sm4.h" #include "vec_internal.h" -#define HELPER_H "helper.h" +#define HELPER_H "tcg/helper.h.inc"#include "exec/helper-proto.h.inc" #undef HELPER_H
target/arm/tcg/helper-a64.c +1 -1
@@ -34,7 +34,7 @@#include "fpu/softfloat.h" #include <zlib.h> /* For crc32 */ -#define HELPER_H "helper.h" +#define HELPER_H "tcg/helper.h.inc"#include "exec/helper-proto.h.inc" #undef HELPER_H
target/arm/tcg/hflags.c +1 -1
@@ -10,7 +10,7 @@#include "internals.h" #include "cpregs.h" -#define HELPER_H "helper.h" +#define HELPER_H "tcg/helper.h.inc"#include "exec/helper-proto.h.inc" #undef HELPER_H
target/arm/tcg/m_helper.c +1 -1
@@ -24,7 +24,7 @@#include "exec/helper-proto.h.inc" #undef HELPER_H -#define HELPER_H "helper.h" +#define HELPER_H "tcg/helper.h.inc"#include "exec/helper-proto.h.inc" #undef HELPER_H
target/arm/tcg/op_helper.c +1 -1
@@ -24,7 +24,7 @@#include "exec/cpu_ldst.h" #include "cpregs.h" -#define HELPER_H "helper.h" +#define HELPER_H "tcg/helper.h.inc"#include "exec/helper-proto.h.inc" #undef HELPER_H
target/arm/tcg/psci.c +1 -1
@@ -24,7 +24,7 @@#include "internals.h" #include "arm-powerctl.h" -#define HELPER_H "helper.h" +#define HELPER_H "tcg/helper.h.inc"#include "exec/helper-proto.h.inc" #undef HELPER_H
target/arm/tcg/tlb_helper.c +1 -1
@@ -10,7 +10,7 @@#include "internals.h" #include "exec/exec-all.h" -#define HELPER_H "helper.h" +#define HELPER_H "tcg/helper.h.inc"#include "exec/helper-proto.h.inc" #undef HELPER_H
target/arm/tcg/translate.c +1 -1
@@ -41,7 +41,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-proto.h.inc" #include "exec/helper-info.c.inc" #undef HELPER_H
target/arm/tcg/vec_helper.c +1 -1
@@ -24,7 +24,7 @@#include "qemu/int128.h" #include "vec_internal.h" -#define HELPER_H "helper.h" +#define HELPER_H "tcg/helper.h.inc"#include "exec/helper-proto.h.inc" #undef HELPER_H
target/arm/vfp_helper.c +1 -1
@@ -31,7 +31,7 @@#ifdef CONFIG_TCG -#define HELPER_H "helper.h" +#define HELPER_H "tcg/helper.h.inc"#include "exec/helper-proto.h.inc" #undef HELPER_H
Signature · 1 line
2.38.1
Re: [PATCH v2 25/26] target/arm/tcg: Rename 'helper.h' -> 'tcg/helper.h.inc'
Quoted 31 lines · 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 '
helper.h' as 'helper.h.inc'. Since this file is TCG-specific, move it to the tcg/ directory.Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- target/arm/tcg/translate.h | 2 +- target/arm/{helper.h => tcg/helper.h.inc} | 0 target/arm/debug_helper.c | 2 +- target/arm/helper.c | 2 +- target/arm/tcg/crypto_helper.c | 2 +- target/arm/tcg/helper-a64.c | 2 +- target/arm/tcg/hflags.c | 2 +- target/arm/tcg/m_helper.c | 2 +- target/arm/tcg/op_helper.c | 2 +- target/arm/tcg/psci.c | 2 +- target/arm/tcg/tlb_helper.c | 2 +- target/arm/tcg/translate.c | 2 +- target/arm/tcg/vec_helper.c | 2 +- target/arm/vfp_helper.c | 2 +- 14 files changed, 13 insertions(+), 13 deletions(-)
Quoted 1 line
rename
target/arm/{helper.h=> tcg/helper.h.inc} (100%)
r~
PATCH v2 26/26 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