Hexagon HVX (target/hexagon) patch series
v4 cover Hexagon HVX (target/hexagon) patch series
This series adds support for the Hexagon Vector eXtensions (HVX)
These instructions are documented here
https://developer.qualcomm.com/downloads/qualcomm-hexagon-v66-hvx-programmer-s-reference-manual
Hexagon HVX is a wide vector engine with 128 byte vectors.
See patch 01 Hexagon HVX README for more information.
*** Known checkpatch issues ***
The following are known checkpatch errors in the series
target/hexagon/gen_semantics.c Suspicious ; after while (0)
tests/tcg/hexagon/hvx_misc.c Spaces around operator in macro invocation
*** Changes in v4 ***
Address feedback from Richard Henderson <[email protected]>
- Use tcg_gen_gvec_orc/tcg_gen_gvec_andc
Add tests for the following opcodes
V6_pred_or
V6_pred_or_n
V6_pred_and
V6_pred_and_n
V6_pred_xorProbe the HVX stores at the beginning of gen_commit_packet
See patches 11 (helper functions) and 12 (TCG generation)
Use tcg_constant_* instead of tcg_const_*
*** Changes in v3 ***
Clean up gen_log_vreg_write
- Remove has_vhist parameter
Remove VRegs_updated_tmp from runtime state
- Check there is exactly one tmp for vhist at TCG generation time Remove VRegs_select from runtime state
Add test_max_temps test to tests/tcg/hexagon/hvx_misc.c Don't pass slot to HVX helpers
*** Changes in v2 ***
Address feedback from Richard Henderson <[email protected]>
- Remove zero_vector from CPUHexagonState
- Remove gather_issued from CPUHexagonState
- Remove is_gather_store_insn from DisasContext and CPUHexagonState
- Change VStoreLog.mask to a bitmap
- Change VTCMStoreLog.mask to a bitmap
- Convert future_VRegs, tmp_Vregs to allocate as-needed
- Don't cast away const
- Remove/simplify count_leading_ones_2
- Control HVX dump with CPU_DUMP_FPU
Remove HVX support from target/hexagon/gdbstub.c
- Hexagon uses lldb which will require support for qRegisterInfo in the target-independent gdbstub. Will contribute this separately
Convert the histogram instructions to execute at the end of packet commit
- This is necessary to allocate future_VRegs as-needed Additional tests added in tests/tcg/hexagon
Added helper overrides for several instructions
- As a result, cleaned up utility functions Additional_cleanup
- Change TCGv_ptr to not _local_
- Remove env argument from gen_commit_hvx
Taylor Simpson (30):
Hexagon HVX (target/hexagon) README
Hexagon HVX (target/hexagon) add Hexagon Vector eXtensions (HVX) to
core
Hexagon HVX (target/hexagon) register names
Hexagon HVX (target/hexagon) instruction attributes Hexagon HVX (target/hexagon) macros
Hexagon HVX (target/hexagon) import macro definitions Hexagon HVX (target/hexagon) semantics generator
Hexagon HVX (target/hexagon) semantics generator - part 2 Hexagon HVX (target/hexagon) C preprocessor for decode tree Hexagon HVX (target/hexagon) instruction utility functions Hexagon HVX (target/hexagon) helper functions
Hexagon HVX (target/hexagon) TCG generation
Hexagon HVX (target/hexagon) helper overrides infrastructure Hexagon HVX (target/hexagon) helper overrides for histogram
instructions
Hexagon HVX (target/hexagon) helper overrides - vector assign & cmov Hexagon HVX (target/hexagon) helper overrides - vector add & sub Hexagon HVX (target/hexagon) helper overrides - vector shifts Hexagon HVX (target/hexagon) helper overrides - vector max/min Hexagon HVX (target/hexagon) helper overrides - vector logical ops Hexagon HVX (target/hexagon) helper overrides - vector compares Hexagon HVX (target/hexagon) helper overrides - vector splat and abs Hexagon HVX (target/hexagon) helper overrides - vector loads Hexagon HVX (target/hexagon) helper overrides - vector stores Hexagon HVX (target/hexagon) import semantics
Hexagon HVX (target/hexagon) instruction decoding
Hexagon HVX (target/hexagon) import instruction encodings Hexagon HVX (tests/tcg/hexagon) vector_add_int test Hexagon HVX (tests/tcg/hexagon) hvx_misc test
Hexagon HVX (tests/tcg/hexagon) scatter_gather test Hexagon HVX (tests/tcg/hexagon) histogram test
target/hexagon/cpu.h | 35 +- target/hexagon/gen_tcg_hvx.h | 903 +++++++++ target/hexagon/helper.h | 16 + target/hexagon/hex_arch_types.h | 5 + target/hexagon/hex_regs.h | 1 + target/hexagon/insn.h | 3 + target/hexagon/internal.h | 3 + target/hexagon/macros.h | 22 + target/hexagon/mmvec/decode_ext_mmvec.h | 24 + target/hexagon/mmvec/macros.h | 354 ++++ target/hexagon/mmvec/mmvec.h | 83 + target/hexagon/mmvec/system_ext_mmvec.h | 29 + target/hexagon/translate.h | 61 + tests/tcg/hexagon/hvx_histogram_input.h | 717 +++++++ tests/tcg/hexagon/hvx_histogram_row.h | 24 + target/hexagon/attribs_def.h.inc | 22 + target/hexagon/cpu.c | 80 +- target/hexagon/decode.c | 28 +- target/hexagon/gen_dectree_import.c | 13 + target/hexagon/gen_semantics.c | 33 + target/hexagon/genptr.c | 188 ++ target/hexagon/mmvec/decode_ext_mmvec.c | 236 +++ target/hexagon/mmvec/system_ext_mmvec.c | 66 + target/hexagon/op_helper.c | 282 ++- target/hexagon/translate.c | 243 ++- tests/tcg/hexagon/hvx_histogram.c | 88 + tests/tcg/hexagon/hvx_misc.c | 469 +++++ tests/tcg/hexagon/scatter_gather.c | 1011 ++++++++++ tests/tcg/hexagon/vector_add_int.c | 61 + target/hexagon/README | 81 +- target/hexagon/gen_helper_funcs.py | 115 +- target/hexagon/gen_helper_protos.py | 19 +- target/hexagon/gen_tcg_funcs.py | 257 ++- target/hexagon/hex_common.py | 13 + target/hexagon/imported/allext.idef | 25 + target/hexagon/imported/allext_macros.def | 25 + target/hexagon/imported/allextenc.def | 20 + target/hexagon/imported/allidefs.def | 1 + target/hexagon/imported/encode.def | 1 + target/hexagon/imported/macros.def | 88 + target/hexagon/imported/mmvec/encode_ext.def | 794 ++++++++ target/hexagon/imported/mmvec/ext.idef | 2606 ++++++++++++++++++++++++++ target/hexagon/imported/mmvec/macros.def | 842 +++++++++ target/hexagon/meson.build | 15 +- tests/tcg/hexagon/Makefile.target | 12 + tests/tcg/hexagon/hvx_histogram_row.S | 294 +++ 46 files changed, 10261 insertions(+), 47 deletions(-) create mode 100644 target/hexagon/gen_tcg_hvx.h create mode 100644 target/hexagon/mmvec/decode_ext_mmvec.h create mode 100644 target/hexagon/mmvec/macros.h create mode 100644 target/hexagon/mmvec/mmvec.h create mode 100644 target/hexagon/mmvec/system_ext_mmvec.h create mode 100644 tests/tcg/hexagon/hvx_histogram_input.h create mode 100644 tests/tcg/hexagon/hvx_histogram_row.h create mode 100644 target/hexagon/mmvec/decode_ext_mmvec.c create mode 100644 target/hexagon/mmvec/system_ext_mmvec.c create mode 100644 tests/tcg/hexagon/hvx_histogram.c create mode 100644 tests/tcg/hexagon/hvx_misc.c create mode 100644 tests/tcg/hexagon/scatter_gather.c create mode 100644 tests/tcg/hexagon/vector_add_int.c create mode 100644 target/hexagon/imported/allext.idef create mode 100644 target/hexagon/imported/allext_macros.def create mode 100644 target/hexagon/imported/allextenc.def create mode 100644 target/hexagon/imported/mmvec/encode_ext.def create mode 100644 target/hexagon/imported/mmvec/ext.idef create mode 100755 target/hexagon/imported/mmvec/macros.def create mode 100644 tests/tcg/hexagon/hvx_histogram_row.S
Signature · 1 line
2.7.4
PATCH v4 1/30 Hexagon HVX (target/hexagon) README
--- target/hexagon/README | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 80 insertions(+), 1 deletion(-)
target/hexagon/README +80 -1
@@ -1,9 +1,13 @@ Hexagon is Qualcomm's very long instruction word (VLIW) digital signal -processor(DSP). +processor(DSP). We also support Hexagon Vector eXtensions (HVX). HVX +is a wide vector coprocessor designed for high performance computer vision, +image processing, machine learning, and other workloads. The following versions of the Hexagon core are supported Scalar core: v67 https://developer.qualcomm.com/downloads/qualcomm-hexagon-v67-programmer-s-reference-manual + HVX extension: v66 + https://developer.qualcomm.com/downloads/qualcomm-hexagon-v66-hvx-programmer-s-reference-manual We presented an overview of the project at the 2019 KVM Forum. https://kvmforum2019.sched.com/event/Tmwc/qemu-hexagon-automatic-translation-of-the-isa-manual-pseudcode-to-tiny-code-instructions-of-a-vliw-architecture-niccolo-izzo-revng-taylor-simpson-qualcomm-innovation-center
@@ -124,6 +128,71 @@ There are also cases where we brute force the TCG code generation. Instructions with multiple definitions are examples. These require special handling because qemu helpers can only return a single value. +For HVX vectors, the generator behaves slightly differently. The wide vectors +won't fit in a TCGv or TCGv_i64, so we pass TCGv_ptr variables to pass the +address to helper functions. Here's an example for an HVX vector-add-word +istruction. + static void generate_V6_vaddw( + CPUHexagonState *env, + DisasContext *ctx, + Insn *insn, + Packet *pkt) + { + const int VdN = insn->regno[0]; + const intptr_t VdV_off = + ctx_future_vreg_off(ctx, VdN, 1, true); + TCGv_ptr VdV = tcg_temp_local_new_ptr(); + tcg_gen_addi_ptr(VdV, cpu_env, VdV_off); + const int VuN = insn->regno[1]; + const intptr_t VuV_off = + vreg_src_off(ctx, VuN); + TCGv_ptr VuV = tcg_temp_local_new_ptr(); + const int VvN = insn->regno[2]; + const intptr_t VvV_off = + vreg_src_off(ctx, VvN); + TCGv_ptr VvV = tcg_temp_local_new_ptr(); + tcg_gen_addi_ptr(VuV, cpu_env, VuV_off); + tcg_gen_addi_ptr(VvV, cpu_env, VvV_off); + TCGv slot = tcg_constant_tl(insn->slot); + gen_helper_V6_vaddw(cpu_env, VdV, VuV, VvV, slot); + tcg_temp_free(slot); + gen_log_vreg_write(ctx, VdV_off, VdN, EXT_DFL, insn->slot, false); + ctx_log_vreg_write(ctx, VdN, EXT_DFL, false); + tcg_temp_free_ptr(VdV); + tcg_temp_free_ptr(VuV); + tcg_temp_free_ptr(VvV); + } + +Notice that we also generate a variable named <operand>_off for each operand of +the instruction. This makes it easy to override the instruction semantics with +functions from tcg-op-gvec.h. Here's the override for this instruction. + #define fGEN_TCG_V6_vaddw(SHORTCODE) \ + tcg_gen_gvec_add(MO_32, VdV_off, VuV_off, VvV_off, \ + sizeof(MMVector), sizeof(MMVector)) + +Finally, we notice that the override doesn't use the TCGv_ptr variables, so +we don't generate them when an override is present. Here is what we generate +when the override is present. + static void generate_V6_vaddw( + CPUHexagonState *env, + DisasContext *ctx, + Insn *insn, + Packet *pkt) + { + const int VdN = insn->regno[0]; + const intptr_t VdV_off = + ctx_future_vreg_off(ctx, VdN, 1, true); + const int VuN = insn->regno[1]; + const intptr_t VuV_off = + vreg_src_off(ctx, VuN); + const int VvN = insn->regno[2]; + const intptr_t VvV_off = + vreg_src_off(ctx, VvN); + fGEN_TCG_V6_vaddw({ fHIDE(int i;) fVFOREACH(32, i) { VdV.w[i] = VuV.w[i] + VvV.w[i] ; } }); + gen_log_vreg_write(ctx, VdV_off, VdN, EXT_DFL, insn->slot, false); + ctx_log_vreg_write(ctx, VdN, EXT_DFL, false); + } + In addition to instruction semantics, we use a generator to create the decode tree. This generation is also a two step process. The first step is to run target/hexagon/gen_dectree_import.c to produce
@@ -140,6 +209,7 @@ runtime information for each thread and contains stuff like the GPR and predicate registers. macros.h +mmvec/macros.h The Hexagon arch lib relies heavily on macros for the instruction semantics. This is a great advantage for qemu because we can override them for different
@@ -203,6 +273,15 @@ During runtime, the following fields in CPUHexagonState (see cpu.h) are used pred_written boolean indicating if predicate was written mem_log_stores record of the stores (indexed by slot) +For Hexagon Vector eXtensions (HVX), the following fields are used + VRegs Vector registers + future_VRegs Registers to be stored during packet commit + tmp_VRegs Temporary registers *not* stored during commit + VRegs_updated Mask of predicated vector writes + QRegs Q (vector predicate) registers + future_QRegs Registers to be stored during packet commit + QRegs_updated Mask of predicated vector writes + *** Debugging *** You can turn on a lot of debugging by changing the HEX_DEBUG macro to 1 in
Signature · 1 line
2.7.4
PATCH v4 2/30 Hexagon HVX (target/hexagon) add Hexagon Vector eXtensions (HVX) to core
In reply to Taylor SimpsonHVX is a set of wide vector instructions. Machine state includes
vector registers (VRegs)
vector predicate registers (QRegs)
temporary registers for intermediate values
store buffer (masked stores and scatter/gather)
--- target/hexagon/cpu.h | 35 ++++++++++++++++- target/hexagon/hex_arch_types.h | 5 +++ target/hexagon/insn.h | 3 ++ target/hexagon/internal.h | 3 ++ target/hexagon/mmvec/mmvec.h | 83 +++++++++++++++++++++++++++++++++++++++++ target/hexagon/cpu.c | 78 ++++++++++++++++++++++++++++++++++++-- 6 files changed, 201 insertions(+), 6 deletions(-) create mode 100644 target/hexagon/mmvec/mmvec.h
target/hexagon/cpu.h +33 -2
@@ -26,6 +26,7 @@ typedef struct CPUHexagonState CPUHexagonState;#include "qemu-common.h" #include "exec/cpu-defs.h" #include "hex_regs.h" +#include "mmvec/mmvec.h" #define NUM_PREGS 4#define TOTAL_PER_THREAD_REGS 64
@@ -34,6 +35,7 @@ typedef struct CPUHexagonState CPUHexagonState;#define STORES_MAX 2#define REG_WRITES_MAX 32#define PRED_WRITES_MAX 5/* 4 insns + endloop */ +#define VSTORES_MAX 2#define TYPE_HEXAGON_CPU "hexagon-cpu"
@@ -52,6 +54,13 @@ typedef struct {uint64_t data64; } MemLog; +typedef struct { +target_ulong va; +int size; + DECLARE_BITMAP(mask, MAX_VEC_SIZE_BYTES / 8) QEMU_ALIGNED(16); + MMVector data QEMU_ALIGNED(16); +}VStoreLog ; +#define EXEC_STATUS_OK 0x0000#define EXEC_STATUS_STOP 0x0002#define EXEC_STATUS_REPLAY 0x0010
@@ -64,6 +73,9 @@ typedef struct {#define CLEAR_EXCEPTION (env->status &= (~EXEC_STATUS_EXCEPTION))#define SET_EXCEPTION (env->status |= EXEC_STATUS_EXCEPTION) +/* Maximum number of vector temps in a packet */ +#define VECTOR_TEMPS_MAX 4 +struct CPUHexagonState {target_ulong gpr[TOTAL_PER_THREAD_REGS ];target_ulong pred[NUM_PREGS ];
@@ -97,8 +109,27 @@ struct CPUHexagonState {target_ulong llsc_val;uint64_t llsc_val_i64; -target_ulong is_gather_store_insn; -target_ulong gather_issued; + MMVector VRegs[NUM_VREGS] QEMU_ALIGNED(16); + MMVector future_VRegs[VECTOR_TEMPS_MAX] QEMU_ALIGNED(16); + MMVector tmp_VRegs[VECTOR_TEMPS_MAX] QEMU_ALIGNED(16); + +VRegMask VRegs_updated; + + MMQReg QRegs[NUM_QREGS] QEMU_ALIGNED(16); + MMQReg future_QRegs[NUM_QREGS] QEMU_ALIGNED(16); +QRegMask QRegs_updated; + +/* Temporaries used within instructions */ + MMVectorPair VuuV QEMU_ALIGNED(16); + MMVectorPair VvvV QEMU_ALIGNED(16); + MMVectorPair VxxV QEMU_ALIGNED(16); + MMVector vtmp QEMU_ALIGNED(16); + MMQReg qtmp QEMU_ALIGNED(16); + +VStoreLog vstore[VSTORES_MAX ]; +target_ulong vstore_pending[VSTORES_MAX ]; +bool vtcm_pending; +VTCMStoreLog vtcm_log; };#define HEXAGON_CPU_CLASS (klass) \
target/hexagon/hex_arch_types.h +5 -0
@@ -19,6 +19,7 @@#define HEXAGON_ARCH_TYPES_H #include "qemu/osdep.h" +#include "mmvec/mmvec.h" #include "qemu/int128.h" /*
@@ -35,4 +36,8 @@ typedef uint64_t size8u_t;typedef int64_t size8s_t ;typedef Int128 size16s_t ; +typedef MMVector mmvector_t ; +typedef MMVectorPair mmvector_pair_t ; +typedef MMQReg mmqret_t ; +#endif
target/hexagon/insn.h +3 -0
@@ -67,6 +67,9 @@ struct Packet {bool pkt_has_store_s0;bool pkt_has_store_s1; +bool pkt_has_hvx; +Insn *vhist_insn; +Insn insn[INSTRUCTIONS_MAX ]; };
target/hexagon/internal.h +3 -0
@@ -31,6 +31,9 @@int hexagon_gdb_read_register (CPUState *cpu,GByteArray *buf,int reg);int hexagon_gdb_write_register (CPUState *cpu,uint8_t *buf,int reg); + +void hexagon_debug_vreg (CPUHexagonState *env,int regnum); +void hexagon_debug_qreg (CPUHexagonState *env,int regnum);void hexagon_debug (CPUHexagonState *env);extern const char *const hexagon_regnames[TOTAL_PER_THREAD_REGS ];
target/hexagon/mmvec/mmvec.h new file +83 -0
83 lines not on this page · raw message
target/hexagon/cpu.c +74 -4
106 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v4 3/30 Hexagon HVX (target/hexagon) register names
In reply to Taylor Simpson--- target/hexagon/hex_regs.h | 1 + target/hexagon/cpu.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
target/hexagon/hex_regs.h +1 -0
@@ -76,6 +76,7 @@ enum {/* Use reserved control registers for qemu execution counts */ HEX_REG_QEMU_PKT_CNT =52 ,HEX_REG_QEMU_INSN_CNT =53 , +HEX_REG_QEMU_HVX_CNT =54 ,HEX_REG_UTIMERLO =62 , HEX_REG_UTIMERHI = 63, };
target/hexagon/cpu.c +1 -1
@@ -59,7 +59,7 @@ const char * const hexagon_regnames[TOTAL_PER_THREAD_REGS] = {"r24" ,"r25" ,"r26" ,"r27" ,"r28" ,"r29" ,"r30" ,"r31" ,"sa0" ,"lc0" ,"sa1" ,"lc1" ,"p3_0" ,"c5" ,"m0" ,"m1" ,"usr" ,"pc" ,"ugp" ,"gp" ,"cs0" ,"cs1" ,"c14" ,"c15" , -"c16" ,"c17" ,"c18" ,"c19" ,"pkt_cnt" ,"insn_cnt" ,"c22" ,"c23" , +"c16" ,"c17" ,"c18" ,"c19" ,"pkt_cnt" ,"insn_cnt" ,"hvx_cnt" ,"c23" , "c24", "c25", "c26", "c27", "c28", "c29", "c30", "c31", };
Signature · 1 line
2.7.4
PATCH v4 4/30 Hexagon HVX (target/hexagon) instruction attributes
In reply to Taylor Simpson--- target/hexagon/attribs_def.h.inc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
target/hexagon/attribs_def.h.inc +22 -0
@@ -41,6 +41,27 @@ DEF_ATTRIB(STORE, "Stores to memory", "", "") DEF_ATTRIB(MEMLIKE, "Memory-like instruction", "", "") DEF_ATTRIB(MEMLIKE_PACKET_RULES, "follows Memory-like packet rules", "", "") +/* V6 Vector attributes */ +DEF_ATTRIB(CVI, "Executes on the HVX extension", "", "") + +DEF_ATTRIB(CVI_NEW, "New value memory instruction executes on HVX", "", "") +DEF_ATTRIB(CVI_VM, "Memory instruction executes on HVX", "", "") +DEF_ATTRIB(CVI_VP, "Permute instruction executes on HVX", "", "") +DEF_ATTRIB(CVI_VP_VS, "Double vector permute/shft insn executes on HVX", "", "") +DEF_ATTRIB(CVI_VX, "Multiply instruction executes on HVX", "", "") +DEF_ATTRIB(CVI_VX_DV, "Double vector multiply insn executes on HVX", "", "") +DEF_ATTRIB(CVI_VS, "Shift instruction executes on HVX", "", "") +DEF_ATTRIB(CVI_VS_VX, "Permute/shift and multiply insn executes on HVX", "", "") +DEF_ATTRIB(CVI_VA, "ALU instruction executes on HVX", "", "") +DEF_ATTRIB(CVI_VA_DV, "Double vector alu instruction executes on HVX", "", "") +DEF_ATTRIB(CVI_4SLOT, "Consumes all the vector execution resources", "", "") +DEF_ATTRIB(CVI_TMP, "Transient Memory Load not written to register", "", "") +DEF_ATTRIB(CVI_GATHER, "CVI Gather operation", "", "") +DEF_ATTRIB(CVI_SCATTER, "CVI Scatter operation", "", "") +DEF_ATTRIB(CVI_SCATTER_RELEASE, "CVI Store Release for scatter", "", "") +DEF_ATTRIB(CVI_TMP_DST, "CVI instruction that doesn't write a register", "", "") +DEF_ATTRIB(CVI_SLOT23, "Can execute in slot 2 or slot 3 (HVX)", "", "") + /* Change-of-flow attributes */ DEF_ATTRIB(JUMP, "Jump-type instruction", "", "")
@@ -86,6 +107,7 @@ DEF_ATTRIB(HWLOOP1_END, "Ends HW loop1", "", "") DEF_ATTRIB(DCZEROA, "dczeroa type", "", "") DEF_ATTRIB(ICFLUSHOP, "icflush op type", "", "") DEF_ATTRIB(DCFLUSHOP, "dcflush op type", "", "") +DEF_ATTRIB(L2FLUSHOP, "l2flush op type", "", "") DEF_ATTRIB(DCFETCH, "dcfetch type", "", "") DEF_ATTRIB(L2FETCH, "Instruction is l2fetch type", "", "")
Signature · 1 line
2.7.4
PATCH v4 5/30 Hexagon HVX (target/hexagon) macros
In reply to Taylor Simpsonmacros to interface with the generator
macros referenced in instruction semantics
--- target/hexagon/macros.h | 22 +++ target/hexagon/mmvec/macros.h | 354 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 376 insertions(+) create mode 100644 target/hexagon/mmvec/macros.h
target/hexagon/macros.h +22 -0
@@ -266,6 +266,10 @@ static inline void gen_pred_cancel(TCGv pred, int slot_num)#define fNEWREG_ST (VAL ) (VAL) +#define fVSATUVALN (N ,VAL ) \ + ({ \ + (((int)(VAL)) < 0) ? 0 : ((1LL << (N)) - 1); \ + })#define fSATUVALN (N ,VAL ) \ ({ \ fSET_OVERFLOW(); \
@@ -276,10 +280,16 @@ static inline void gen_pred_cancel(TCGv pred, int slot_num)fSET_OVERFLOW (); \ ((VAL ) <0 ) ? (-(1LL << ((N ) -1 ))) : ((1LL << ((N ) -1 )) -1 ); \ }) +#define fVSATVALN (N ,VAL ) \ + ({ \ + ((VAL) < 0) ? (-(1LL << ((N) - 1))) : ((1LL << ((N) - 1)) - 1); \ + })#define fZXTN (N ,M ,VAL ) (((N) != 0) ? extract64((VAL), 0, (N)) : 0LL)#define fSXTN (N ,M ,VAL ) (((N) != 0) ? sextract64((VAL), 0, (N)) : 0LL)#define fSATN (N ,VAL ) \ ((fSXTN(N, 64, VAL) == (VAL)) ? (VAL) : fSATVALN(N, VAL)) +#define fVSATN (N ,VAL ) \ + ((fSXTN(N, 64, VAL) == (VAL)) ? (VAL) : fVSATVALN(N, VAL))#define fADDSAT64 (DST ,A ,B ) \ do { \ uint64_t __a = fCAST8u(A); \
@@ -302,12 +312,18 @@ static inline void gen_pred_cancel(TCGv pred, int slot_num)DST = __sum; \ } \ } while (0) +#define fVSATUN (N ,VAL ) \ + ((fZXTN(N, 64, VAL) == (VAL)) ? (VAL) : fVSATUVALN(N, VAL))#define fSATUN (N ,VAL ) \ ((fZXTN(N, 64, VAL) == (VAL)) ? (VAL) : fSATUVALN(N, VAL))#define fSATH (VAL ) (fSATN(16, VAL))#define fSATUH (VAL ) (fSATUN(16, VAL)) +#define fVSATH (VAL ) (fVSATN(16, VAL)) +#define fVSATUH (VAL ) (fVSATUN(16, VAL))#define fSATUB (VAL ) (fSATUN(8, VAL))#define fSATB (VAL ) (fSATN(8, VAL)) +#define fVSATUB (VAL ) (fVSATUN(8, VAL)) +#define fVSATB (VAL ) (fVSATN(8, VAL))#define fIMMEXT (IMM ) (IMM = IMM)#define fMUST_IMMEXT (IMM ) fIMMEXT(IMM)
@@ -414,6 +430,8 @@ static inline TCGv gen_read_ireg(TCGv result, TCGv val, int shift)#define fCAST4s (A ) ((int32_t)(A))#define fCAST8u (A ) ((uint64_t)(A))#define fCAST8s (A ) ((int64_t)(A)) +#define fCAST2_2s (A ) ((int16_t)(A)) +#define fCAST2_2u (A ) ((uint16_t)(A))#define fCAST4_4s (A ) ((int32_t)(A))#define fCAST4_4u (A ) ((uint32_t)(A))#define fCAST4_8s (A ) ((int64_t)((int32_t)(A)))
@@ -511,7 +529,9 @@ static inline TCGv gen_read_ireg(TCGv result, TCGv val, int shift)#define fPM_M (REG ,MVAL ) do { REG = REG + (MVAL); } while (0)#endif #define fSCALE (N ,A ) (((int64_t)(A)) << N) +#define fVSATW (A ) fVSATN(32, ((long long)A))#define fSATW (A ) fSATN(32, ((long long)A)) +#define fVSAT (A ) fVSATN(32, (A))#define fSAT (A ) fSATN(32, (A))#define fSAT_ORIG_SHL (A ,ORIG_REG ) \ ((((int32_t)((fSAT(A)) ^ ((int32_t)(ORIG_REG)))) < 0) \
@@ -648,12 +668,14 @@ static inline TCGv gen_read_ireg(TCGv result, TCGv val, int shift)fSETBIT (j,DST ,VAL ); \ } \ } while (0) +#define fCOUNTONES_2 (VAL ) ctpop16(VAL)#define fCOUNTONES_4 (VAL ) ctpop32(VAL)#define fCOUNTONES_8 (VAL ) ctpop64(VAL)#define fBREV_8 (VAL ) revbit64(VAL)#define fBREV_4 (VAL ) revbit32(VAL)#define fCL1_8 (VAL ) clo64(VAL)#define fCL1_4 (VAL ) clo32(VAL) +#define fCL1_2 (VAL ) (clz32(~(uint16_t)(VAL) & 0xffff) - 16)#define fINTERLEAVE (ODD ,EVEN ) interleave(ODD, EVEN)#define fDEINTERLEAVE (MIXED ) deinterleave(MIXED)#define fHIDE (A ) A
target/hexagon/mmvec/macros.h new file +354 -0
354 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v4 6/30 Hexagon HVX (target/hexagon) import macro definitions
In reply to Taylor SimpsonImported from the Hexagon architecture library
imported/allext_macros.def Top level macro include for all extensions
imported/macros.def Scalar core macros (some HVX here)
imported/mmvec/macros.def HVX macro definitionsThe macro definition files specify instruction attributes that are applied to each instruction that reverences the macro.
--- target/hexagon/imported/allext_macros.def | 25 + target/hexagon/imported/macros.def | 88 ++++ target/hexagon/imported/mmvec/macros.def | 842 ++++++++++++++++++++++++++++++ 3 files changed, 955 insertions(+) create mode 100644 target/hexagon/imported/allext_macros.def create mode 100755 target/hexagon/imported/mmvec/macros.def
target/hexagon/imported/allext_macros.def new file +25 -0
@@ -0,0 +1,25 @@ +/* + * Copyright(c) 2019-2021 Qualcomm Innovation Center, Inc. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <http://www.gnu.org/licenses/>. + */ + +/* + * Top level file for all instruction set extensions + */ +#define EXTNAME mmvec +#define EXTSTR "mmvec" +#include "mmvec/macros.def" +#undef EXTNAME +#undef EXTSTR
target/hexagon/imported/macros.def +88 -0
157 lines not on this page · raw message
target/hexagon/imported/mmvec/macros.def new file +842 -0
842 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v4 7/30 Hexagon HVX (target/hexagon) semantics generator
In reply to Taylor SimpsonAdd HVX support to the semantics generator
--- target/hexagon/gen_semantics.c | 33 +++++++++++++++++++++++++++++++++ target/hexagon/hex_common.py | 13 +++++++++++++ 2 files changed, 46 insertions(+)
target/hexagon/gen_semantics.c +33 -0
@@ -44,6 +44,11 @@ int main(int argc, char *argv[])* Q6INSN(A2_add,"Rd32=add(Rs32,Rt32)",ATTRIBS(), * "Add 32-bit registers", * { RdV=RsV+RtV;}) +* HVX instructions have the following form +* EXTINSN(V6_vinsertwr, "Vx32.w=vinsert(Rt32)", +* ATTRIBS(A_EXTENSION,A_CVI,A_CVI_VX), +* "Insert Word Scalar into Vector", +* VxV.uw[0] = RtV;) */ #define Q6INSN (TAG ,BEH ,ATTRIBS ,DESCR ,SEM ) \ do { \
@@ -59,8 +64,23 @@ int main(int argc, char *argv[]) ")\n", \#TAG , STRINGIZE(ATTRIBS)); \ } while (0); +#define EXTINSN (TAG ,BEH ,ATTRIBS ,DESCR ,SEM ) \ + do { \ + fprintf(outfile, "SEMANTICS( \\\n" \ + " \"%s\", \\\n" \ + " %s, \\\n" \ + " \"\"\"%s\"\"\" \\\n" \ + ")\n", \ + #TAG, STRINGIZE(BEH), STRINGIZE(SEM)); \ + fprintf(outfile, "ATTRIBUTES( \\\n" \ + " \"%s\", \\\n" \ + " \"%s\" \\\n" \ + ")\n", \ + #TAG, STRINGIZE(ATTRIBS)); \ + } while (0);#include "imported/allidefs.def" #undef Q6INSN +#undef EXTINSN/* * Process the macro definitions
@@ -83,6 +103,19 @@ int main(int argc, char *argv[])#include "imported/macros.def" #undef DEF_MACRO +/* +* Process the macros for HVX +*/ +#define DEF_MACRO (MNAME ,BEH ,ATTRS ) \ + fprintf(outfile, "MACROATTRIB( \\\n" \ + " \"%s\", \\\n" \ + " \"\"\"%s\"\"\", \\\n" \ + " \"%s\" \\\n" \ + ")\n", \ + #MNAME, STRINGIZE(BEH), STRINGIZE(ATTRS)); +#include "imported/allext_macros.def" +#undef DEF_MACRO +fclose (outfile);return 0 ; }
target/hexagon/hex_common.py +13 -0
@@ -143,6 +143,9 @@ def compute_tag_immediates(tag): ## P predicate register ## R GPR register ## M modifier register +## Q HVX predicate vector +## V HVX vector register +## O HVX new vector register ## regid can be one of the following ## d, e destination register ## dd destination register pair
@@ -178,6 +181,9 @@ def is_readwrite(regid): def is_scalar_reg(regtype): return regtype in "RPC" +def is_hvx_reg(regtype): + return regtype in "VQ" + def is_old_val(regtype, regid, tag): return regtype+regid+'V' in semdict[tag]
@@ -201,6 +207,13 @@ def need_ea(tag): def skip_qemu_helper(tag): return tag in overrides.keys() +def is_tmp_result(tag): + return ('A_CVI_TMP' in attribdict[tag] or + 'A_CVI_TMP_DST' in attribdict[tag]) + +def is_new_result(tag): + return ('A_CVI_NEW' in attribdict[tag]) + def imm_name(immlett): return "%siV" % immlett
Signature · 1 line
2.7.4
PATCH v4 8/30 Hexagon HVX (target/hexagon) semantics generator - part 2
In reply to Taylor Simpson--- target/hexagon/gen_helper_funcs.py | 112 ++++++++++++++-- target/hexagon/gen_helper_protos.py | 16 ++- target/hexagon/gen_tcg_funcs.py | 254 ++++++++++++++++++++++++++++++++++-- 3 files changed, 360 insertions(+), 22 deletions(-)
target/hexagon/gen_helper_funcs.py +103 -9
@@ -48,12 +48,26 @@ def gen_helper_arg_pair(f,regtype,regid,regno): if regno >= 0 : f.write(", ") f.write("int64_t %s%sV" % (regtype,regid)) +def gen_helper_arg_ext(f,regtype,regid,regno): + if regno > 0 : f.write(", ") + f.write("void *%s%sV_void" % (regtype,regid)) + +def gen_helper_arg_ext_pair(f,regtype,regid,regno): + if regno > 0 : f.write(", ") + f.write("void *%s%sV_void" % (regtype,regid)) + def gen_helper_arg_opn(f,regtype,regid,i,tag): if (hex_common.is_pair(regid)): - gen_helper_arg_pair(f,regtype,regid,i) + if (hex_common.is_hvx_reg(regtype)): + gen_helper_arg_ext_pair(f,regtype,regid,i) + else: + gen_helper_arg_pair(f,regtype,regid,i) elif (hex_common.is_single(regid)): if hex_common.is_old_val(regtype, regid, tag): - gen_helper_arg(f,regtype,regid,i) + if (hex_common.is_hvx_reg(regtype)): + gen_helper_arg_ext(f,regtype,regid,i) + else: + gen_helper_arg(f,regtype,regid,i) elif hex_common.is_new_val(regtype, regid, tag): gen_helper_arg_new(f,regtype,regid,i) else:
@@ -72,25 +86,67 @@ def gen_helper_dest_decl_pair(f,regtype,regid,regno,subfield=""): f.write(" int64_t %s%sV%s = 0;\n" % \ (regtype,regid,subfield)) +def gen_helper_dest_decl_ext(f,regtype,regid): + if (regtype == "Q"): + f.write(" /* %s%sV is *(MMQReg *)(%s%sV_void) */\n" % \ + (regtype,regid,regtype,regid)) + else: + f.write(" /* %s%sV is *(MMVector *)(%s%sV_void) */\n" % \ + (regtype,regid,regtype,regid)) + +def gen_helper_dest_decl_ext_pair(f,regtype,regid,regno): + f.write(" /* %s%sV is *(MMVectorPair *))%s%sV_void) */\n" % \ + (regtype,regid,regtype, regid)) + def gen_helper_dest_decl_opn(f,regtype,regid,i): if (hex_common.is_pair(regid)): - gen_helper_dest_decl_pair(f,regtype,regid,i) + if (hex_common.is_hvx_reg(regtype)): + gen_helper_dest_decl_ext_pair(f,regtype,regid, i) + else: + gen_helper_dest_decl_pair(f,regtype,regid,i) elif (hex_common.is_single(regid)): - gen_helper_dest_decl(f,regtype,regid,i) + if (hex_common.is_hvx_reg(regtype)): + gen_helper_dest_decl_ext(f,regtype,regid) + else: + gen_helper_dest_decl(f,regtype,regid,i) else: print("Bad register parse: ",regtype,regid,toss,numregs) +def gen_helper_src_var_ext(f,regtype,regid): + if (regtype == "Q"): + f.write(" /* %s%sV is *(MMQReg *)(%s%sV_void) */\n" % \ + (regtype,regid,regtype,regid)) + else: + f.write(" /* %s%sV is *(MMVector *)(%s%sV_void) */\n" % \ + (regtype,regid,regtype,regid)) + +def gen_helper_src_var_ext_pair(f,regtype,regid,regno): + f.write(" /* %s%sV%s is *(MMVectorPair *)(%s%sV%s_void) */\n" % \ + (regtype,regid,regno,regtype,regid,regno)) + def gen_helper_return(f,regtype,regid,regno): f.write(" return %s%sV;\n" % (regtype,regid)) def gen_helper_return_pair(f,regtype,regid,regno): f.write(" return %s%sV;\n" % (regtype,regid)) +def gen_helper_dst_write_ext(f,regtype,regid): + return + +def gen_helper_dst_write_ext_pair(f,regtype,regid): + return + def gen_helper_return_opn(f, regtype, regid, i): if (hex_common.is_pair(regid)): - gen_helper_return_pair(f,regtype,regid,i) + if (hex_common.is_hvx_reg(regtype)): + gen_helper_dst_write_ext_pair(f,regtype,regid) + else: + gen_helper_return_pair(f,regtype,regid,i) elif (hex_common.is_single(regid)): - gen_helper_return(f,regtype,regid,i) + if (hex_common.is_hvx_reg(regtype)): + gen_helper_dst_write_ext(f,regtype,regid) + else: + gen_helper_return(f,regtype,regid,i) else: print("Bad register parse: ",regtype,regid,toss,numregs)
@@ -129,14 +185,20 @@ def gen_helper_function(f, tag, tagregs, tagimms): % (tag, tag)) else: ## The return type of the function is the type of the destination - ## register + ## register (if scalar) i=0 for regtype,regid,toss,numregs in regs: if (hex_common.is_written(regid)): if (hex_common.is_pair(regid)): - gen_helper_return_type_pair(f,regtype,regid,i) + if (hex_common.is_hvx_reg(regtype)): + continue + else: + gen_helper_return_type_pair(f,regtype,regid,i) elif (hex_common.is_single(regid)): - gen_helper_return_type(f,regtype,regid,i) + if (hex_common.is_hvx_reg(regtype)): + continue + else: + gen_helper_return_type(f,regtype,regid,i) else: print("Bad register parse: ",regtype,regid,toss,numregs) i += 1
@@ -145,16 +207,37 @@ def gen_helper_function(f, tag, tagregs, tagimms): f.write("void") f.write(" HELPER(%s)(CPUHexagonState *env" % tag) + ## Arguments include the vector destination operands i = 1 + for regtype,regid,toss,numregs in regs: + if (hex_common.is_written(regid)): + if (hex_common.is_pair(regid)): + if (hex_common.is_hvx_reg(regtype)): + gen_helper_arg_ext_pair(f,regtype,regid,i) + else: + continue + elif (hex_common.is_single(regid)): + if (hex_common.is_hvx_reg(regtype)): + gen_helper_arg_ext(f,regtype,regid,i) + else: + # This is the return value of the function + continue + else: + print("Bad register parse: ",regtype,regid,toss,numregs) + i += 1 ## Arguments to the helper function are the source regs and immediates for regtype,regid,toss,numregs in regs: if (hex_common.is_read(regid)): + if (hex_common.is_hvx_reg(regtype) and + hex_common.is_readwrite(regid)): + continue gen_helper_arg_opn(f,regtype,regid,i,tag) i += 1 for immlett,bits,immshift in imms: gen_helper_arg_imm(f,immlett) i += 1 + if hex_common.need_slot(tag): if i > 0: f.write(", ") f.write("uint32_t slot")
@@ -173,6 +256,17 @@ def gen_helper_function(f, tag, tagregs, tagimms): gen_helper_dest_decl_opn(f,regtype,regid,i) i += 1 + for regtype,regid,toss,numregs in regs: + if (hex_common.is_read(regid)): + if (hex_common.is_pair(regid)): + if (hex_common.is_hvx_reg(regtype)): + gen_helper_src_var_ext_pair(f,regtype,regid,i) + elif (hex_common.is_single(regid)): + if (hex_common.is_hvx_reg(regtype)): + gen_helper_src_var_ext(f,regtype,regid) + else: + print("Bad register parse: ",regtype,regid,toss,numregs) + if 'A_FPOP' in hex_common.attribdict[tag]: f.write(' arch_fpop_start(env);\n');
target/hexagon/gen_helper_protos.py +15 -1
@@ -94,19 +94,33 @@ def gen_helper_prototype(f, tag, tagregs, tagimms): f.write('DEF_HELPER_%s(%s' % (def_helper_size, tag)) ## Generate the qemu DEF_HELPER type for each result + ## Iterate over this list twice + ## - Emit the scalar result + ## - Emit the vector result i=0 for regtype,regid,toss,numregs in regs: if (hex_common.is_written(regid)): - gen_def_helper_opn(f, tag, regtype, regid, toss, numregs, i) + if (not hex_common.is_hvx_reg(regtype)): + gen_def_helper_opn(f, tag, regtype, regid, toss, numregs, i) i += 1 ## Put the env between the outputs and inputs f.write(', env' ) i += 1 + # Second pass + for regtype,regid,toss,numregs in regs: + if (hex_common.is_written(regid)): + if (hex_common.is_hvx_reg(regtype)): + gen_def_helper_opn(f, tag, regtype, regid, toss, numregs, i) + i += 1 + ## Generate the qemu type for each input operand (regs and immediates) for regtype,regid,toss,numregs in regs: if (hex_common.is_read(regid)): + if (hex_common.is_hvx_reg(regtype) and + hex_common.is_readwrite(regid)): + continue gen_def_helper_opn(f, tag, regtype, regid, toss, numregs, i) i += 1 for immlett,bits,immshift in imms:
target/hexagon/gen_tcg_funcs.py +242 -12
350 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v4 9/30 Hexagon HVX (target/hexagon) C preprocessor for decode tree
In reply to Taylor Simpson--- target/hexagon/gen_dectree_import.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
target/hexagon/gen_dectree_import.c +13 -0
@@ -40,6 +40,11 @@ const char * const opcode_names[] = {* Q6INSN(A2_add,"Rd32=add(Rs32,Rt32)",ATTRIBS(), * "Add 32-bit registers", * { RdV=RsV+RtV;}) +* HVX instructions have the following form +* EXTINSN(V6_vinsertwr, "Vx32.w=vinsert(Rt32)", +* ATTRIBS(A_EXTENSION,A_CVI,A_CVI_VX,A_CVI_LATE), +* "Insert Word Scalar into Vector", +* VxV.uw[0] = RtV;) */ const char *const opcode_syntax[XX_LAST_OPCODE ] = { #define Q6INSN(TAG, BEH, ATTRIBS, DESCR, SEM) \
@@ -105,6 +110,14 @@ static const char *get_opcode_enc(int opcode)static const char *get_opcode_enc_class (int opcode) { +const char *tmp = opcode_encodings[opcode].encoding; +if (tmp ==NULL ) { +const char *test ="V6_" ;/* HVX */ +const char *name = opcode_names[opcode]; +if (strncmp (name, test,strlen (test)) ==0 ) { +return "EXT_mmvec" ; + } + }return opcode_enc_class_names[opcode_encodings[opcode].enc_class]; }
Signature · 1 line
2.7.4
PATCH v4 10/30 Hexagon HVX (target/hexagon) instruction utility functions
In reply to Taylor SimpsonFunctions to support scatter/gather
Add new file to target/hexagon/meson.build
--- target/hexagon/mmvec/system_ext_mmvec.h | 29 +++++++++++++++ target/hexagon/mmvec/system_ext_mmvec.c | 66 +++++++++++++++++++++++++++++++++ target/hexagon/meson.build | 1 + 3 files changed, 96 insertions(+) create mode 100644 target/hexagon/mmvec/system_ext_mmvec.h create mode 100644 target/hexagon/mmvec/system_ext_mmvec.c
target/hexagon/mmvec/system_ext_mmvec.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* Copyright(c) 2019-2021 Qualcomm Innovation Center, Inc. All Rights Reserved. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef HEXAGON_SYSTEM_EXT_MMVEC_H +#define HEXAGON_SYSTEM_EXT_MMVEC_H + +void mem_gather_store (CPUHexagonState *env,target_ulong vaddr,int slot); +void mem_vector_scatter_init (CPUHexagonState *env,int slot, +target_ulong base_vaddr,int length, +int element_size); +void mem_vector_gather_init (CPUHexagonState *env, +target_ulong base_vaddr,int length, +int element_size); + +#endif
target/hexagon/mmvec/system_ext_mmvec.c new file +66 -0
66 lines not on this page · raw message
target/hexagon/meson.build +1 -0
@@ -174,6 +174,7 @@ hexagon_ss.add(files( 'printinsn.c', 'arch.c', 'fma_emu.c', + 'mmvec/system_ext_mmvec.c', )) target_arch += {'hexagon': hexagon_ss}
Signature · 1 line
2.7.4
Re: [PATCH v4 10/30] Hexagon HVX (target/hexagon) instruction utility functions
Quoted 5 lines · Taylor Simpson
target/hexagon/mmvec/system_ext_mmvec.c new file +5
-0+void mem_vector_scatter_init (CPUHexagonState *env,int slot, +target_ulong base_vaddr, +int length,int element_size) +{ +int i;
target/hexagon/mmvec/system_ext_mmvec.c line 49
Quoted 10 lines
target/hexagon/mmvec/system_ext_mmvec.c new file +10
-0+ +for (i =0 ; i <sizeof (MMVector); i++) { + env->vtcm_log.data.ub[i] =0 ; + } +bitmap_zero (env->vtcm_log.mask,MAX_VEC_SIZE_BYTES ); + + env->vtcm_pending = true; + env->vtcm_log.op = false; + env->vtcm_log.op_size =0 ; + env->vtcm_log.size =sizeof (MMVector);
Init really wants size != 0 here? Because it's not that way for gather...
Otherwise it looks like you want
memset(&env->vtcm_log, 0, sizeof(env->vtcm_log));
Quoted 5 lines
target/hexagon/mmvec/system_ext_mmvec.c new file +5
-0+void mem_vector_gather_init (CPUHexagonState *env, +target_ulong base_vaddr, +int length,int element_size) +{ +int i;
target/hexagon/mmvec/system_ext_mmvec.c line 66
Quoted 10 lines
target/hexagon/mmvec/system_ext_mmvec.c new file +10
-0+ +for (i =0 ; i <sizeof (MMVector); i++) { + env->vtcm_log.data.ub[i] =0 ; + env->vtcm_log.va[i] =0 ; + env->tmp_VRegs[0 ].ub[i] =0 ; + } +bitmap_zero (env->vtcm_log.mask,MAX_VEC_SIZE_BYTES /8 ); + env->vtcm_log.op = false; + env->vtcm_log.op_size =0 ; +}
Likewise memset of vtcm_log, with a second memset for tmp_Vregs[0].
r~
RE: [PATCH v4 10/30] Hexagon HVX (target/hexagon) instruction utility functions
Quoted 10 lines
-----Original Message-----
From: Richard Henderson <[email protected]>
Sent: Friday, October 29, 2021 1:53 PM
To: Taylor Simpson <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; Brian Cain <[email protected]>
Subject: Re: [PATCH v4 10/30] Hexagon HVX (target/hexagon) instruction utility functionsOn 10/12/21 3:10 AM, Taylor Simpson wrote:
Quoted 16 lines
Quoted 4 lines
target/hexagon/mmvec/system_ext_mmvec.c new file +4
-0+void mem_vector_scatter_init (CPUHexagonState *env,int slot, +target_ulong base_vaddr, +int length,int element_size) { +int i;target/hexagon/mmvec/system_ext_mmvec.c line 49
Quoted 10 lines
target/hexagon/mmvec/system_ext_mmvec.c new file +10
-0+ +for (i =0 ; i <sizeof (MMVector); i++) { + env->vtcm_log.data.ub[i] =0 ; + } +bitmap_zero (env->vtcm_log.mask,MAX_VEC_SIZE_BYTES ); + + env->vtcm_pending = true; + env->vtcm_log.op = false; + env->vtcm_log.op_size =0 ; + env->vtcm_log.size =sizeof (MMVector);Init really wants size != 0 here? Because it's not that way for gather...
The vtcm_log.size is only used during packet commit when there is a scatter. It's not used for gather.
Since it's always sizeof(MMVector), I will remove it and replace all the uses with the constant value.
Also, op and op_size are only used for scatter, so I'll remove the initialization from mem_vector_gather_init.
Quoted 4 lines
Otherwise it looks like you want
memset(&env->vtcm_log, 0, sizeof(env->vtcm_log));
Actually, this initialization is not needed because the values will be overwritten by the instruction. So, I'll remove it.
Quoted 2 lines
Likewise memset of
vtcm_log, with a second memset for tmp_Vregs[0].
Ditto.
Thanks a ton for the reviews! This is the last feedback to be addressed on this series. I'll send v5 out tonight for your review.
Thanks,
Taylor
PATCH v4 11/30 Hexagon HVX (target/hexagon) helper functions
In reply to Taylor SimpsonProbe and commit vector stores (masked and scatter/gather) Log vector register writes
Add the execution counters to the debug log Histogram instructions
--- target/hexagon/helper.h | 16 +++ target/hexagon/op_helper.c | 282 ++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 296 insertions(+), 2 deletions(-)
target/hexagon/helper.h +16 -0
@@ -23,6 +23,8 @@ DEF_HELPER_1(debug_start_packet, void, env) DEF_HELPER_FLAGS_3(debug_check_store_width, TCG_CALL_NO_WG, void, env, int, int) DEF_HELPER_FLAGS_3(debug_commit_end, TCG_CALL_NO_WG, void, env, int, int) DEF_HELPER_2(commit_store, void, env, int) +DEF_HELPER_3(gather_store, void, env, i32, int) +DEF_HELPER_1(commit_hvx_stores, void, env) DEF_HELPER_FLAGS_4(fcircadd, TCG_CALL_NO_RWG_SE, s32, s32, s32, s32, s32) DEF_HELPER_FLAGS_1(fbrev, TCG_CALL_NO_RWG_SE, i32, i32)DEF_HELPER_3 (sfrecipa, i64, env, f32, f32)
@@ -90,4 +92,18 @@ DEF_HELPER_4(sffms_lib, f32, env, f32, f32, f32) DEF_HELPER_3(dfmpyfix, f64, env, f64, f64)DEF_HELPER_4 (dfmpyhh, f64, env, f64, f64, f64) +/* Histogram instructions */ +DEF_HELPER_1(vhist, void, env) +DEF_HELPER_1(vhistq, void, env) +DEF_HELPER_1(vwhist256, void, env) +DEF_HELPER_1(vwhist256q, void, env) +DEF_HELPER_1(vwhist256_sat, void, env) +DEF_HELPER_1(vwhist256q_sat, void, env) +DEF_HELPER_1(vwhist128, void, env) +DEF_HELPER_1(vwhist128q, void, env) +DEF_HELPER_2(vwhist128m, void, env, s32) +DEF_HELPER_2(vwhist128qm, void, env, s32) + DEF_HELPER_2(probe_pkt_scalar_store_s0, void, env, int) +DEF_HELPER_2(probe_hvx_stores, void, env, int) +DEF_HELPER_3 (probe_pkt_scalar_hvx_stores, void, env, int, int)
target/hexagon/op_helper.c +280 -2
313 lines not on this page · raw message
Signature · 1 line
2.7.4
Re: [PATCH v4 11/30] Hexagon HVX (target/hexagon) helper functions
Quoted 10 lines · Taylor Simpson
Probe and commit vector stores (masked and scatter/gather) Log vector register writes
Add the execution counters to the debug log Histogram instructionsSigned-off-by Taylor Simpson<[email protected]>--- target/hexagon/helper.h | 16 +++ target/hexagon/op_helper.c | 282 ++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 296 insertions(+), 2 deletions(-)
r~
PATCH v4 12/30 Hexagon HVX (target/hexagon) TCG generation
In reply to Taylor Simpson--- target/hexagon/translate.h | 61 ++++++++++++ target/hexagon/genptr.c | 15 +++ target/hexagon/translate.c | 243 ++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 315 insertions(+), 4 deletions(-)
target/hexagon/translate.h +61 -0
@@ -29,6 +29,7 @@ typedef struct DisasContext {uint32_t mem_idx;uint32_t num_packets;uint32_t num_insns; +uint32_t num_hvx_insns;int reg_log[REG_WRITES_MAX ];int reg_log_idx;DECLARE_BITMAP (regs_written,TOTAL_PER_THREAD_REGS );
@@ -37,6 +38,20 @@ typedef struct DisasContext {DECLARE_BITMAP (pregs_written,NUM_PREGS );uint8_t store_width[STORES_MAX ];bool s1_store_processed; +int future_vregs_idx; +int future_vregs_num[VECTOR_TEMPS_MAX ]; +int tmp_vregs_idx; +int tmp_vregs_num[VECTOR_TEMPS_MAX ]; +int vreg_log[NUM_VREGS ]; +bool vreg_is_predicated[NUM_VREGS ]; +int vreg_log_idx; +DECLARE_BITMAP (vregs_updated_tmp,NUM_VREGS ); +DECLARE_BITMAP (vregs_updated,NUM_VREGS ); +DECLARE_BITMAP (vregs_select,NUM_VREGS ); +int qreg_log[NUM_QREGS ]; +bool qreg_is_predicated[NUM_QREGS ]; +int qreg_log_idx; +bool pre_commit; } DisasContext;static inline void ctx_log_reg_write (DisasContext *ctx,int rnum)
@@ -67,6 +82,46 @@ static inline bool is_preloaded(DisasContext *ctx, int num)return test_bit (num, ctx->regs_written); } +intptr_t ctx_future_vreg_off (DisasContext *ctx,int regnum, +int num,bool alloc_ok); +intptr_t ctx_tmp_vreg_off (DisasContext *ctx,int regnum, +int num,bool alloc_ok); + +static inline void ctx_log_vreg_write (DisasContext *ctx, +int rnum,VRegWriteType type, +bool is_predicated) +{ +if (type !=EXT_TMP ) { + ctx->vreg_log[ctx->vreg_log_idx] = rnum; + ctx->vreg_is_predicated[ctx->vreg_log_idx] = is_predicated; + ctx->vreg_log_idx++; + +set_bit (rnum, ctx->vregs_updated); + } +if (type ==EXT_NEW ) { +set_bit (rnum, ctx->vregs_select); + } +if (type ==EXT_TMP ) { +set_bit (rnum, ctx->vregs_updated_tmp); + } +} + +static inline void ctx_log_vreg_write_pair (DisasContext *ctx, +int rnum,VRegWriteType type, +bool is_predicated) +{ +ctx_log_vreg_write (ctx, rnum ^0 , type, is_predicated); +ctx_log_vreg_write (ctx, rnum ^1 , type, is_predicated); +} + +static inline void ctx_log_qreg_write (DisasContext *ctx, +int rnum,bool is_predicated) +{ + ctx->qreg_log[ctx->qreg_log_idx] = rnum; + ctx->qreg_is_predicated[ctx->qreg_log_idx] = is_predicated; + ctx->qreg_log_idx++; +} +extern TCGv hex_gpr[TOTAL_PER_THREAD_REGS ];extern TCGv hex_pred[NUM_PREGS ];extern TCGv hex_next_PC;
@@ -85,6 +140,12 @@ extern TCGv hex_dczero_addr;extern TCGv hex_llsc_addr;extern TCGv hex_llsc_val;extern TCGv_i64 hex_llsc_val_i64; +extern TCGv hex_VRegs_updated; +extern TCGv hex_QRegs_updated; +extern TCGv hex_vstore_addr[VSTORES_MAX ]; +extern TCGv hex_vstore_size[VSTORES_MAX ]; +extern TCGv hex_vstore_pending[VSTORES_MAX ]; +bool is_gather_store_insn (Insn *insn,Packet *pkt);void process_store (DisasContext *ctx,Packet *pkt,int slot_num);#endif
target/hexagon/genptr.c +15 -0
@@ -165,6 +165,9 @@ static inline void gen_read_ctrl_reg(DisasContext *ctx, const int reg_num, }else if (reg_num ==HEX_REG_QEMU_INSN_CNT ) {tcg_gen_addi_tl (dest, hex_gpr[HEX_REG_QEMU_INSN_CNT ], ctx->num_insns); + }else if (reg_num ==HEX_REG_QEMU_HVX_CNT ) { +tcg_gen_addi_tl (dest, hex_gpr[HEX_REG_QEMU_HVX_CNT ], + ctx->num_hvx_insns); }else {tcg_gen_mov_tl (dest, hex_gpr[reg_num]); }
@@ -191,6 +194,12 @@ static inline void gen_read_ctrl_reg_pair(DisasContext *ctx, const int reg_num,tcg_gen_concat_i32_i64 (dest, pkt_cnt, insn_cnt);tcg_temp_free (pkt_cnt);tcg_temp_free (insn_cnt); + }else if (reg_num ==HEX_REG_QEMU_HVX_CNT ) { +TCGv hvx_cnt =tcg_temp_new (); +tcg_gen_addi_tl (hvx_cnt, hex_gpr[HEX_REG_QEMU_HVX_CNT ], + ctx->num_hvx_insns); +tcg_gen_concat_i32_i64 (dest, hvx_cnt, hex_gpr[reg_num +1 ]); +tcg_temp_free (hvx_cnt); }else { tcg_gen_concat_i32_i64(dest, hex_gpr[reg_num],
@@ -226,6 +235,9 @@ static inline void gen_write_ctrl_reg(DisasContext *ctx, int reg_num,if (reg_num ==HEX_REG_QEMU_INSN_CNT ) { ctx->num_insns =0 ; } +if (reg_num ==HEX_REG_QEMU_HVX_CNT ) { + ctx->num_hvx_insns =0 ; + } } }
@@ -247,6 +259,9 @@ static inline void gen_write_ctrl_reg_pair(DisasContext *ctx, int reg_num, ctx->num_packets =0 ; ctx->num_insns =0 ; } +if (reg_num ==HEX_REG_QEMU_HVX_CNT ) { + ctx->num_hvx_insns =0 ; + } } }
target/hexagon/translate.c +239 -4
362 lines not on this page · raw message
Signature · 1 line
2.7.4
Re: [PATCH v4 12/30] Hexagon HVX (target/hexagon) TCG generation
Quoted 6 lines · Taylor Simpson
Signed-off-by Taylor Simpson<[email protected]>--- target/hexagon/translate.h | 61 ++++++++++++ target/hexagon/genptr.c | 15 +++ target/hexagon/translate.c | 243 ++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 315 insertions(+), 4 deletions(-)
r~
PATCH v4 13/30 Hexagon HVX (target/hexagon) helper overrides infrastructure
In reply to Taylor SimpsonBuild the infrastructure to create overrides for HVX instructions. We create a new empty file (gen_tcg_hvx.h) that will be populated in subsequent patches.
--- target/hexagon/gen_tcg_hvx.h | 21 +++++++++++++++++++++ target/hexagon/genptr.c | 1 + target/hexagon/gen_helper_funcs.py | 3 ++- target/hexagon/gen_helper_protos.py | 3 ++- target/hexagon/gen_tcg_funcs.py | 3 ++- target/hexagon/meson.build | 13 +++++++------ 6 files changed, 35 insertions(+), 9 deletions(-) create mode 100644 target/hexagon/gen_tcg_hvx.h
target/hexagon/gen_tcg_hvx.h new file +21 -0
@@ -0,0 +1,21 @@ +/* +* Copyright(c) 2019-2021 Qualcomm Innovation Center, Inc. All Rights Reserved. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef HEXAGON_GEN_TCG_HVX_H +#define HEXAGON_GEN_TCG_HVX_H + +#endif
target/hexagon/genptr.c +1 -0
@@ -26,6 +26,7 @@#include "macros.h" #undef QEMU_GENERATE#include "gen_tcg.h" +#include "gen_tcg_hvx.h" static inline void gen_log_predicated_reg_write (int rnum,TCGv val,int slot) {
target/hexagon/gen_helper_funcs.py +2 -1
@@ -286,11 +286,12 @@ def main(): hex_common.read_semantics_file(sys.argv[1]) hex_common.read_attribs_file(sys.argv[2]) hex_common.read_overrides_file(sys.argv[3]) + hex_common.read_overrides_file(sys.argv[4]) hex_common.calculate_attribs() tagregs = hex_common.get_tagregs() tagimms = hex_common.get_tagimms() - with open(sys.argv[4], 'w') as f: + with open(sys.argv[5], 'w') as f: for tag in hex_common.tags: ## Skip the priv instructions if ( "A_PRIV" in hex_common.attribdict[tag] ) :
target/hexagon/gen_helper_protos.py +2 -1
@@ -135,11 +135,12 @@ def main(): hex_common.read_semantics_file(sys.argv[1]) hex_common.read_attribs_file(sys.argv[2]) hex_common.read_overrides_file(sys.argv[3]) + hex_common.read_overrides_file(sys.argv[4]) hex_common.calculate_attribs() tagregs = hex_common.get_tagregs() tagimms = hex_common.get_tagimms() - with open(sys.argv[4], 'w') as f: + with open(sys.argv[5], 'w') as f: for tag in hex_common.tags: ## Skip the priv instructions if ( "A_PRIV" in hex_common.attribdict[tag] ) :
target/hexagon/gen_tcg_funcs.py +2 -1
@@ -682,11 +682,12 @@ def main(): hex_common.read_semantics_file(sys.argv[1]) hex_common.read_attribs_file(sys.argv[2]) hex_common.read_overrides_file(sys.argv[3]) + hex_common.read_overrides_file(sys.argv[4]) hex_common.calculate_attribs() tagregs = hex_common.get_tagregs() tagimms = hex_common.get_tagimms() - with open(sys.argv[4], 'w') as f: + with open(sys.argv[5], 'w') as f: f.write("#ifndef HEXAGON_TCG_FUNCS_H\n") f.write("#define HEXAGON_TCG_FUNCS_H\n\n")
target/hexagon/meson.build +7 -6
@@ -20,6 +20,7 @@ hexagon_ss = ss.source_set() hex_common_py = 'hex_common.py' attribs_def = meson.current_source_dir() / 'attribs_def.h.inc' gen_tcg_h = meson.current_source_dir() / 'gen_tcg.h' +gen_tcg_hvx_h = meson.current_source_dir() / 'gen_tcg_hvx.h' # # Step 1
@@ -63,8 +64,8 @@ helper_protos_generated = custom_target( 'helper_protos_generated.h.inc', output: 'helper_protos_generated.h.inc', depends: [semantics_generated], - depend_files: [hex_common_py, attribs_def, gen_tcg_h], - command: [python, files('gen_helper_protos.py'), semantics_generated, attribs_def, gen_tcg_h, '@OUTPUT@'], + depend_files: [hex_common_py, attribs_def, gen_tcg_h, gen_tcg_hvx_h], + command: [python, files('gen_helper_protos.py'), semantics_generated, attribs_def, gen_tcg_h, gen_tcg_hvx_h, '@OUTPUT@'], ) hexagon_ss.add(helper_protos_generated)
@@ -72,8 +73,8 @@ tcg_funcs_generated = custom_target( 'tcg_funcs_generated.c.inc', output: 'tcg_funcs_generated.c.inc', depends: [semantics_generated], - depend_files: [hex_common_py, attribs_def, gen_tcg_h], - command: [python, files('gen_tcg_funcs.py'), semantics_generated, attribs_def, gen_tcg_h, '@OUTPUT@'], + depend_files: [hex_common_py, attribs_def, gen_tcg_h, gen_tcg_hvx_h], + command: [python, files('gen_tcg_funcs.py'), semantics_generated, attribs_def, gen_tcg_h, gen_tcg_hvx_h, '@OUTPUT@'], ) hexagon_ss.add(tcg_funcs_generated)
@@ -90,8 +91,8 @@ helper_funcs_generated = custom_target( 'helper_funcs_generated.c.inc', output: 'helper_funcs_generated.c.inc', depends: [semantics_generated], - depend_files: [hex_common_py, attribs_def, gen_tcg_h], - command: [python, files('gen_helper_funcs.py'), semantics_generated, attribs_def, gen_tcg_h, '@OUTPUT@'], + depend_files: [hex_common_py, attribs_def, gen_tcg_h, gen_tcg_hvx_h], + command: [python, files('gen_helper_funcs.py'), semantics_generated, attribs_def, gen_tcg_h, gen_tcg_hvx_h, '@OUTPUT@'], ) hexagon_ss.add(helper_funcs_generated)
Signature · 1 line
2.7.4
Re: [PATCH v4 13/30] Hexagon HVX (target/hexagon) helper overrides infrastructure
Quoted 5 lines · Taylor Simpson
Build the infrastructure to create overrides for HVX instructions. We create a new empty file (
gen_tcg_hvx.h) that will be populated in subsequent patches.Signed-off-by Taylor Simpson <[email protected]>
Quoted 9 lines
--- target/hexagon/gen_tcg_hvx.h | 21 +++++++++++++++++++++ target/hexagon/genptr.c | 1 + target/hexagon/gen_helper_funcs.py | 3 ++- target/hexagon/gen_helper_protos.py | 3 ++- target/hexagon/gen_tcg_funcs.py | 3 ++- target/hexagon/meson.build | 13 +++++++------ 6 files changed, 35 insertions(+), 9 deletions(-) create mode 100644 target/hexagon/gen_tcg_hvx.h
Re: [PATCH v4 13/30] Hexagon HVX (target/hexagon) helper overrides infrastructure
In reply to Taylor SimpsonQuoted 13 lines · Taylor Simpson
Build the infrastructure to create overrides for HVX instructions. We create a new empty file (
gen_tcg_hvx.h) that will be populated in subsequent patches.Signed-off-by Taylor Simpson<[email protected]>--- target/hexagon/gen_tcg_hvx.h | 21 +++++++++++++++++++++ target/hexagon/genptr.c | 1 + target/hexagon/gen_helper_funcs.py | 3 ++- target/hexagon/gen_helper_protos.py | 3 ++- target/hexagon/gen_tcg_funcs.py | 3 ++- target/hexagon/meson.build | 13 +++++++------ 6 files changed, 35 insertions(+), 9 deletions(-)
Quoted 1 line
create mode 100644
target/hexagon/gen_tcg_hvx.h
r~
PATCH v4 14/30 Hexagon HVX (target/hexagon) helper overrides for histogram instructions
In reply to Taylor Simpson--- target/hexagon/gen_tcg_hvx.h | 106 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+)
target/hexagon/gen_tcg_hvx.h +106 -0
@@ -18,4 +18,110 @@#ifndef HEXAGON_GEN_TCG_HVX_H #define HEXAGON_GEN_TCG_HVX_H +/* +* Histogram instructions +* +* Note that these instructions operate directly on the vector registers +* and therefore happen after commit. +* +* The generate_<tag> function is called twice +* The first time is during the normal TCG generation +* ctx->pre_commit is true +* In the masked cases, we save the mask to the qtmp temporary +* Otherwise, there is nothing to do +* The second call is at the end of gen_commit_packet +* ctx->pre_commit is false +* Generate the call to the helper +*/ + +static inline void assert_vhist_tmp (DisasContext *ctx) +{ +/* vhist instructions require exactly one .tmp to be defined */ +g_assert (ctx->tmp_vregs_idx ==1 ); +} + +#define fGEN_TCG_V6_vhist (SHORTCODE ) \ + if (!ctx->pre_commit) { \ + assert_vhist_tmp(ctx); \ + gen_helper_vhist(cpu_env); \ + } +#define fGEN_TCG_V6_vhistq (SHORTCODE ) \ + do { \ + if (ctx->pre_commit) { \ + intptr_t dstoff = offsetof(CPUHexagonState, qtmp); \ + tcg_gen_gvec_mov(MO_64, dstoff, QvV_off, \ + sizeof(MMVector), sizeof(MMVector)); \ + } else { \ + assert_vhist_tmp(ctx); \ + gen_helper_vhistq(cpu_env); \ + } \ + } while (0) +#define fGEN_TCG_V6_vwhist256 (SHORTCODE ) \ + if (!ctx->pre_commit) { \ + assert_vhist_tmp(ctx); \ + gen_helper_vwhist256(cpu_env); \ + } +#define fGEN_TCG_V6_vwhist256q (SHORTCODE ) \ + do { \ + if (ctx->pre_commit) { \ + intptr_t dstoff = offsetof(CPUHexagonState, qtmp); \ + tcg_gen_gvec_mov(MO_64, dstoff, QvV_off, \ + sizeof(MMVector), sizeof(MMVector)); \ + } else { \ + assert_vhist_tmp(ctx); \ + gen_helper_vwhist256q(cpu_env); \ + } \ + } while (0) +#define fGEN_TCG_V6_vwhist256_sat (SHORTCODE ) \ + if (!ctx->pre_commit) { \ + assert_vhist_tmp(ctx); \ + gen_helper_vwhist256_sat(cpu_env); \ + } +#define fGEN_TCG_V6_vwhist256q_sat (SHORTCODE ) \ + do { \ + if (ctx->pre_commit) { \ + intptr_t dstoff = offsetof(CPUHexagonState, qtmp); \ + tcg_gen_gvec_mov(MO_64, dstoff, QvV_off, \ + sizeof(MMVector), sizeof(MMVector)); \ + } else { \ + assert_vhist_tmp(ctx); \ + gen_helper_vwhist256q_sat(cpu_env); \ + } \ + } while (0) +#define fGEN_TCG_V6_vwhist128 (SHORTCODE ) \ + if (!ctx->pre_commit) { \ + assert_vhist_tmp(ctx); \ + gen_helper_vwhist128(cpu_env); \ + } +#define fGEN_TCG_V6_vwhist128q (SHORTCODE ) \ + do { \ + if (ctx->pre_commit) { \ + intptr_t dstoff = offsetof(CPUHexagonState, qtmp); \ + tcg_gen_gvec_mov(MO_64, dstoff, QvV_off, \ + sizeof(MMVector), sizeof(MMVector)); \ + } else { \ + assert_vhist_tmp(ctx); \ + gen_helper_vwhist128q(cpu_env); \ + } \ + } while (0) +#define fGEN_TCG_V6_vwhist128m (SHORTCODE ) \ + if (!ctx->pre_commit) { \ + TCGv tcgv_uiV = tcg_constant_tl(uiV); \ + assert_vhist_tmp(ctx); \ + gen_helper_vwhist128m(cpu_env, tcgv_uiV); \ + } +#define fGEN_TCG_V6_vwhist128qm (SHORTCODE ) \ + do { \ + if (ctx->pre_commit) { \ + intptr_t dstoff = offsetof(CPUHexagonState, qtmp); \ + tcg_gen_gvec_mov(MO_64, dstoff, QvV_off, \ + sizeof(MMVector), sizeof(MMVector)); \ + } else { \ + TCGv tcgv_uiV = tcg_constant_tl(uiV); \ + assert_vhist_tmp(ctx); \ + gen_helper_vwhist128qm(cpu_env, tcgv_uiV); \ + } \ + } while (0) + +#endif
Signature · 1 line
2.7.4
Re: [PATCH v4 14/30] Hexagon HVX (target/hexagon) helper overrides for histogram instructions
Quoted 4 lines · Taylor Simpson
Signed-off-by Taylor Simpson<[email protected]>--- target/hexagon/gen_tcg_hvx.h | 106 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+)
r~
PATCH v4 15/30 Hexagon HVX (target/hexagon) helper overrides - vector assign & cmov
In reply to Taylor Simpson--- target/hexagon/gen_tcg_hvx.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
target/hexagon/gen_tcg_hvx.h +31 -0
@@ -124,4 +124,35 @@ static inline void assert_vhist_tmp(DisasContext *ctx) } while (0) +#define fGEN_TCG_V6_vassign (SHORTCODE ) \ + tcg_gen_gvec_mov(MO_64, VdV_off, VuV_off, \ + sizeof(MMVector), sizeof(MMVector)) + +/* Vector conditional move */ +#define fGEN_TCG_VEC_CMOV (PRED ) \ + do { \ + TCGv lsb = tcg_temp_new(); \ + TCGLabel *false_label = gen_new_label(); \ + TCGLabel *end_label = gen_new_label(); \ + tcg_gen_andi_tl(lsb, PsV, 1); \ + tcg_gen_brcondi_tl(TCG_COND_NE, lsb, PRED, false_label); \ + tcg_temp_free(lsb); \ + tcg_gen_gvec_mov(MO_64, VdV_off, VuV_off, \ + sizeof(MMVector), sizeof(MMVector)); \ + tcg_gen_br(end_label); \ + gen_set_label(false_label); \ + tcg_gen_ori_tl(hex_slot_cancelled, hex_slot_cancelled, \ + 1 << insn->slot); \ + gen_set_label(end_label); \ + } while (0) + + +/* Vector conditional move (true) */ +#define fGEN_TCG_V6_vcmov (SHORTCODE ) \ + fGEN_TCG_VEC_CMOV(1) + +/* Vector conditional move (false) */ +#define fGEN_TCG_V6_vncmov (SHORTCODE ) \ + fGEN_TCG_VEC_CMOV(0) +#endif
Signature · 1 line
2.7.4
PATCH v4 16/30 Hexagon HVX (target/hexagon) helper overrides - vector add & sub
In reply to Taylor Simpson--- target/hexagon/gen_tcg_hvx.h | 50 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+)
target/hexagon/gen_tcg_hvx.h +50 -0
@@ -155,4 +155,54 @@ static inline void assert_vhist_tmp(DisasContext *ctx)#define fGEN_TCG_V6_vncmov (SHORTCODE ) \ fGEN_TCG_VEC_CMOV(0) +/* Vector add - various forms */ +#define fGEN_TCG_V6_vaddb (SHORTCODE ) \ + tcg_gen_gvec_add(MO_8, VdV_off, VuV_off, VvV_off, \ + sizeof(MMVector), sizeof(MMVector)) + +#define fGEN_TCG_V6_vaddh (SHORTCYDE ) \ + tcg_gen_gvec_add(MO_16, VdV_off, VuV_off, VvV_off, \ + sizeof(MMVector), sizeof(MMVector)) + +#define fGEN_TCG_V6_vaddw (SHORTCODE ) \ + tcg_gen_gvec_add(MO_32, VdV_off, VuV_off, VvV_off, \ + sizeof(MMVector), sizeof(MMVector)) + +#define fGEN_TCG_V6_vaddb_dv (SHORTCODE ) \ + tcg_gen_gvec_add(MO_8, VddV_off, VuuV_off, VvvV_off, \ + sizeof(MMVector) * 2, sizeof(MMVector) * 2) + +#define fGEN_TCG_V6_vaddh_dv (SHORTCYDE ) \ + tcg_gen_gvec_add(MO_16, VddV_off, VuuV_off, VvvV_off, \ + sizeof(MMVector) * 2, sizeof(MMVector) * 2) + +#define fGEN_TCG_V6_vaddw_dv (SHORTCODE ) \ + tcg_gen_gvec_add(MO_32, VddV_off, VuuV_off, VvvV_off, \ + sizeof(MMVector) * 2, sizeof(MMVector) * 2) + +/* Vector sub - various forms */ +#define fGEN_TCG_V6_vsubb (SHORTCODE ) \ + tcg_gen_gvec_sub(MO_8, VdV_off, VuV_off, VvV_off, \ + sizeof(MMVector), sizeof(MMVector)) + +#define fGEN_TCG_V6_vsubh (SHORTCODE ) \ + tcg_gen_gvec_sub(MO_16, VdV_off, VuV_off, VvV_off, \ + sizeof(MMVector), sizeof(MMVector)) + +#define fGEN_TCG_V6_vsubw (SHORTCODE ) \ + tcg_gen_gvec_sub(MO_32, VdV_off, VuV_off, VvV_off, \ + sizeof(MMVector), sizeof(MMVector)) + +#define fGEN_TCG_V6_vsubb_dv (SHORTCODE ) \ + tcg_gen_gvec_sub(MO_8, VddV_off, VuuV_off, VvvV_off, \ + sizeof(MMVector) * 2, sizeof(MMVector) * 2) + +#define fGEN_TCG_V6_vsubh_dv (SHORTCODE ) \ + tcg_gen_gvec_sub(MO_16, VddV_off, VuuV_off, VvvV_off, \ + sizeof(MMVector) * 2, sizeof(MMVector) * 2) + +#define fGEN_TCG_V6_vsubw_dv (SHORTCODE ) \ + tcg_gen_gvec_sub(MO_32, VddV_off, VuuV_off, VvvV_off, \ + sizeof(MMVector) * 2, sizeof(MMVector) * 2) +#endif
Signature · 1 line
2.7.4
PATCH v4 17/30 Hexagon HVX (target/hexagon) helper overrides - vector shifts
In reply to Taylor Simpson--- target/hexagon/gen_tcg_hvx.h | 122 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+)
target/hexagon/gen_tcg_hvx.h +122 -0
@@ -205,4 +205,126 @@ static inline void assert_vhist_tmp(DisasContext *ctx)tcg_gen_gvec_sub (MO_32 , VddV_off, VuuV_off, VvvV_off, \sizeof (MMVector) *2 ,sizeof (MMVector) *2 ) +/* Vector shift right - various forms */ +#define fGEN_TCG_V6_vasrh (SHORTCODE ) \ + do { \ + TCGv shift = tcg_temp_new(); \ + tcg_gen_andi_tl(shift, RtV, 15); \ + tcg_gen_gvec_sars(MO_16, VdV_off, VuV_off, shift, \ + sizeof(MMVector), sizeof(MMVector)); \ + tcg_temp_free(shift); \ + } while (0) + +#define fGEN_TCG_V6_vasrh_acc (SHORTCODE ) \ + do { \ + intptr_t tmpoff = offsetof(CPUHexagonState, vtmp); \ + TCGv shift = tcg_temp_new(); \ + tcg_gen_andi_tl(shift, RtV, 15); \ + tcg_gen_gvec_sars(MO_16, tmpoff, VuV_off, shift, \ + sizeof(MMVector), sizeof(MMVector)); \ + tcg_gen_gvec_add(MO_16, VxV_off, VxV_off, tmpoff, \ + sizeof(MMVector), sizeof(MMVector)); \ + tcg_temp_free(shift); \ + } while (0) + +#define fGEN_TCG_V6_vasrw (SHORTCODE ) \ + do { \ + TCGv shift = tcg_temp_new(); \ + tcg_gen_andi_tl(shift, RtV, 31); \ + tcg_gen_gvec_sars(MO_32, VdV_off, VuV_off, shift, \ + sizeof(MMVector), sizeof(MMVector)); \ + tcg_temp_free(shift); \ + } while (0) + +#define fGEN_TCG_V6_vasrw_acc (SHORTCODE ) \ + do { \ + intptr_t tmpoff = offsetof(CPUHexagonState, vtmp); \ + TCGv shift = tcg_temp_new(); \ + tcg_gen_andi_tl(shift, RtV, 31); \ + tcg_gen_gvec_sars(MO_32, tmpoff, VuV_off, shift, \ + sizeof(MMVector), sizeof(MMVector)); \ + tcg_gen_gvec_add(MO_32, VxV_off, VxV_off, tmpoff, \ + sizeof(MMVector), sizeof(MMVector)); \ + tcg_temp_free(shift); \ + } while (0) + +#define fGEN_TCG_V6_vlsrb (SHORTCODE ) \ + do { \ + TCGv shift = tcg_temp_new(); \ + tcg_gen_andi_tl(shift, RtV, 7); \ + tcg_gen_gvec_shrs(MO_8, VdV_off, VuV_off, shift, \ + sizeof(MMVector), sizeof(MMVector)); \ + tcg_temp_free(shift); \ + } while (0) + +#define fGEN_TCG_V6_vlsrh (SHORTCODE ) \ + do { \ + TCGv shift = tcg_temp_new(); \ + tcg_gen_andi_tl(shift, RtV, 15); \ + tcg_gen_gvec_shrs(MO_16, VdV_off, VuV_off, shift, \ + sizeof(MMVector), sizeof(MMVector)); \ + tcg_temp_free(shift); \ + } while (0) + +#define fGEN_TCG_V6_vlsrw (SHORTCODE ) \ + do { \ + TCGv shift = tcg_temp_new(); \ + tcg_gen_andi_tl(shift, RtV, 31); \ + tcg_gen_gvec_shrs(MO_32, VdV_off, VuV_off, shift, \ + sizeof(MMVector), sizeof(MMVector)); \ + tcg_temp_free(shift); \ + } while (0) + +/* Vector shift left - various forms */ +#define fGEN_TCG_V6_vaslb (SHORTCODE ) \ + do { \ + TCGv shift = tcg_temp_new(); \ + tcg_gen_andi_tl(shift, RtV, 7); \ + tcg_gen_gvec_shls(MO_8, VdV_off, VuV_off, shift, \ + sizeof(MMVector), sizeof(MMVector)); \ + tcg_temp_free(shift); \ + } while (0) + +#define fGEN_TCG_V6_vaslh (SHORTCODE ) \ + do { \ + TCGv shift = tcg_temp_new(); \ + tcg_gen_andi_tl(shift, RtV, 15); \ + tcg_gen_gvec_shls(MO_16, VdV_off, VuV_off, shift, \ + sizeof(MMVector), sizeof(MMVector)); \ + tcg_temp_free(shift); \ + } while (0) + +#define fGEN_TCG_V6_vaslh_acc (SHORTCODE ) \ + do { \ + intptr_t tmpoff = offsetof(CPUHexagonState, vtmp); \ + TCGv shift = tcg_temp_new(); \ + tcg_gen_andi_tl(shift, RtV, 15); \ + tcg_gen_gvec_shls(MO_16, tmpoff, VuV_off, shift, \ + sizeof(MMVector), sizeof(MMVector)); \ + tcg_gen_gvec_add(MO_16, VxV_off, VxV_off, tmpoff, \ + sizeof(MMVector), sizeof(MMVector)); \ + tcg_temp_free(shift); \ + } while (0) + +#define fGEN_TCG_V6_vaslw (SHORTCODE ) \ + do { \ + TCGv shift = tcg_temp_new(); \ + tcg_gen_andi_tl(shift, RtV, 31); \ + tcg_gen_gvec_shls(MO_32, VdV_off, VuV_off, shift, \ + sizeof(MMVector), sizeof(MMVector)); \ + tcg_temp_free(shift); \ + } while (0) + +#define fGEN_TCG_V6_vaslw_acc (SHORTCODE ) \ + do { \ + intptr_t tmpoff = offsetof(CPUHexagonState, vtmp); \ + TCGv shift = tcg_temp_new(); \ + tcg_gen_andi_tl(shift, RtV, 31); \ + tcg_gen_gvec_shls(MO_32, tmpoff, VuV_off, shift, \ + sizeof(MMVector), sizeof(MMVector)); \ + tcg_gen_gvec_add(MO_32, VxV_off, VxV_off, tmpoff, \ + sizeof(MMVector), sizeof(MMVector)); \ + tcg_temp_free(shift); \ + } while (0) +#endif
Signature · 1 line
2.7.4
PATCH v4 18/30 Hexagon HVX (target/hexagon) helper overrides - vector max/min
In reply to Taylor Simpson--- target/hexagon/gen_tcg_hvx.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
target/hexagon/gen_tcg_hvx.h +34 -0
@@ -327,4 +327,38 @@ static inline void assert_vhist_tmp(DisasContext *ctx)tcg_temp_free (shift); \ } while (0) +/* Vector max - various forms */ +#define fGEN_TCG_V6_vmaxw (SHORTCODE ) \ + tcg_gen_gvec_smax(MO_32, VdV_off, VuV_off, VvV_off, \ + sizeof(MMVector), sizeof(MMVector)) +#define fGEN_TCG_V6_vmaxh (SHORTCODE ) \ + tcg_gen_gvec_smax(MO_16, VdV_off, VuV_off, VvV_off, \ + sizeof(MMVector), sizeof(MMVector)) +#define fGEN_TCG_V6_vmaxuh (SHORTCODE ) \ + tcg_gen_gvec_umax(MO_16, VdV_off, VuV_off, VvV_off, \ + sizeof(MMVector), sizeof(MMVector)) +#define fGEN_TCG_V6_vmaxb (SHORTCODE ) \ + tcg_gen_gvec_smax(MO_8, VdV_off, VuV_off, VvV_off, \ + sizeof(MMVector), sizeof(MMVector)) +#define fGEN_TCG_V6_vmaxub (SHORTCODE ) \ + tcg_gen_gvec_umax(MO_8, VdV_off, VuV_off, VvV_off, \ + sizeof(MMVector), sizeof(MMVector)) + +/* Vector min - various forms */ +#define fGEN_TCG_V6_vminw (SHORTCODE ) \ + tcg_gen_gvec_smin(MO_32, VdV_off, VuV_off, VvV_off, \ + sizeof(MMVector), sizeof(MMVector)) +#define fGEN_TCG_V6_vminh (SHORTCODE ) \ + tcg_gen_gvec_smin(MO_16, VdV_off, VuV_off, VvV_off, \ + sizeof(MMVector), sizeof(MMVector)) +#define fGEN_TCG_V6_vminuh (SHORTCODE ) \ + tcg_gen_gvec_umin(MO_16, VdV_off, VuV_off, VvV_off, \ + sizeof(MMVector), sizeof(MMVector)) +#define fGEN_TCG_V6_vminb (SHORTCODE ) \ + tcg_gen_gvec_smin(MO_8, VdV_off, VuV_off, VvV_off, \ + sizeof(MMVector), sizeof(MMVector)) +#define fGEN_TCG_V6_vminub (SHORTCODE ) \ + tcg_gen_gvec_umin(MO_8, VdV_off, VuV_off, VvV_off, \ + sizeof(MMVector), sizeof(MMVector)) +#endif
Signature · 1 line
2.7.4
PATCH v4 19/30 Hexagon HVX (target/hexagon) helper overrides - vector logical ops
In reply to Taylor Simpson--- target/hexagon/gen_tcg_hvx.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)
target/hexagon/gen_tcg_hvx.h +42 -0
@@ -361,4 +361,46 @@ static inline void assert_vhist_tmp(DisasContext *ctx)tcg_gen_gvec_umin (MO_8 , VdV_off, VuV_off, VvV_off, \sizeof (MMVector),sizeof (MMVector)) +/* Vector logical ops */ +#define fGEN_TCG_V6_vxor (SHORTCODE ) \ + tcg_gen_gvec_xor(MO_64, VdV_off, VuV_off, VvV_off, \ + sizeof(MMVector), sizeof(MMVector)) + +#define fGEN_TCG_V6_vand (SHORTCODE ) \ + tcg_gen_gvec_and(MO_64, VdV_off, VuV_off, VvV_off, \ + sizeof(MMVector), sizeof(MMVector)) + +#define fGEN_TCG_V6_vor (SHORTCODE ) \ + tcg_gen_gvec_or(MO_64, VdV_off, VuV_off, VvV_off, \ + sizeof(MMVector), sizeof(MMVector)) + +#define fGEN_TCG_V6_vnot (SHORTCODE ) \ + tcg_gen_gvec_not(MO_64, VdV_off, VuV_off, \ + sizeof(MMVector), sizeof(MMVector)) + +/* Q register logical ops */ +#define fGEN_TCG_V6_pred_or (SHORTCODE ) \ + tcg_gen_gvec_or(MO_64, QdV_off, QsV_off, QtV_off, \ + sizeof(MMQReg), sizeof(MMQReg)) + +#define fGEN_TCG_V6_pred_and (SHORTCODE ) \ + tcg_gen_gvec_and(MO_64, QdV_off, QsV_off, QtV_off, \ + sizeof(MMQReg), sizeof(MMQReg)) + +#define fGEN_TCG_V6_pred_xor (SHORTCODE ) \ + tcg_gen_gvec_xor(MO_64, QdV_off, QsV_off, QtV_off, \ + sizeof(MMQReg), sizeof(MMQReg)) + +#define fGEN_TCG_V6_pred_or_n (SHORTCODE ) \ + tcg_gen_gvec_orc(MO_64, QdV_off, QsV_off, QtV_off, \ + sizeof(MMQReg), sizeof(MMQReg)) + +#define fGEN_TCG_V6_pred_and_n (SHORTCODE ) \ + tcg_gen_gvec_andc(MO_64, QdV_off, QsV_off, QtV_off, \ + sizeof(MMQReg), sizeof(MMQReg)) + +#define fGEN_TCG_V6_pred_not (SHORTCODE ) \ + tcg_gen_gvec_not(MO_64, QdV_off, QsV_off, \ + sizeof(MMQReg), sizeof(MMQReg)) +#endif
Signature · 1 line
2.7.4
Re: [PATCH v4 19/30] Hexagon HVX (target/hexagon) helper overrides - vector logical ops
Quoted 4 lines · Taylor Simpson
Signed-off-by Taylor Simpson<[email protected]>--- target/hexagon/gen_tcg_hvx.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)
r~
PATCH v4 20/30 Hexagon HVX (target/hexagon) helper overrides - vector compares
In reply to Taylor Simpson--- target/hexagon/gen_tcg_hvx.h | 103 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+)
target/hexagon/gen_tcg_hvx.h +103 -0
@@ -403,4 +403,107 @@ static inline void assert_vhist_tmp(DisasContext *ctx)tcg_gen_gvec_not (MO_64 , QdV_off, QsV_off, \sizeof (MMQReg),sizeof (MMQReg)) +/* Vector compares */ +#define fGEN_TCG_VEC_CMP (COND ,TYPE ,SIZE ) \ + do { \ + intptr_t tmpoff = offsetof(CPUHexagonState, vtmp); \ + tcg_gen_gvec_cmp(COND, TYPE, tmpoff, VuV_off, VvV_off, \ + sizeof(MMVector), sizeof(MMVector)); \ + vec_to_qvec(SIZE, QdV_off, tmpoff); \ + } while (0) + +#define fGEN_TCG_V6_vgtw (SHORTCODE ) \ + fGEN_TCG_VEC_CMP(TCG_COND_GT, MO_32, 4) +#define fGEN_TCG_V6_vgth (SHORTCODE ) \ + fGEN_TCG_VEC_CMP(TCG_COND_GT, MO_16, 2) +#define fGEN_TCG_V6_vgtb (SHORTCODE ) \ + fGEN_TCG_VEC_CMP(TCG_COND_GT, MO_8, 1) + +#define fGEN_TCG_V6_vgtuw (SHORTCODE ) \ + fGEN_TCG_VEC_CMP(TCG_COND_GTU, MO_32, 4) +#define fGEN_TCG_V6_vgtuh (SHORTCODE ) \ + fGEN_TCG_VEC_CMP(TCG_COND_GTU, MO_16, 2) +#define fGEN_TCG_V6_vgtub (SHORTCODE ) \ + fGEN_TCG_VEC_CMP(TCG_COND_GTU, MO_8, 1) + +#define fGEN_TCG_V6_veqw (SHORTCODE ) \ + fGEN_TCG_VEC_CMP(TCG_COND_EQ, MO_32, 4) +#define fGEN_TCG_V6_veqh (SHORTCODE ) \ + fGEN_TCG_VEC_CMP(TCG_COND_EQ, MO_16, 2) +#define fGEN_TCG_V6_veqb (SHORTCODE ) \ + fGEN_TCG_VEC_CMP(TCG_COND_EQ, MO_8, 1) + +#define fGEN_TCG_VEC_CMP_OP (COND ,TYPE ,SIZE ,OP ) \ + do { \ + intptr_t tmpoff = offsetof(CPUHexagonState, vtmp); \ + intptr_t qoff = offsetof(CPUHexagonState, qtmp); \ + tcg_gen_gvec_cmp(COND, TYPE, tmpoff, VuV_off, VvV_off, \ + sizeof(MMVector), sizeof(MMVector)); \ + vec_to_qvec(SIZE, qoff, tmpoff); \ + OP(MO_64, QxV_off, QxV_off, qoff, sizeof(MMQReg), sizeof(MMQReg)); \ + } while (0) + +#define fGEN_TCG_V6_vgtw_and (SHORTCODE ) \ + fGEN_TCG_VEC_CMP_OP(TCG_COND_GT, MO_32, 4, tcg_gen_gvec_and) +#define fGEN_TCG_V6_vgtw_or (SHORTCODE ) \ + fGEN_TCG_VEC_CMP_OP(TCG_COND_GT, MO_32, 4, tcg_gen_gvec_or) +#define fGEN_TCG_V6_vgtw_xor (SHORTCODE ) \ + fGEN_TCG_VEC_CMP_OP(TCG_COND_GT, MO_32, 4, tcg_gen_gvec_xor) + +#define fGEN_TCG_V6_vgtuw_and (SHORTCODE ) \ + fGEN_TCG_VEC_CMP_OP(TCG_COND_GTU, MO_32, 4, tcg_gen_gvec_and) +#define fGEN_TCG_V6_vgtuw_or (SHORTCODE ) \ + fGEN_TCG_VEC_CMP_OP(TCG_COND_GTU, MO_32, 4, tcg_gen_gvec_or) +#define fGEN_TCG_V6_vgtuw_xor (SHORTCODE ) \ + fGEN_TCG_VEC_CMP_OP(TCG_COND_GTU, MO_32, 4, tcg_gen_gvec_xor) + +#define fGEN_TCG_V6_vgth_and (SHORTCODE ) \ + fGEN_TCG_VEC_CMP_OP(TCG_COND_GT, MO_16, 2, tcg_gen_gvec_and) +#define fGEN_TCG_V6_vgth_or (SHORTCODE ) \ + fGEN_TCG_VEC_CMP_OP(TCG_COND_GT, MO_16, 2, tcg_gen_gvec_or) +#define fGEN_TCG_V6_vgth_xor (SHORTCODE ) \ + fGEN_TCG_VEC_CMP_OP(TCG_COND_GT, MO_16, 2, tcg_gen_gvec_xor) + +#define fGEN_TCG_V6_vgtuh_and (SHORTCODE ) \ + fGEN_TCG_VEC_CMP_OP(TCG_COND_GTU, MO_16, 2, tcg_gen_gvec_and) +#define fGEN_TCG_V6_vgtuh_or (SHORTCODE ) \ + fGEN_TCG_VEC_CMP_OP(TCG_COND_GTU, MO_16, 2, tcg_gen_gvec_or) +#define fGEN_TCG_V6_vgtuh_xor (SHORTCODE ) \ + fGEN_TCG_VEC_CMP_OP(TCG_COND_GTU, MO_16, 2, tcg_gen_gvec_xor) + +#define fGEN_TCG_V6_vgtb_and (SHORTCODE ) \ + fGEN_TCG_VEC_CMP_OP(TCG_COND_GT, MO_8, 1, tcg_gen_gvec_and) +#define fGEN_TCG_V6_vgtb_or (SHORTCODE ) \ + fGEN_TCG_VEC_CMP_OP(TCG_COND_GT, MO_8, 1, tcg_gen_gvec_or) +#define fGEN_TCG_V6_vgtb_xor (SHORTCODE ) \ + fGEN_TCG_VEC_CMP_OP(TCG_COND_GT, MO_8, 1, tcg_gen_gvec_xor) + +#define fGEN_TCG_V6_vgtub_and (SHORTCODE ) \ + fGEN_TCG_VEC_CMP_OP(TCG_COND_GTU, MO_8, 1, tcg_gen_gvec_and) +#define fGEN_TCG_V6_vgtub_or (SHORTCODE ) \ + fGEN_TCG_VEC_CMP_OP(TCG_COND_GTU, MO_8, 1, tcg_gen_gvec_or) +#define fGEN_TCG_V6_vgtub_xor (SHORTCODE ) \ + fGEN_TCG_VEC_CMP_OP(TCG_COND_GTU, MO_8, 1, tcg_gen_gvec_xor) + +#define fGEN_TCG_V6_veqw_and (SHORTCODE ) \ + fGEN_TCG_VEC_CMP_OP(TCG_COND_EQ, MO_32, 4, tcg_gen_gvec_and) +#define fGEN_TCG_V6_veqw_or (SHORTCODE ) \ + fGEN_TCG_VEC_CMP_OP(TCG_COND_EQ, MO_32, 4, tcg_gen_gvec_or) +#define fGEN_TCG_V6_veqw_xor (SHORTCODE ) \ + fGEN_TCG_VEC_CMP_OP(TCG_COND_EQ, MO_32, 4, tcg_gen_gvec_xor) + +#define fGEN_TCG_V6_veqh_and (SHORTCODE ) \ + fGEN_TCG_VEC_CMP_OP(TCG_COND_EQ, MO_16, 2, tcg_gen_gvec_and) +#define fGEN_TCG_V6_veqh_or (SHORTCODE ) \ + fGEN_TCG_VEC_CMP_OP(TCG_COND_EQ, MO_16, 2, tcg_gen_gvec_or) +#define fGEN_TCG_V6_veqh_xor (SHORTCODE ) \ + fGEN_TCG_VEC_CMP_OP(TCG_COND_EQ, MO_16, 2, tcg_gen_gvec_xor) + +#define fGEN_TCG_V6_veqb_and (SHORTCODE ) \ + fGEN_TCG_VEC_CMP_OP(TCG_COND_EQ, MO_8, 1, tcg_gen_gvec_and) +#define fGEN_TCG_V6_veqb_or (SHORTCODE ) \ + fGEN_TCG_VEC_CMP_OP(TCG_COND_EQ, MO_8, 1, tcg_gen_gvec_or) +#define fGEN_TCG_V6_veqb_xor (SHORTCODE ) \ + fGEN_TCG_VEC_CMP_OP(TCG_COND_EQ, MO_8, 1, tcg_gen_gvec_xor) +#endif
Signature · 1 line
2.7.4
PATCH v4 21/30 Hexagon HVX (target/hexagon) helper overrides - vector splat and abs
In reply to Taylor Simpson--- target/hexagon/gen_tcg_hvx.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
target/hexagon/gen_tcg_hvx.h +26 -0
@@ -506,4 +506,30 @@ static inline void assert_vhist_tmp(DisasContext *ctx)#define fGEN_TCG_V6_veqb_xor (SHORTCODE ) \ fGEN_TCG_VEC_CMP_OP(TCG_COND_EQ, MO_8, 1, tcg_gen_gvec_xor) +/* Vector splat - various forms */ +#define fGEN_TCG_V6_lvsplatw (SHORTCODE ) \ + tcg_gen_gvec_dup_i32(MO_32, VdV_off, \ + sizeof(MMVector), sizeof(MMVector), RtV) + +#define fGEN_TCG_V6_lvsplath (SHORTCODE ) \ + tcg_gen_gvec_dup_i32(MO_16, VdV_off, \ + sizeof(MMVector), sizeof(MMVector), RtV) + +#define fGEN_TCG_V6_lvsplatb (SHORTCODE ) \ + tcg_gen_gvec_dup_i32(MO_8, VdV_off, \ + sizeof(MMVector), sizeof(MMVector), RtV) + +/* Vector absolute value - various forms */ +#define fGEN_TCG_V6_vabsb (SHORTCODE ) \ + tcg_gen_gvec_abs(MO_8, VdV_off, VuV_off, \ + sizeof(MMVector), sizeof(MMVector)) + +#define fGEN_TCG_V6_vabsh (SHORTCODE ) \ + tcg_gen_gvec_abs(MO_16, VdV_off, VuV_off, \ + sizeof(MMVector), sizeof(MMVector)) + +#define fGEN_TCG_V6_vabsw (SHORTCODE ) \ + tcg_gen_gvec_abs(MO_32, VdV_off, VuV_off, \ + sizeof(MMVector), sizeof(MMVector)) +#endif
Signature · 1 line
2.7.4
PATCH v4 22/30 Hexagon HVX (target/hexagon) helper overrides - vector loads
In reply to Taylor Simpson--- target/hexagon/gen_tcg_hvx.h | 150 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 150 insertions(+)
target/hexagon/gen_tcg_hvx.h +150 -0
@@ -532,4 +532,154 @@ static inline void assert_vhist_tmp(DisasContext *ctx)tcg_gen_gvec_abs (MO_32 , VdV_off, VuV_off, \sizeof (MMVector),sizeof (MMVector)) +/* Vector loads */ +#define fGEN_TCG_V6_vL32b_pi (SHORTCODE ) SHORTCODE +#define fGEN_TCG_V6_vL32Ub_pi (SHORTCODE ) SHORTCODE +#define fGEN_TCG_V6_vL32b_cur_pi (SHORTCODE ) SHORTCODE +#define fGEN_TCG_V6_vL32b_tmp_pi (SHORTCODE ) SHORTCODE +#define fGEN_TCG_V6_vL32b_nt_pi (SHORTCODE ) SHORTCODE +#define fGEN_TCG_V6_vL32b_nt_cur_pi (SHORTCODE ) SHORTCODE +#define fGEN_TCG_V6_vL32b_nt_tmp_pi (SHORTCODE ) SHORTCODE +#define fGEN_TCG_V6_vL32b_ai (SHORTCODE ) SHORTCODE +#define fGEN_TCG_V6_vL32Ub_ai (SHORTCODE ) SHORTCODE +#define fGEN_TCG_V6_vL32b_cur_ai (SHORTCODE ) SHORTCODE +#define fGEN_TCG_V6_vL32b_tmp_ai (SHORTCODE ) SHORTCODE +#define fGEN_TCG_V6_vL32b_nt_ai (SHORTCODE ) SHORTCODE +#define fGEN_TCG_V6_vL32b_nt_cur_ai (SHORTCODE ) SHORTCODE +#define fGEN_TCG_V6_vL32b_nt_tmp_ai (SHORTCODE ) SHORTCODE +#define fGEN_TCG_V6_vL32b_ppu (SHORTCODE ) SHORTCODE +#define fGEN_TCG_V6_vL32Ub_ppu (SHORTCODE ) SHORTCODE +#define fGEN_TCG_V6_vL32b_cur_ppu (SHORTCODE ) SHORTCODE +#define fGEN_TCG_V6_vL32b_tmp_ppu (SHORTCODE ) SHORTCODE +#define fGEN_TCG_V6_vL32b_nt_ppu (SHORTCODE ) SHORTCODE +#define fGEN_TCG_V6_vL32b_nt_cur_ppu (SHORTCODE ) SHORTCODE +#define fGEN_TCG_V6_vL32b_nt_tmp_ppu (SHORTCODE ) SHORTCODE + +/* Predicated vector loads */ +#define fGEN_TCG_PRED_VEC_LOAD (GET_EA ,PRED ,DSTOFF ,INC ) \ + do { \ + TCGv LSB = tcg_temp_new(); \ + TCGLabel *false_label = gen_new_label(); \ + TCGLabel *end_label = gen_new_label(); \ + GET_EA; \ + PRED; \ + tcg_gen_brcondi_tl(TCG_COND_EQ, LSB, 0, false_label); \ + tcg_temp_free(LSB); \ + gen_vreg_load(ctx, DSTOFF, EA, true); \ + INC; \ + tcg_gen_br(end_label); \ + gen_set_label(false_label); \ + tcg_gen_ori_tl(hex_slot_cancelled, hex_slot_cancelled, \ + 1 << insn->slot); \ + gen_set_label(end_label); \ + } while (0) + +#define fGEN_TCG_PRED_VEC_LOAD_pred_pi \ + fGEN_TCG_PRED_VEC_LOAD(fLSBOLD(PvV), \ + fEA_REG(RxV), \ + VdV_off, \ + fPM_I(RxV, siV * sizeof(MMVector))) +#define fGEN_TCG_PRED_VEC_LOAD_npred_pi \ + fGEN_TCG_PRED_VEC_LOAD(fLSBOLDNOT(PvV), \ + fEA_REG(RxV), \ + VdV_off, \ + fPM_I(RxV, siV * sizeof(MMVector))) + +#define fGEN_TCG_V6_vL32b_pred_pi (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_LOAD_pred_pi +#define fGEN_TCG_V6_vL32b_npred_pi (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_LOAD_npred_pi +#define fGEN_TCG_V6_vL32b_cur_pred_pi (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_LOAD_pred_pi +#define fGEN_TCG_V6_vL32b_cur_npred_pi (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_LOAD_npred_pi +#define fGEN_TCG_V6_vL32b_tmp_pred_pi (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_LOAD_pred_pi +#define fGEN_TCG_V6_vL32b_tmp_npred_pi (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_LOAD_npred_pi +#define fGEN_TCG_V6_vL32b_nt_pred_pi (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_LOAD_pred_pi +#define fGEN_TCG_V6_vL32b_nt_npred_pi (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_LOAD_npred_pi +#define fGEN_TCG_V6_vL32b_nt_cur_pred_pi (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_LOAD_pred_pi +#define fGEN_TCG_V6_vL32b_nt_cur_npred_pi (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_LOAD_npred_pi +#define fGEN_TCG_V6_vL32b_nt_tmp_pred_pi (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_LOAD_pred_pi +#define fGEN_TCG_V6_vL32b_nt_tmp_npred_pi (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_LOAD_npred_pi + +#define fGEN_TCG_PRED_VEC_LOAD_pred_ai \ + fGEN_TCG_PRED_VEC_LOAD(fLSBOLD(PvV), \ + fEA_RI(RtV, siV * sizeof(MMVector)), \ + VdV_off, \ + do {} while (0)) +#define fGEN_TCG_PRED_VEC_LOAD_npred_ai \ + fGEN_TCG_PRED_VEC_LOAD(fLSBOLDNOT(PvV), \ + fEA_RI(RtV, siV * sizeof(MMVector)), \ + VdV_off, \ + do {} while (0)) + +#define fGEN_TCG_V6_vL32b_pred_ai (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_LOAD_pred_ai +#define fGEN_TCG_V6_vL32b_npred_ai (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_LOAD_npred_ai +#define fGEN_TCG_V6_vL32b_cur_pred_ai (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_LOAD_pred_ai +#define fGEN_TCG_V6_vL32b_cur_npred_ai (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_LOAD_npred_ai +#define fGEN_TCG_V6_vL32b_tmp_pred_ai (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_LOAD_pred_ai +#define fGEN_TCG_V6_vL32b_tmp_npred_ai (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_LOAD_npred_ai +#define fGEN_TCG_V6_vL32b_nt_pred_ai (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_LOAD_pred_ai +#define fGEN_TCG_V6_vL32b_nt_npred_ai (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_LOAD_npred_ai +#define fGEN_TCG_V6_vL32b_nt_cur_pred_ai (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_LOAD_pred_ai +#define fGEN_TCG_V6_vL32b_nt_cur_npred_ai (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_LOAD_npred_ai +#define fGEN_TCG_V6_vL32b_nt_tmp_pred_ai (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_LOAD_pred_ai +#define fGEN_TCG_V6_vL32b_nt_tmp_npred_ai (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_LOAD_npred_ai + +#define fGEN_TCG_PRED_VEC_LOAD_pred_ppu \ + fGEN_TCG_PRED_VEC_LOAD(fLSBOLD(PvV), \ + fEA_REG(RxV), \ + VdV_off, \ + fPM_M(RxV, MuV)) +#define fGEN_TCG_PRED_VEC_LOAD_npred_ppu \ + fGEN_TCG_PRED_VEC_LOAD(fLSBOLDNOT(PvV), \ + fEA_REG(RxV), \ + VdV_off, \ + fPM_M(RxV, MuV)) + +#define fGEN_TCG_V6_vL32b_pred_ppu (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_LOAD_pred_ppu +#define fGEN_TCG_V6_vL32b_npred_ppu (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_LOAD_npred_ppu +#define fGEN_TCG_V6_vL32b_cur_pred_ppu (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_LOAD_pred_ppu +#define fGEN_TCG_V6_vL32b_cur_npred_ppu (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_LOAD_npred_ppu +#define fGEN_TCG_V6_vL32b_tmp_pred_ppu (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_LOAD_pred_ppu +#define fGEN_TCG_V6_vL32b_tmp_npred_ppu (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_LOAD_npred_ppu +#define fGEN_TCG_V6_vL32b_nt_pred_ppu (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_LOAD_pred_ppu +#define fGEN_TCG_V6_vL32b_nt_npred_ppu (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_LOAD_npred_ppu +#define fGEN_TCG_V6_vL32b_nt_cur_pred_ppu (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_LOAD_pred_ppu +#define fGEN_TCG_V6_vL32b_nt_cur_npred_ppu (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_LOAD_npred_ppu +#define fGEN_TCG_V6_vL32b_nt_tmp_pred_ppu (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_LOAD_pred_ppu +#define fGEN_TCG_V6_vL32b_nt_tmp_npred_ppu (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_LOAD_npred_ppu +#endif
Signature · 1 line
2.7.4
PATCH v4 23/30 Hexagon HVX (target/hexagon) helper overrides - vector stores
In reply to Taylor Simpson--- target/hexagon/gen_tcg_hvx.h | 218 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 218 insertions(+)
target/hexagon/gen_tcg_hvx.h +218 -0
@@ -682,4 +682,222 @@ static inline void assert_vhist_tmp(DisasContext *ctx)#define fGEN_TCG_V6_vL32b_nt_tmp_npred_ppu (SHORTCODE ) \ fGEN_TCG_PRED_VEC_LOAD_npred_ppu +/* Vector stores */ +#define fGEN_TCG_V6_vS32b_pi (SHORTCODE ) SHORTCODE +#define fGEN_TCG_V6_vS32Ub_pi (SHORTCODE ) SHORTCODE +#define fGEN_TCG_V6_vS32b_nt_pi (SHORTCODE ) SHORTCODE +#define fGEN_TCG_V6_vS32b_ai (SHORTCODE ) SHORTCODE +#define fGEN_TCG_V6_vS32Ub_ai (SHORTCODE ) SHORTCODE +#define fGEN_TCG_V6_vS32b_nt_ai (SHORTCODE ) SHORTCODE +#define fGEN_TCG_V6_vS32b_ppu (SHORTCODE ) SHORTCODE +#define fGEN_TCG_V6_vS32Ub_ppu (SHORTCODE ) SHORTCODE +#define fGEN_TCG_V6_vS32b_nt_ppu (SHORTCODE ) SHORTCODE + +/* New value vector stores */ +#define fGEN_TCG_NEWVAL_VEC_STORE (GET_EA ,INC ) \ + do { \ + GET_EA; \ + gen_vreg_store(ctx, insn, pkt, EA, OsN_off, insn->slot, true); \ + INC; \ + } while (0) + +#define fGEN_TCG_NEWVAL_VEC_STORE_pi \ + fGEN_TCG_NEWVAL_VEC_STORE(fEA_REG(RxV), fPM_I(RxV, siV * sizeof(MMVector))) + +#define fGEN_TCG_V6_vS32b_new_pi (SHORTCODE ) \ + fGEN_TCG_NEWVAL_VEC_STORE_pi +#define fGEN_TCG_V6_vS32b_nt_new_pi (SHORTCODE ) \ + fGEN_TCG_NEWVAL_VEC_STORE_pi + +#define fGEN_TCG_NEWVAL_VEC_STORE_ai \ + fGEN_TCG_NEWVAL_VEC_STORE(fEA_RI(RtV, siV * sizeof(MMVector)), \ + do { } while (0)) + +#define fGEN_TCG_V6_vS32b_new_ai (SHORTCODE ) \ + fGEN_TCG_NEWVAL_VEC_STORE_ai +#define fGEN_TCG_V6_vS32b_nt_new_ai (SHORTCODE ) \ + fGEN_TCG_NEWVAL_VEC_STORE_ai + +#define fGEN_TCG_NEWVAL_VEC_STORE_ppu \ + fGEN_TCG_NEWVAL_VEC_STORE(fEA_REG(RxV), fPM_M(RxV, MuV)) + +#define fGEN_TCG_V6_vS32b_new_ppu (SHORTCODE ) \ + fGEN_TCG_NEWVAL_VEC_STORE_ppu +#define fGEN_TCG_V6_vS32b_nt_new_ppu (SHORTCODE ) \ + fGEN_TCG_NEWVAL_VEC_STORE_ppu + +/* Predicated vector stores */ +#define fGEN_TCG_PRED_VEC_STORE (GET_EA ,PRED ,SRCOFF ,ALIGN ,INC ) \ + do { \ + TCGv LSB = tcg_temp_new(); \ + TCGLabel *false_label = gen_new_label(); \ + TCGLabel *end_label = gen_new_label(); \ + GET_EA; \ + PRED; \ + tcg_gen_brcondi_tl(TCG_COND_EQ, LSB, 0, false_label); \ + tcg_temp_free(LSB); \ + gen_vreg_store(ctx, insn, pkt, EA, SRCOFF, insn->slot, ALIGN); \ + INC; \ + tcg_gen_br(end_label); \ + gen_set_label(false_label); \ + tcg_gen_ori_tl(hex_slot_cancelled, hex_slot_cancelled, \ + 1 << insn->slot); \ + gen_set_label(end_label); \ + } while (0) + +#define fGEN_TCG_PRED_VEC_STORE_pred_pi (ALIGN ) \ + fGEN_TCG_PRED_VEC_STORE(fLSBOLD(PvV), \ + fEA_REG(RxV), \ + VsV_off, ALIGN, \ + fPM_I(RxV, siV * sizeof(MMVector))) +#define fGEN_TCG_PRED_VEC_STORE_npred_pi (ALIGN ) \ + fGEN_TCG_PRED_VEC_STORE(fLSBOLDNOT(PvV), \ + fEA_REG(RxV), \ + VsV_off, ALIGN, \ + fPM_I(RxV, siV * sizeof(MMVector))) +#define fGEN_TCG_PRED_VEC_STORE_new_pred_pi \ + fGEN_TCG_PRED_VEC_STORE(fLSBOLD(PvV), \ + fEA_REG(RxV), \ + OsN_off, true, \ + fPM_I(RxV, siV * sizeof(MMVector))) +#define fGEN_TCG_PRED_VEC_STORE_new_npred_pi \ + fGEN_TCG_PRED_VEC_STORE(fLSBOLDNOT(PvV), \ + fEA_REG(RxV), \ + OsN_off, true, \ + fPM_I(RxV, siV * sizeof(MMVector))) + +#define fGEN_TCG_V6_vS32b_pred_pi (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_STORE_pred_pi(true) +#define fGEN_TCG_V6_vS32b_npred_pi (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_STORE_npred_pi(true) +#define fGEN_TCG_V6_vS32Ub_pred_pi (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_STORE_pred_pi(false) +#define fGEN_TCG_V6_vS32Ub_npred_pi (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_STORE_npred_pi(false) +#define fGEN_TCG_V6_vS32b_nt_pred_pi (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_STORE_pred_pi(true) +#define fGEN_TCG_V6_vS32b_nt_npred_pi (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_STORE_npred_pi(true) +#define fGEN_TCG_V6_vS32b_new_pred_pi (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_STORE_new_pred_pi +#define fGEN_TCG_V6_vS32b_new_npred_pi (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_STORE_new_npred_pi +#define fGEN_TCG_V6_vS32b_nt_new_pred_pi (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_STORE_new_pred_pi +#define fGEN_TCG_V6_vS32b_nt_new_npred_pi (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_STORE_new_npred_pi + +#define fGEN_TCG_PRED_VEC_STORE_pred_ai (ALIGN ) \ + fGEN_TCG_PRED_VEC_STORE(fLSBOLD(PvV), \ + fEA_RI(RtV, siV * sizeof(MMVector)), \ + VsV_off, ALIGN, \ + do { } while (0)) +#define fGEN_TCG_PRED_VEC_STORE_npred_ai (ALIGN ) \ + fGEN_TCG_PRED_VEC_STORE(fLSBOLDNOT(PvV), \ + fEA_RI(RtV, siV * sizeof(MMVector)), \ + VsV_off, ALIGN, \ + do { } while (0)) +#define fGEN_TCG_PRED_VEC_STORE_new_pred_ai \ + fGEN_TCG_PRED_VEC_STORE(fLSBOLD(PvV), \ + fEA_RI(RtV, siV * sizeof(MMVector)), \ + OsN_off, true, \ + do { } while (0)) +#define fGEN_TCG_PRED_VEC_STORE_new_npred_ai \ + fGEN_TCG_PRED_VEC_STORE(fLSBOLDNOT(PvV), \ + fEA_RI(RtV, siV * sizeof(MMVector)), \ + OsN_off, true, \ + do { } while (0)) + +#define fGEN_TCG_V6_vS32b_pred_ai (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_STORE_pred_ai(true) +#define fGEN_TCG_V6_vS32b_npred_ai (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_STORE_npred_ai(true) +#define fGEN_TCG_V6_vS32Ub_pred_ai (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_STORE_pred_ai(false) +#define fGEN_TCG_V6_vS32Ub_npred_ai (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_STORE_npred_ai(false) +#define fGEN_TCG_V6_vS32b_nt_pred_ai (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_STORE_pred_ai(true) +#define fGEN_TCG_V6_vS32b_nt_npred_ai (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_STORE_npred_ai(true) +#define fGEN_TCG_V6_vS32b_new_pred_ai (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_STORE_new_pred_ai +#define fGEN_TCG_V6_vS32b_new_npred_ai (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_STORE_new_npred_ai +#define fGEN_TCG_V6_vS32b_nt_new_pred_ai (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_STORE_new_pred_ai +#define fGEN_TCG_V6_vS32b_nt_new_npred_ai (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_STORE_new_npred_ai + +#define fGEN_TCG_PRED_VEC_STORE_pred_ppu (ALIGN ) \ + fGEN_TCG_PRED_VEC_STORE(fLSBOLD(PvV), \ + fEA_REG(RxV), \ + VsV_off, ALIGN, \ + fPM_M(RxV, MuV)) +#define fGEN_TCG_PRED_VEC_STORE_npred_ppu (ALIGN ) \ + fGEN_TCG_PRED_VEC_STORE(fLSBOLDNOT(PvV), \ + fEA_REG(RxV), \ + VsV_off, ALIGN, \ + fPM_M(RxV, MuV)) +#define fGEN_TCG_PRED_VEC_STORE_new_pred_ppu \ + fGEN_TCG_PRED_VEC_STORE(fLSBOLD(PvV), \ + fEA_REG(RxV), \ + OsN_off, true, \ + fPM_M(RxV, MuV)) +#define fGEN_TCG_PRED_VEC_STORE_new_npred_ppu \ + fGEN_TCG_PRED_VEC_STORE(fLSBOLDNOT(PvV), \ + fEA_REG(RxV), \ + OsN_off, true, \ + fPM_M(RxV, MuV)) + +#define fGEN_TCG_V6_vS32b_pred_ppu (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_STORE_pred_ppu(true) +#define fGEN_TCG_V6_vS32b_npred_ppu (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_STORE_npred_ppu(true) +#define fGEN_TCG_V6_vS32Ub_pred_ppu (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_STORE_pred_ppu(false) +#define fGEN_TCG_V6_vS32Ub_npred_ppu (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_STORE_npred_ppu(false) +#define fGEN_TCG_V6_vS32b_nt_pred_ppu (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_STORE_pred_ppu(true) +#define fGEN_TCG_V6_vS32b_nt_npred_ppu (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_STORE_npred_ppu(true) +#define fGEN_TCG_V6_vS32b_new_pred_ppu (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_STORE_new_pred_ppu +#define fGEN_TCG_V6_vS32b_new_npred_ppu (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_STORE_new_npred_ppu +#define fGEN_TCG_V6_vS32b_nt_new_pred_ppu (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_STORE_new_pred_ppu +#define fGEN_TCG_V6_vS32b_nt_new_npred_ppu (SHORTCODE ) \ + fGEN_TCG_PRED_VEC_STORE_new_npred_ppu + +/* Masked vector stores */ +#define fGEN_TCG_V6_vS32b_qpred_pi (SHORTCODE ) SHORTCODE +#define fGEN_TCG_V6_vS32b_nt_qpred_pi (SHORTCODE ) SHORTCODE +#define fGEN_TCG_V6_vS32b_qpred_ai (SHORTCODE ) SHORTCODE +#define fGEN_TCG_V6_vS32b_nt_qpred_ai (SHORTCODE ) SHORTCODE +#define fGEN_TCG_V6_vS32b_qpred_ppu (SHORTCODE ) SHORTCODE +#define fGEN_TCG_V6_vS32b_nt_qpred_ppu (SHORTCODE ) SHORTCODE +#define fGEN_TCG_V6_vS32b_nqpred_pi (SHORTCODE ) SHORTCODE +#define fGEN_TCG_V6_vS32b_nt_nqpred_pi (SHORTCODE ) SHORTCODE +#define fGEN_TCG_V6_vS32b_nqpred_ai (SHORTCODE ) SHORTCODE +#define fGEN_TCG_V6_vS32b_nt_nqpred_ai (SHORTCODE ) SHORTCODE +#define fGEN_TCG_V6_vS32b_nqpred_ppu (SHORTCODE ) SHORTCODE +#define fGEN_TCG_V6_vS32b_nt_nqpred_ppu (SHORTCODE ) SHORTCODE + +/* Store release not modelled in qemu, but need to suppress compiler warnings */ +#define fGEN_TCG_V6_vS32b_srls_pi (SHORTCODE ) \ + do { \ + siV = siV; \ + } while (0) +#define fGEN_TCG_V6_vS32b_srls_ai (SHORTCODE ) \ + do { \ + RtV = RtV; \ + siV = siV; \ + } while (0) +#define fGEN_TCG_V6_vS32b_srls_ppu (SHORTCODE ) \ + do { \ + MuV = MuV; \ + } while (0) +#endif
Signature · 1 line
2.7.4
PATCH v4 24/30 Hexagon HVX (target/hexagon) import semantics
In reply to Taylor SimpsonImported from the Hexagon architecture library
imported/allext.idef Top level file for all extensions
imported/mmvec/ext.idef HVX instruction definitions
Support functions added to target/hexagon/genptr.c
--- target/hexagon/genptr.c | 172 +++ target/hexagon/imported/allext.idef | 25 + target/hexagon/imported/allidefs.def | 1 + target/hexagon/imported/mmvec/ext.idef | 2606 ++++++++++++++++++++++++++++++++ 4 files changed, 2804 insertions(+) create mode 100644 target/hexagon/imported/allext.idef create mode 100644 target/hexagon/imported/mmvec/ext.idef
target/hexagon/genptr.c +172 -0
@@ -19,11 +19,13 @@#include "cpu.h" #include "internal.h" #include "tcg/tcg-op.h" +#include "tcg/tcg-op-gvec.h" #include "insn.h" #include "opcodes.h" #include "translate.h" #define QEMU_GENERATE /* Used internally by macros.h */ #include "macros.h" +#include "mmvec/macros.h" #undef QEMU_GENERATE#include "gen_tcg.h" #include "gen_tcg_hvx.h"
@@ -462,5 +464,175 @@ static TCGv gen_8bitsof(TCGv result, TCGv value)return result; } +static intptr_t vreg_src_off (DisasContext *ctx,int num) +{ + intptr_t offset = offsetof(CPUHexagonState, VRegs[num]); + +if (test_bit (num, ctx->vregs_select)) { + offset =ctx_future_vreg_off (ctx, num,1 , false); + } +if (test_bit (num, ctx->vregs_updated_tmp)) { + offset =ctx_tmp_vreg_off (ctx, num,1 , false); + } +return offset; +} + +static void gen_log_vreg_write (DisasContext *ctx,intptr_t srcoff,int num, +VRegWriteType type,int slot_num, +bool is_predicated) +{ +TCGLabel *label_end =NULL ; +intptr_t dstoff; + +if (is_predicated) { +TCGv cancelled =tcg_temp_local_new (); + label_end =gen_new_label (); + +/* Don't do anything if the slot was cancelled */ +tcg_gen_extract_tl (cancelled, hex_slot_cancelled, slot_num,1 ); +tcg_gen_brcondi_tl (TCG_COND_NE , cancelled,0 , label_end); +tcg_temp_free (cancelled); + } + +if (type !=EXT_TMP ) { + dstoff =ctx_future_vreg_off (ctx, num,1 , true); +tcg_gen_gvec_mov (MO_64 , dstoff, srcoff, +sizeof (MMVector),sizeof (MMVector)); +tcg_gen_ori_tl (hex_VRegs_updated, hex_VRegs_updated,1 << num); + }else { + dstoff =ctx_tmp_vreg_off (ctx, num,1 , false); +tcg_gen_gvec_mov (MO_64 , dstoff, srcoff, +sizeof (MMVector),sizeof (MMVector)); + } + +if (is_predicated) { +gen_set_label (label_end); + } +} + +static void gen_log_vreg_write_pair (DisasContext *ctx,intptr_t srcoff,int num, +VRegWriteType type,int slot_num, +bool is_predicated) +{ +gen_log_vreg_write (ctx, srcoff, num ^0 , type, slot_num, is_predicated); + srcoff +=sizeof (MMVector); +gen_log_vreg_write (ctx, srcoff, num ^1 , type, slot_num, is_predicated); +} + +static void gen_log_qreg_write (intptr_t srcoff,int num,int vnew, +int slot_num,bool is_predicated) +{ +TCGLabel *label_end =NULL ; +intptr_t dstoff; + +if (is_predicated) { +TCGv cancelled =tcg_temp_local_new (); + label_end =gen_new_label (); + +/* Don't do anything if the slot was cancelled */ +tcg_gen_extract_tl (cancelled, hex_slot_cancelled, slot_num,1 ); +tcg_gen_brcondi_tl (TCG_COND_NE , cancelled,0 , label_end); +tcg_temp_free (cancelled); + } + + dstoff = offsetof(CPUHexagonState, future_QRegs[num]); +tcg_gen_gvec_mov (MO_64 , dstoff, srcoff,sizeof (MMQReg),sizeof (MMQReg)); + +if (is_predicated) { +tcg_gen_ori_tl (hex_QRegs_updated, hex_QRegs_updated,1 << num); +gen_set_label (label_end); + } +} + +static void gen_vreg_load (DisasContext *ctx,intptr_t dstoff,TCGv src, +bool aligned) +{ +TCGv_i64 tmp =tcg_temp_new_i64 (); +if (aligned) { +tcg_gen_andi_tl (src, src, ~((int32_t )sizeof (MMVector) -1 )); + } +for (int i =0 ; i <sizeof (MMVector) /8 ; i++) { +tcg_gen_qemu_ld64 (tmp, src, ctx->mem_idx); +tcg_gen_addi_tl (src, src,8 ); +tcg_gen_st_i64 (tmp, cpu_env, dstoff + i *8 ); + } +tcg_temp_free_i64 (tmp); +} + +static void gen_vreg_store (DisasContext *ctx,Insn *insn,Packet *pkt, +TCGv EA ,intptr_t srcoff,int slot,bool aligned) +{ + intptr_t dstoff = offsetof(CPUHexagonState, vstore[slot].data); + intptr_t maskoff = offsetof(CPUHexagonState, vstore[slot].mask); + +if (is_gather_store_insn (insn, pkt)) { +TCGv sl =tcg_constant_tl (slot); +gen_helper_gather_store (cpu_env,EA , sl); +return ; + } + +tcg_gen_movi_tl (hex_vstore_pending[slot],1 ); +if (aligned) { +tcg_gen_andi_tl (hex_vstore_addr[slot],EA , + ~((int32_t )sizeof (MMVector) -1 )); + }else { +tcg_gen_mov_tl (hex_vstore_addr[slot],EA ); + } +tcg_gen_movi_tl (hex_vstore_size[slot],sizeof (MMVector)); + +/* Copy the data to the vstore buffer */ +tcg_gen_gvec_mov (MO_64 , dstoff, srcoff,sizeof (MMVector),sizeof (MMVector)); +/* Set the mask to all 1's */ +tcg_gen_gvec_dup_imm (MO_64 , maskoff,sizeof (MMQReg),sizeof (MMQReg), ~0LL ); +} + +static void gen_vreg_masked_store (DisasContext *ctx,TCGv EA ,intptr_t srcoff, +intptr_t bitsoff,int slot,bool invert) +{ + intptr_t dstoff = offsetof(CPUHexagonState, vstore[slot].data); + intptr_t maskoff = offsetof(CPUHexagonState, vstore[slot].mask); + +tcg_gen_movi_tl (hex_vstore_pending[slot],1 ); +tcg_gen_andi_tl (hex_vstore_addr[slot],EA , + ~((int32_t )sizeof (MMVector) -1 )); +tcg_gen_movi_tl (hex_vstore_size[slot],sizeof (MMVector)); + +/* Copy the data to the vstore buffer */ +tcg_gen_gvec_mov (MO_64 , dstoff, srcoff,sizeof (MMVector),sizeof (MMVector)); +/* Copy the mask */ +tcg_gen_gvec_mov (MO_64 , maskoff, bitsoff,sizeof (MMQReg),sizeof (MMQReg)); +if (invert) { +tcg_gen_gvec_not (MO_64 , maskoff, maskoff, +sizeof (MMQReg),sizeof (MMQReg)); + } +} + +static void vec_to_qvec (size_t size,intptr_t dstoff,intptr_t srcoff) +{ +TCGv_i64 tmp =tcg_temp_new_i64 (); +TCGv_i64 word =tcg_temp_new_i64 (); +TCGv_i64 bits =tcg_temp_new_i64 (); +TCGv_i64 mask =tcg_temp_new_i64 (); +TCGv_i64 zero =tcg_constant_i64 (0 ); +TCGv_i64 ones =tcg_constant_i64 (~0 ); + +for (int i =0 ; i <sizeof (MMVector) /8 ; i++) { +tcg_gen_ld_i64 (tmp, cpu_env, srcoff + i *8 ); +tcg_gen_movi_i64 (mask,0 ); + +for (int j =0 ; j <8 ; j += size) { +tcg_gen_extract_i64 (word, tmp, j *8 , size *8 ); +tcg_gen_movcond_i64 (TCG_COND_NE , bits, word, zero, ones, zero); +tcg_gen_deposit_i64 (mask, mask, bits, j, size); + } + +tcg_gen_st8_i64 (mask, cpu_env, dstoff + i); + } +tcg_temp_free_i64 (tmp); +tcg_temp_free_i64 (word); +tcg_temp_free_i64 (bits); +tcg_temp_free_i64 (mask); +} +#include "tcg_funcs_generated.c.inc" #include "tcg_func_table_generated.c.inc"
target/hexagon/imported/allext.idef new file +25 -0
@@ -0,0 +1,25 @@ +/* + * Copyright(c) 2019-2021 Qualcomm Innovation Center, Inc. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <http://www.gnu.org/licenses/>. + */ + +/* + * Top level file for all instruction set extensions + */ +#define EXTNAME mmvec +#define EXTSTR "mmvec" +#include "mmvec/ext.idef" +#undef EXTNAME +#undef EXTSTR
target/hexagon/imported/allidefs.def +1 -0
@@ -28,3 +28,4 @@ #include "shift.idef" #include "system.idef" #include "subinsns.idef" +#include "allext.idef"
target/hexagon/imported/mmvec/ext.idef new file +2606 -0
2,606 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v4 25/30 Hexagon HVX (target/hexagon) instruction decoding
In reply to Taylor SimpsonAdd new file to target/hexagon/meson.build
--- target/hexagon/mmvec/decode_ext_mmvec.h | 24 ++++ target/hexagon/decode.c | 24 +++- target/hexagon/mmvec/decode_ext_mmvec.c | 236 ++++++++++++++++++++++++++++++++ target/hexagon/meson.build | 1 + 4 files changed, 283 insertions(+), 2 deletions(-) create mode 100644 target/hexagon/mmvec/decode_ext_mmvec.h create mode 100644 target/hexagon/mmvec/decode_ext_mmvec.c
target/hexagon/mmvec/decode_ext_mmvec.h new file +24 -0
@@ -0,0 +1,24 @@ +/* +* Copyright(c) 2019-2021 Qualcomm Innovation Center, Inc. All Rights Reserved. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef HEXAGON_DECODE_EXT_MMVEC_H +#define HEXAGON_DECODE_EXT_MMVEC_H + +void mmvec_ext_decode_checks (Packet *pkt,bool disas_only); +SlotMask mmvec_ext_decode_find_iclass_slots (int opcode); + +#endif
target/hexagon/decode.c +22 -2
@@ -22,6 +22,7 @@#include "decode.h" #include "insn.h" #include "printinsn.h" +#include "mmvec/decode_ext_mmvec.h" #define fZXTN (N ,M ,VAL ) ((VAL) & ((1LL << (N)) - 1))
@@ -566,8 +567,12 @@ static void decode_remove_extenders(Packet *packet)static SlotMask get_valid_slots (const Packet *pkt,unsigned int slot) { -return find_iclass_slots (pkt->insn[slot].opcode, - pkt->insn[slot].iclass); +if (GET_ATTRIB (pkt->insn[slot].opcode,A_EXTENSION )) { +return mmvec_ext_decode_find_iclass_slots (pkt->insn[slot].opcode); + }else { +return find_iclass_slots (pkt->insn[slot].opcode, + pkt->insn[slot].iclass); + } }#define DECODE_NEW_TABLE (TAG ,SIZE ,WHATNOT )/* NOTHING */
@@ -728,6 +733,11 @@ decode_insns_tablewalk(Insn *insn, const DectreeTable *table, }decode_op (insn, opc, encoding);return 1 ; + }else if (table->table[i].type ==DECTREE_EXTSPACE ) { +/* +* For now, HVX will be the only coproc +*/ +return decode_insns_tablewalk (insn, ext_trees[EXT_IDX_mmvec], encoding); }else {return 0 ; }
@@ -874,6 +884,7 @@ int decode_packet(int max_words, const uint32_t *words, Packet *pkt,int words_read =0 ;bool end_of_packet = false;int new_insns =0 ; +int i;uint32_t encoding32;/* Initialize */
@@ -901,6 +912,11 @@ int decode_packet(int max_words, const uint32_t *words, Packet *pkt,return 0 ; } pkt->encod_pkt_size_in_bytes = words_read *4 ; + pkt->pkt_has_hvx = false; +for (i =0 ; i < num_insns; i++) { + pkt->pkt_has_hvx |= +GET_ATTRIB (pkt->insn[i].opcode,A_CVI ); + }/* * Check for :endloop in the parse bits
@@ -931,6 +947,10 @@ int decode_packet(int max_words, const uint32_t *words, Packet *pkt,decode_set_slot_number (pkt);decode_fill_newvalue_regno (pkt); +if (pkt->pkt_has_hvx) { +mmvec_ext_decode_checks (pkt, disas_only); + } +if (!disas_only) {decode_shuffle_for_execution (pkt);decode_split_cmpjump (pkt);
target/hexagon/mmvec/decode_ext_mmvec.c new file +236 -0
236 lines not on this page · raw message
target/hexagon/meson.build +1 -0
@@ -175,6 +175,7 @@ hexagon_ss.add(files( 'printinsn.c', 'arch.c', 'fma_emu.c', + 'mmvec/decode_ext_mmvec.c', 'mmvec/system_ext_mmvec.c', ))
Signature · 1 line
2.7.4
PATCH v4 26/30 Hexagon HVX (target/hexagon) import instruction encodings
In reply to Taylor Simpson--- target/hexagon/decode.c | 4 + target/hexagon/imported/allextenc.def | 20 + target/hexagon/imported/encode.def | 1 + target/hexagon/imported/mmvec/encode_ext.def | 794 +++++++++++++++++++++++++++ 4 files changed, 819 insertions(+) create mode 100644 target/hexagon/imported/allextenc.def create mode 100644 target/hexagon/imported/mmvec/encode_ext.def
target/hexagon/decode.c +4 -0
@@ -47,6 +47,7 @@ enum {/* Name Num Table */ DEF_REGMAP(R_16, 16, 0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 23) DEF_REGMAP(R__8, 8, 0, 2, 4, 6, 16, 18, 20, 22) +DEF_REGMAP(R_8, 8, 0, 1, 2, 3, 4, 5, 6, 7)#define DECODE_MAPPED_REG (OPNUM ,NAME ) \ insn->regno[OPNUM] = DECODE_REGISTER_##NAME[insn->regno[OPNUM]];
@@ -158,6 +159,9 @@ static void decode_ext_init(void)for (i = EXT_IDX_noext; i < EXT_IDX_noext_AFTER; i++) { ext_trees[i] = &dectree_table_DECODE_EXT_EXT_noext; } +for (i = EXT_IDX_mmvec; i < EXT_IDX_mmvec_AFTER; i++) { + ext_trees[i] = &dectree_table_DECODE_EXT_EXT_mmvec; + } } typedef struct {
target/hexagon/imported/allextenc.def new file +20 -0
@@ -0,0 +1,20 @@ +/* + * Copyright(c) 2019-2021 Qualcomm Innovation Center, Inc. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <http://www.gnu.org/licenses/>. + */ + +#define EXTNAME mmvec +#include "mmvec/encode_ext.def" +#undef EXTNAME
target/hexagon/imported/encode.def +1 -0
@@ -71,6 +71,7 @@ #include "encode_pp.def" #include "encode_subinsn.def" +#include "allextenc.def" #ifdef __SELF_DEF_FIELD32 #undef __SELF_DEF_FIELD32
target/hexagon/imported/mmvec/encode_ext.def new file +794 -0
794 lines not on this page · raw message
Signature · 1 line
2.7.4
Re: [PATCH v4 26/30] Hexagon HVX (target/hexagon) import instruction encodings
Quoted 9 lines · Taylor Simpson
Signed-off-by Taylor Simpson<[email protected]>--- target/hexagon/decode.c | 4 + target/hexagon/imported/allextenc.def | 20 + target/hexagon/imported/encode.def | 1 + target/hexagon/imported/mmvec/encode_ext.def | 794 +++++++++++++++++++++++++++ 4 files changed, 819 insertions(+)create mode 100644 target/hexagon/imported/allextenc.def create mode 100644 target/hexagon/imported/mmvec/encode_ext.def
r~
PATCH v4 27/30 Hexagon HVX (tests/tcg/hexagon) vector_add_int test
In reply to Taylor Simpson--- tests/tcg/hexagon/vector_add_int.c | 61 ++++++++++++++++++++++++++++++++++++++ tests/tcg/hexagon/Makefile.target | 3 ++ 2 files changed, 64 insertions(+) create mode 100644 tests/tcg/hexagon/vector_add_int.c
tests/tcg/hexagon/vector_add_int.c new file +61 -0
@@ -0,0 +1,61 @@ +/* +* Copyright(c) 2019-2021 Qualcomm Innovation Center, Inc. All Rights Reserved. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ + +#include <stdio.h> + +int gA[401 ]; +int gB[401 ]; +int gC[401 ]; + +void vector_add_int () +{ +int i; +for (i =0 ; i <400 ; i++) { + gA[i] = gB[i] + gC[i]; + } +} + +int main () +{ +int error =0 ; +int i; +for (i =0 ; i <400 ; i++) { + gB[i] = i *2 ; + gC[i] = i *3 ; + } + gA[400 ] =17 ; +vector_add_int (); +for (i =0 ; i <400 ; i++) { +if (gA[i] != i *5 ) { + error++; +printf ("ERROR: gB[%d] = %d\t" , i, gB[i]); +printf ("gC[%d] = %d\t" , i, gC[i]); +printf ("gA[%d] = %d\n" , i, gA[i]); + } + } +if (gA[400 ] !=17 ) { + error++; +printf ("ERROR: Overran the buffer\n" ); + } +if (!error) { +printf ("PASS\n" ); +return 0 ; + }else { +printf ("FAIL\n" ); +return 1 ; + } +}
tests/tcg/hexagon/Makefile.target +3 -0
@@ -38,7 +38,10 @@ HEX_TESTS += circ HEX_TESTS += brev HEX_TESTS += load_unpack HEX_TESTS += load_align +HEX_TESTS += vector_add_int HEX_TESTS += atomics HEX_TESTS += fpstuff TESTS += $(HEX_TESTS) + +vector_add_int: CFLAGS += -mhvx -fvectorize
Signature · 1 line
2.7.4
Re: [PATCH v4 27/30] Hexagon HVX (tests/tcg/hexagon) vector_add_int test
Quoted 1 line · Taylor Simpson
Signe-off-by Taylor Simpson<[email protected]>
"Signed"
r~
PATCH v4 28/30 Hexagon HVX (tests/tcg/hexagon) hvx_misc test
In reply to Taylor SimpsonTests for
packet semantics
vector loads (aligned and unaligned)
vector stores (aligned and unaligned)
vector masked stores
vector new value store
maximum HVX temps in a packet
vector operations
--- tests/tcg/hexagon/hvx_misc.c | 469 ++++++++++++++++++++++++++++++++++++++ tests/tcg/hexagon/Makefile.target | 2 + 2 files changed, 471 insertions(+) create mode 100644 tests/tcg/hexagon/hvx_misc.c
tests/tcg/hexagon/hvx_misc.c new file +469 -0
@@ -0,0 +1,469 @@ +/* + * Copyright(c) 2021 Qualcomm Innovation Center, Inc. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <http://www.gnu.org/licenses/>. + */ + +#include <stdio.h> +#include <stdint.h> +#include <stdbool.h> +#include <string.h> + +int err; + +static void __check(int line, int i, int j, uint64_t result, uint64_t expect) +{ + if (result != expect) { + printf("ERROR at line %d: [%d][%d] 0x%016llx != 0x%016llx\n", + line, i, j, result, expect); + err++; + } +} + +#define check(RES, EXP) __check(__LINE__, RES, EXP) + +#define MAX_VEC_SIZE_BYTES 128 + +typedef union { + uint64_t ud[MAX_VEC_SIZE_BYTES / 8]; + int64_t d[MAX_VEC_SIZE_BYTES / 8]; + uint32_t uw[MAX_VEC_SIZE_BYTES / 4]; + int32_t w[MAX_VEC_SIZE_BYTES / 4]; + uint16_t uh[MAX_VEC_SIZE_BYTES / 2]; + int16_t h[MAX_VEC_SIZE_BYTES / 2]; + uint8_t ub[MAX_VEC_SIZE_BYTES / 1]; + int8_t b[MAX_VEC_SIZE_BYTES / 1]; +} MMVector; + +#define BUFSIZE 16 +#define OUTSIZE 16 +#define MASKMOD 3 + +MMVector buffer0[BUFSIZE] __attribute__((aligned(MAX_VEC_SIZE_BYTES))); +MMVector buffer1[BUFSIZE] __attribute__((aligned(MAX_VEC_SIZE_BYTES))); +MMVector mask[BUFSIZE] __attribute__((aligned(MAX_VEC_SIZE_BYTES))); +MMVector output[OUTSIZE] __attribute__((aligned(MAX_VEC_SIZE_BYTES))); +MMVector expect[OUTSIZE] __attribute__((aligned(MAX_VEC_SIZE_BYTES))); + +#define CHECK_OUTPUT_FUNC(FIELD, FIELDSZ) \ +static void check_output_##FIELD(int line, size_t num_vectors) \ +{ \ + for (int i = 0; i < num_vectors; i++) { \ + for (int j = 0; j < MAX_VEC_SIZE_BYTES / FIELDSZ; j++) { \ + __check(line, i, j, output[i].FIELD[j], expect[i].FIELD[j]); \ + } \ + } \ +} + +CHECK_OUTPUT_FUNC(d, 8) +CHECK_OUTPUT_FUNC(w, 4) +CHECK_OUTPUT_FUNC(h, 2) +CHECK_OUTPUT_FUNC(b, 1) + +static void init_buffers(void) +{ + int counter0 = 0; + int counter1 = 17; + for (int i = 0; i < BUFSIZE; i++) { + for (int j = 0; j < MAX_VEC_SIZE_BYTES; j++) { + buffer0[i].b[j] = counter0++; + buffer1[i].b[j] = counter1++; + } + for (int j = 0; j < MAX_VEC_SIZE_BYTES / 4; j++) { + mask[i].w[j] = (i + j % MASKMOD == 0) ? 0 : 1; + } + } +} + +static void test_load_tmp(void) +{ + void *p0 = buffer0; + void *p1 = buffer1; + void *pout = output; + + for (int i = 0; i < BUFSIZE; i++) { + /* + * Load into v12 as .tmp, then use it in the next packet + * Should get the new value within the same packet and + * the old value in the next packet + */ + asm("v3 = vmem(%0 + #0)\n\t" + "r1 = #1\n\t" + "v12 = vsplat(r1)\n\t" + "{\n\t" + " v12.tmp = vmem(%1 + #0)\n\t" + " v4.w = vadd(v12.w, v3.w)\n\t" + "}\n\t" + "v4.w = vadd(v4.w, v12.w)\n\t" + "vmem(%2 + #0) = v4\n\t" + : : "r"(p0), "r"(p1), "r"(pout) + : "r1", "v12", "v3", "v4", "v6", "memory"); + p0 += sizeof(MMVector); + p1 += sizeof(MMVector); + pout += sizeof(MMVector); + + for (int j = 0; j < MAX_VEC_SIZE_BYTES / 4; j++) { + expect[i].w[j] = buffer0[i].w[j] + buffer1[i].w[j] + 1; + } + } + + check_output_w(__LINE__, BUFSIZE); +} + +static void test_load_cur(void) +{ + void *p0 = buffer0; + void *pout = output; + + for (int i = 0; i < BUFSIZE; i++) { + asm("{\n\t" + " v2.cur = vmem(%0 + #0)\n\t" + " vmem(%1 + #0) = v2\n\t" + "}\n\t" + : : "r"(p0), "r"(pout) : "v2", "memory"); + p0 += sizeof(MMVector); + pout += sizeof(MMVector); + + for (int j = 0; j < MAX_VEC_SIZE_BYTES / 4; j++) { + expect[i].uw[j] = buffer0[i].uw[j]; + } + } + + check_output_w(__LINE__, BUFSIZE); +} + +static void test_load_aligned(void) +{ + /* Aligned loads ignore the low bits of the address */ + void *p0 = buffer0; + void *pout = output; + const size_t offset = 13; + + p0 += offset; /* Create an unaligned address */ + asm("v2 = vmem(%0 + #0)\n\t" + "vmem(%1 + #0) = v2\n\t" + : : "r"(p0), "r"(pout) : "v2", "memory"); + + expect[0] = buffer0[0]; + + check_output_w(__LINE__, 1); +} + +static void test_load_unaligned(void) +{ + void *p0 = buffer0; + void *pout = output; + const size_t offset = 12; + + p0 += offset; /* Create an unaligned address */ + asm("v2 = vmemu(%0 + #0)\n\t" + "vmem(%1 + #0) = v2\n\t" + : : "r"(p0), "r"(pout) : "v2", "memory"); + + memcpy(expect, &buffer0[0].ub[offset], sizeof(MMVector)); + + check_output_w(__LINE__, 1); +} + +static void test_store_aligned(void) +{ + /* Aligned stores ignore the low bits of the address */ + void *p0 = buffer0; + void *pout = output; + const size_t offset = 13; + + pout += offset; /* Create an unaligned address */ + asm("v2 = vmem(%0 + #0)\n\t" + "vmem(%1 + #0) = v2\n\t" + : : "r"(p0), "r"(pout) : "v2", "memory"); + + expect[0] = buffer0[0]; + + check_output_w(__LINE__, 1); +} + +static void test_store_unaligned(void) +{ + void *p0 = buffer0; + void *pout = output; + const size_t offset = 12; + + pout += offset; /* Create an unaligned address */ + asm("v2 = vmem(%0 + #0)\n\t" + "vmemu(%1 + #0) = v2\n\t" + : : "r"(p0), "r"(pout) : "v2", "memory"); + + memcpy(expect, buffer0, 2 * sizeof(MMVector)); + memcpy(&expect[0].ub[offset], buffer0, sizeof(MMVector)); + + check_output_w(__LINE__, 2); +} + +static void test_masked_store(bool invert) +{ + void *p0 = buffer0; + void *pmask = mask; + void *pout = output; + + memset(expect, 0xff, sizeof(expect)); + memset(output, 0xff, sizeof(expect)); + + for (int i = 0; i < BUFSIZE; i++) { + if (invert) { + asm("r4 = #0\n\t" + "v4 = vsplat(r4)\n\t" + "v5 = vmem(%0 + #0)\n\t" + "q0 = vcmp.eq(v4.w, v5.w)\n\t" + "v5 = vmem(%1)\n\t" + "if (!q0) vmem(%2) = v5\n\t" /* Inverted test */ + : : "r"(pmask), "r"(p0), "r"(pout) + : "r4", "v4", "v5", "q0", "memory"); + } else { + asm("r4 = #0\n\t" + "v4 = vsplat(r4)\n\t" + "v5 = vmem(%0 + #0)\n\t" + "q0 = vcmp.eq(v4.w, v5.w)\n\t" + "v5 = vmem(%1)\n\t" + "if (q0) vmem(%2) = v5\n\t" /* Non-inverted test */ + : : "r"(pmask), "r"(p0), "r"(pout) + : "r4", "v4", "v5", "q0", "memory"); + } + p0 += sizeof(MMVector); + pmask += sizeof(MMVector); + pout += sizeof(MMVector); + + for (int j = 0; j < MAX_VEC_SIZE_BYTES / 4; j++) { + if (invert) { + if (i + j % MASKMOD != 0) { + expect[i].w[j] = buffer0[i].w[j]; + } + } else { + if (i + j % MASKMOD == 0) { + expect[i].w[j] = buffer0[i].w[j]; + } + } + } + } + + check_output_w(__LINE__, BUFSIZE); +} + +static void test_new_value_store(void) +{ + void *p0 = buffer0; + void *pout = output; + + asm("{\n\t" + " v2 = vmem(%0 + #0)\n\t" + " vmem(%1 + #0) = v2.new\n\t" + "}\n\t" + : : "r"(p0), "r"(pout) : "v2", "memory"); + + expect[0] = buffer0[0]; + + check_output_w(__LINE__, 1); +} + +static void test_max_temps() +{ + void *p0 = buffer0; + void *pout = output; + + asm("v0 = vmem(%0 + #0)\n\t" + "v1 = vmem(%0 + #1)\n\t" + "v2 = vmem(%0 + #2)\n\t" + "v3 = vmem(%0 + #3)\n\t" + "v4 = vmem(%0 + #4)\n\t" + "{\n\t" + " v1:0.w = vadd(v3:2.w, v1:0.w)\n\t" + " v2.b = vshuffe(v3.b, v2.b)\n\t" + " v3.w = vadd(v1.w, v4.w)\n\t" + " v4.tmp = vmem(%0 + #5)\n\t" + "}\n\t" + "vmem(%1 + #0) = v0\n\t" + "vmem(%1 + #1) = v1\n\t" + "vmem(%1 + #2) = v2\n\t" + "vmem(%1 + #3) = v3\n\t" + "vmem(%1 + #4) = v4\n\t" + : : "r"(p0), "r"(pout) : "memory"); + + /* The first two vectors come from the vadd-pair instruction */ + for (int i = 0; i < MAX_VEC_SIZE_BYTES / 4; i++) { + expect[0].w[i] = buffer0[0].w[i] + buffer0[2].w[i]; + expect[1].w[i] = buffer0[1].w[i] + buffer0[3].w[i]; + } + /* The third vector comes from the vshuffe instruction */ + for (int i = 0; i < MAX_VEC_SIZE_BYTES / 2; i++) { + expect[2].uh[i] = (buffer0[2].uh[i] & 0xff) | + (buffer0[3].uh[i] & 0xff) << 8; + } + /* The fourth vector comes from the vadd-single instruction */ + for (int i = 0; i < MAX_VEC_SIZE_BYTES / 4; i++) { + expect[3].w[i] = buffer0[1].w[i] + buffer0[5].w[i]; + } + /* + * The fifth vector comes from the load to v4 + * make sure the .tmp is dropped + */ + expect[4] = buffer0[4]; + + check_output_b(__LINE__, 5); +} + +#define VEC_OP1(ASM, EL, IN, OUT) \ + asm("v2 = vmem(%0 + #0)\n\t" \ + "v2" #EL " = " #ASM "(v2" #EL ")\n\t" \ + "vmem(%1 + #0) = v2\n\t" \ + : : "r"(IN), "r"(OUT) : "v2", "memory") + +#define VEC_OP2(ASM, EL, IN0, IN1, OUT) \ + asm("v2 = vmem(%0 + #0)\n\t" \ + "v3 = vmem(%1 + #0)\n\t" \ + "v2" #EL " = " #ASM "(v2" #EL ", v3" #EL ")\n\t" \ + "vmem(%2 + #0) = v2\n\t" \ + : : "r"(IN0), "r"(IN1), "r"(OUT) : "v2", "v3", "memory") + +#define TEST_VEC_OP1(NAME, ASM, EL, FIELD, FIELDSZ, OP) \ +static void test_##NAME(void) \ +{ \ + void *pin = buffer0; \ + void *pout = output; \ + for (int i = 0; i < BUFSIZE; i++) { \ + VEC_OP1(ASM, EL, pin, pout); \ + pin += sizeof(MMVector); \ + pout += sizeof(MMVector); \ + } \ + for (int i = 0; i < BUFSIZE; i++) { \ + for (int j = 0; j < MAX_VEC_SIZE_BYTES / FIELDSZ; j++) { \ + expect[i].FIELD[j] = OP buffer0[i].FIELD[j]; \ + } \ + } \ + check_output_##FIELD(__LINE__, BUFSIZE); \ +} + +#define TEST_VEC_OP2(NAME, ASM, EL, FIELD, FIELDSZ, OP) \ +static void test_##NAME(void) \ +{ \ + void *p0 = buffer0; \ + void *p1 = buffer1; \ + void *pout = output; \ + for (int i = 0; i < BUFSIZE; i++) { \ + VEC_OP2(ASM, EL, p0, p1, pout); \ + p0 += sizeof(MMVector); \ + p1 += sizeof(MMVector); \ + pout += sizeof(MMVector); \ + } \ + for (int i = 0; i < BUFSIZE; i++) { \ + for (int j = 0; j < MAX_VEC_SIZE_BYTES / FIELDSZ; j++) { \ + expect[i].FIELD[j] = buffer0[i].FIELD[j] OP buffer1[i].FIELD[j]; \ + } \ + } \ + check_output_##FIELD(__LINE__, BUFSIZE); \ +} + +#define THRESHOLD 31 + +#define PRED_OP2(ASM, IN0, IN1, OUT, INV) \ + asm("r4 = #%3\n\t" \ + "v1.b = vsplat(r4)\n\t" \ + "v2 = vmem(%0 + #0)\n\t" \ + "q0 = vcmp.gt(v2.b, v1.b)\n\t" \ + "v3 = vmem(%1 + #0)\n\t" \ + "q1 = vcmp.gt(v3.b, v1.b)\n\t" \ + "q2 = " #ASM "(q0, " INV "q1)\n\t" \ + "r4 = #0xff\n\t" \ + "v1.b = vsplat(r4)\n\t" \ + "if (q2) vmem(%2 + #0) = v1\n\t" \ + : : "r"(IN0), "r"(IN1), "r"(OUT), "i"(THRESHOLD) \ + : "r4", "v1", "v2", "v3", "q0", "q1", "q2", "memory") + +#define TEST_PRED_OP2(NAME, ASM, OP, INV) \ +static void test_##NAME(bool invert) \ +{ \ + void *p0 = buffer0; \ + void *p1 = buffer1; \ + void *pout = output; \ + memset(output, 0, sizeof(expect)); \ + for (int i = 0; i < BUFSIZE; i++) { \ + PRED_OP2(ASM, p0, p1, pout, INV); \ + p0 += sizeof(MMVector); \ + p1 += sizeof(MMVector); \ + pout += sizeof(MMVector); \ + } \ + for (int i = 0; i < BUFSIZE; i++) { \ + for (int j = 0; j < MAX_VEC_SIZE_BYTES; j++) { \ + bool p0 = (buffer0[i].b[j] > THRESHOLD); \ + bool p1 = (buffer1[i].b[j] > THRESHOLD); \ + if (invert) { \ + expect[i].b[j] = (p0 OP !p1) ? 0xff : 0x00; \ + } else { \ + expect[i].b[j] = (p0 OP p1) ? 0xff : 0x00; \ + } \ + } \ + } \ + check_output_b(__LINE__, BUFSIZE); \ +} + +TEST_VEC_OP2(vadd_w, vadd, .w, w, 4, +) +TEST_VEC_OP2(vadd_h, vadd, .h, h, 2, +) +TEST_VEC_OP2(vadd_b, vadd, .b, b, 1, +) +TEST_VEC_OP2(vsub_w, vsub, .w, w, 4, -) +TEST_VEC_OP2(vsub_h, vsub, .h, h, 2, -) +TEST_VEC_OP2(vsub_b, vsub, .b, b, 1, -) +TEST_VEC_OP2(vxor, vxor, , d, 8, ^) +TEST_VEC_OP2(vand, vand, , d, 8, &) +TEST_VEC_OP2(vor, vor, , d, 8, |) +TEST_VEC_OP1(vnot, vnot, , d, 8, ~) + +TEST_PRED_OP2(pred_or, or, |, "") +TEST_PRED_OP2(pred_or_n, or, |, "!") +TEST_PRED_OP2(pred_and, and, &, "") +TEST_PRED_OP2(pred_and_n, and, &, "!") +TEST_PRED_OP2(pred_xor, xor, ^, "") + +int main() +{ + init_buffers(); + + test_load_tmp(); + test_load_cur(); + test_load_aligned(); + test_load_unaligned(); + test_store_aligned(); + test_store_unaligned(); + test_masked_store(false); + test_masked_store(true); + test_new_value_store(); + test_max_temps(); + + test_vadd_w(); + test_vadd_h(); + test_vadd_b(); + test_vsub_w(); + test_vsub_h(); + test_vsub_b(); + test_vxor(); + test_vand(); + test_vor(); + test_vnot(); + + test_pred_or(false); + test_pred_or_n(true); + test_pred_and(false); + test_pred_and_n(true); + test_pred_xor(false); + + puts(err ? "FAIL" : "PASS"); + return err ? 1 : 0; +}
tests/tcg/hexagon/Makefile.target +2 -0
@@ -41,7 +41,9 @@ HEX_TESTS += load_align HEX_TESTS += vector_add_int HEX_TESTS += atomics HEX_TESTS += fpstuff +HEX_TESTS += hvx_misc TESTS += $(HEX_TESTS) vector_add_int: CFLAGS += -mhvx -fvectorize +hvx_misc: CFLAGS += -mhvx
Signature · 1 line
2.7.4
Re: [PATCH v4 28/30] Hexagon HVX (tests/tcg/hexagon) hvx_misc test
Quoted 9 lines · Taylor Simpson
Tests for
packet semantics
vector loads (aligned and unaligned)
vector stores (aligned and unaligned)
vector masked stores
vector new value store
maximum HVX temps in a packet
vector operations
Quoted 6 lines
Signed-off-by Taylor Simpson<[email protected]>--- tests/tcg/hexagon/hvx_misc.c | 469 ++++++++++++++++++++++++++++++++++++++ tests/tcg/hexagon/Makefile.target | 2 + 2 files changed, 471 insertions(+)create mode 100644
tests/tcg/hexagon/hvx_misc.c
r~
PATCH v4 29/30 Hexagon HVX (tests/tcg/hexagon) scatter_gather test
In reply to Taylor Simpson--- tests/tcg/hexagon/scatter_gather.c | 1011 ++++++++++++++++++++++++++++++++++++ tests/tcg/hexagon/Makefile.target | 2 + 2 files changed, 1013 insertions(+) create mode 100644 tests/tcg/hexagon/scatter_gather.c
tests/tcg/hexagon/scatter_gather.c new file +1011 -0
@@ -0,0 +1,1011 @@ +/* +* Copyright(c) 2019-2021 Qualcomm Innovation Center, Inc. All Rights Reserved. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ + +/* +* This example tests the HVX scatter/gather instructions +* +* See section 5.13 of the V68 HVX Programmer's Reference +* +* There are 3 main classes operations +* _16 16-bit elements and 16-bit offsets +* _32 32-bit elements and 32-bit offsets +* _16_32 16-bit elements and 32-bit offsets +* +* There are also masked and accumulate versions +*/ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <inttypes.h> + +typedef long HVX_Vector __attribute__((__vector_size__ (128 ))) + __attribute__((aligned (128 ))); +typedef long HVX_VectorPair __attribute__((__vector_size__ (256 ))) + __attribute__((aligned (128 ))); +typedef long HVX_VectorPred __attribute__((__vector_size__ (128 ))) + __attribute__((aligned (128 ))); + +#define VSCATTER_16 (BASE ,RGN ,OFF ,VALS ) \ + __builtin_HEXAGON_V6_vscattermh_128B((int)BASE, RGN, OFF, VALS) +#define VSCATTER_16_MASKED (MASK ,BASE ,RGN ,OFF ,VALS ) \ + __builtin_HEXAGON_V6_vscattermhq_128B(MASK, (int)BASE, RGN, OFF, VALS) +#define VSCATTER_32 (BASE ,RGN ,OFF ,VALS ) \ + __builtin_HEXAGON_V6_vscattermw_128B((int)BASE, RGN, OFF, VALS) +#define VSCATTER_32_MASKED (MASK ,BASE ,RGN ,OFF ,VALS ) \ + __builtin_HEXAGON_V6_vscattermwq_128B(MASK, (int)BASE, RGN, OFF, VALS) +#define VSCATTER_16_32 (BASE ,RGN ,OFF ,VALS ) \ + __builtin_HEXAGON_V6_vscattermhw_128B((int)BASE, RGN, OFF, VALS) +#define VSCATTER_16_32_MASKED (MASK ,BASE ,RGN ,OFF ,VALS ) \ + __builtin_HEXAGON_V6_vscattermhwq_128B(MASK, (int)BASE, RGN, OFF, VALS) +#define VSCATTER_16_ACC (BASE ,RGN ,OFF ,VALS ) \ + __builtin_HEXAGON_V6_vscattermh_add_128B((int)BASE, RGN, OFF, VALS) +#define VSCATTER_32_ACC (BASE ,RGN ,OFF ,VALS ) \ + __builtin_HEXAGON_V6_vscattermw_add_128B((int)BASE, RGN, OFF, VALS) +#define VSCATTER_16_32_ACC (BASE ,RGN ,OFF ,VALS ) \ + __builtin_HEXAGON_V6_vscattermhw_add_128B((int)BASE, RGN, OFF, VALS) + +#define VGATHER_16 (DSTADDR ,BASE ,RGN ,OFF ) \ + __builtin_HEXAGON_V6_vgathermh_128B(DSTADDR, (int)BASE, RGN, OFF) +#define VGATHER_16_MASKED (DSTADDR ,MASK ,BASE ,RGN ,OFF ) \ + __builtin_HEXAGON_V6_vgathermhq_128B(DSTADDR, MASK, (int)BASE, RGN, OFF) +#define VGATHER_32 (DSTADDR ,BASE ,RGN ,OFF ) \ + __builtin_HEXAGON_V6_vgathermw_128B(DSTADDR, (int)BASE, RGN, OFF) +#define VGATHER_32_MASKED (DSTADDR ,MASK ,BASE ,RGN ,OFF ) \ + __builtin_HEXAGON_V6_vgathermwq_128B(DSTADDR, MASK, (int)BASE, RGN, OFF) +#define VGATHER_16_32 (DSTADDR ,BASE ,RGN ,OFF ) \ + __builtin_HEXAGON_V6_vgathermhw_128B(DSTADDR, (int)BASE, RGN, OFF) +#define VGATHER_16_32_MASKED (DSTADDR ,MASK ,BASE ,RGN ,OFF ) \ + __builtin_HEXAGON_V6_vgathermhwq_128B(DSTADDR, MASK, (int)BASE, RGN, OFF) + +#define VSHUFF_H (V ) \ + __builtin_HEXAGON_V6_vshuffh_128B(V) +#define VSPLAT_H (X ) \ + __builtin_HEXAGON_V6_lvsplath_128B(X) +#define VAND_VAL (PRED ,VAL ) \ + __builtin_HEXAGON_V6_vandvrt_128B(PRED, VAL) +#define VDEAL_H (V ) \ + __builtin_HEXAGON_V6_vdealh_128B(V) + +int err; + +/* define the number of rows/cols in a square matrix */ +#define MATRIX_SIZE 64 + +/* define the size of the scatter buffer */ +#define SCATTER_BUFFER_SIZE (MATRIX_SIZE * MATRIX_SIZE) + +/* fake vtcm - put buffers together and force alignment */ +static struct { +unsigned short vscatter16[SCATTER_BUFFER_SIZE ]; +unsigned short vgather16[MATRIX_SIZE ]; +unsigned int vscatter32[SCATTER_BUFFER_SIZE ]; +unsigned int vgather32[MATRIX_SIZE ]; +unsigned short vscatter16_32[SCATTER_BUFFER_SIZE ]; +unsigned short vgather16_32[MATRIX_SIZE ]; +} vtcm __attribute__((aligned(0x10000))); + +/* declare the arrays of reference values */ +unsigned short vscatter16_ref[SCATTER_BUFFER_SIZE ]; +unsigned short vgather16_ref[MATRIX_SIZE ]; +unsigned int vscatter32_ref[SCATTER_BUFFER_SIZE ]; +unsigned int vgather32_ref[MATRIX_SIZE ]; +unsigned short vscatter16_32_ref[SCATTER_BUFFER_SIZE ]; +unsigned short vgather16_32_ref[MATRIX_SIZE ]; + +/* declare the arrays of offsets */ +unsigned short half_offsets[MATRIX_SIZE ]; +unsigned int word_offsets[MATRIX_SIZE ]; + +/* declare the arrays of values */ +unsigned short half_values[MATRIX_SIZE ]; +unsigned short half_values_acc[MATRIX_SIZE ]; +unsigned short half_values_masked[MATRIX_SIZE ]; +unsigned int word_values[MATRIX_SIZE ]; +unsigned int word_values_acc[MATRIX_SIZE ]; +unsigned int word_values_masked[MATRIX_SIZE ]; + +/* declare the arrays of predicates */ +unsigned short half_predicates[MATRIX_SIZE ]; +unsigned int word_predicates[MATRIX_SIZE ]; + +/* make this big enough for all the intrinsics */ +const size_t region_len =sizeof (vtcm); + +/* optionally add sync instructions */ +#define SYNC_VECTOR 1 + +static void sync_scatter (void *addr) +{ +#if SYNC_VECTOR +/* +* Do the scatter release followed by a dummy load to complete the +* synchronization. Normally the dummy load would be deferred as +* long as possible to minimize stalls. +*/ + asmvolatile ("vmem(%0 + #0):scatter_release\n" : :"r" (addr)); +/* use volatile to force the load */ +volatile HVX_Vector vDummy = *(HVX_Vector *)addr; vDummy = vDummy; +#endif +} + +static void sync_gather (void *addr) +{ +#if SYNC_VECTOR +/* use volatile to force the load */ +volatile HVX_Vector vDummy = *(HVX_Vector *)addr; vDummy = vDummy; +#endif +} + +/* optionally print the results */ +#define PRINT_DATA 0 + +#define FILL_CHAR '.' + +/* fill vtcm scratch with ee */ +void prefill_vtcm_scratch (void ) +{ +memset (&vtcm,FILL_CHAR ,sizeof (vtcm)); +} + +/* create byte offsets to be a diagonal of the matrix with 16 bit elements */ +void create_offsets_values_preds_16 (void ) +{ +unsigned short half_element =0 ; +unsigned short half_element_masked =0 ; +char letter ='A' ; +char letter_masked ='@' ; + +for (int i =0 ; i <MATRIX_SIZE ; i++) { + half_offsets[i] = i * (2 *MATRIX_SIZE +2 ); + + half_element =0 ; + half_element_masked =0 ; +for (int j =0 ; j <2 ; j++) { + half_element |= letter << j *8 ; + half_element_masked |= letter_masked << j *8 ; + } + + half_values[i] = half_element; + half_values_acc[i] = ((i %10 ) <<8 ) + (i %10 ); + half_values_masked[i] = half_element_masked; + + letter++; +/* reset to 'A' */ +if (letter =='M' ) { + letter ='A' ; + } + + half_predicates[i] = (i %3 ==0 || i %5 ==0 ) ? ~0 :0 ; + } +} + +/* create byte offsets to be a diagonal of the matrix with 32 bit elements */ +void create_offsets_values_preds_32 (void ) +{ +unsigned int word_element =0 ; +unsigned int word_element_masked =0 ; +char letter ='A' ; +char letter_masked ='&' ; + +for (int i =0 ; i <MATRIX_SIZE ; i++) { + word_offsets[i] = i * (4 *MATRIX_SIZE +4 ); + + word_element =0 ; + word_element_masked =0 ; +for (int j =0 ; j <4 ; j++) { + word_element |= letter << j *8 ; + word_element_masked |= letter_masked << j *8 ; + } + + word_values[i] = word_element; + word_values_acc[i] = ((i %10 ) <<8 ) + (i %10 ); + word_values_masked[i] = word_element_masked; + + letter++; +/* reset to 'A' */ +if (letter =='M' ) { + letter ='A' ; + } + + word_predicates[i] = (i %4 ==0 || i %7 ==0 ) ? ~0 :0 ; + } +} + +/* +* create byte offsets to be a diagonal of the matrix with 16 bit elements +* and 32 bit offsets +*/ +void create_offsets_values_preds_16_32 (void ) +{ +unsigned short half_element =0 ; +unsigned short half_element_masked =0 ; +char letter ='D' ; +char letter_masked ='$' ; + +for (int i =0 ; i <MATRIX_SIZE ; i++) { + word_offsets[i] = i * (2 *MATRIX_SIZE +2 ); + + half_element =0 ; + half_element_masked =0 ; +for (int j =0 ; j <2 ; j++) { + half_element |= letter << j *8 ; + half_element_masked |= letter_masked << j *8 ; + } + + half_values[i] = half_element; + half_values_acc[i] = ((i %10 ) <<8 ) + (i %10 ); + half_values_masked[i] = half_element_masked; + + letter++; +/* reset to 'A' */ +if (letter =='P' ) { + letter ='D' ; + } + + half_predicates[i] = (i %2 ==0 || i %13 ==0 ) ? ~0 :0 ; + } +} + +/* scatter the 16 bit elements using intrinsics */ +void vector_scatter_16 (void ) +{ +/* copy the offsets and values to vectors */ +HVX_Vector offsets = *(HVX_Vector *)half_offsets; +HVX_Vector values = *(HVX_Vector *)half_values; + +VSCATTER_16 (&vtcm.vscatter16, region_len, offsets, values); + +sync_scatter (vtcm.vscatter16); +} + +/* scatter-accumulate the 16 bit elements using intrinsics */ +void vector_scatter_16_acc (void ) +{ +/* copy the offsets and values to vectors */ +HVX_Vector offsets = *(HVX_Vector *)half_offsets; +HVX_Vector values = *(HVX_Vector *)half_values_acc; + +VSCATTER_16_ACC (&vtcm.vscatter16, region_len, offsets, values); + +sync_scatter (vtcm.vscatter16); +} + +/* scatter the 16 bit elements using intrinsics */ +void vector_scatter_16_masked (void ) +{ +/* copy the offsets and values to vectors */ +HVX_Vector offsets = *(HVX_Vector *)half_offsets; +HVX_Vector values = *(HVX_Vector *)half_values_masked; +HVX_Vector pred_reg = *(HVX_Vector *)half_predicates; +HVX_VectorPred preds =VAND_VAL (pred_reg, ~0 ); + +VSCATTER_16_MASKED (preds, &vtcm.vscatter16, region_len, offsets, values); + +sync_scatter (vtcm.vscatter16); +} + +/* scatter the 32 bit elements using intrinsics */ +void vector_scatter_32 (void ) +{ +/* copy the offsets and values to vectors */ +HVX_Vector offsetslo = *(HVX_Vector *)word_offsets; +HVX_Vector offsetshi = *(HVX_Vector *)&word_offsets[MATRIX_SIZE /2 ]; +HVX_Vector valueslo = *(HVX_Vector *)word_values; +HVX_Vector valueshi = *(HVX_Vector *)&word_values[MATRIX_SIZE /2 ]; + +VSCATTER_32 (&vtcm.vscatter32, region_len, offsetslo, valueslo); +VSCATTER_32 (&vtcm.vscatter32, region_len, offsetshi, valueshi); + +sync_scatter (vtcm.vscatter32); +} + +/* scatter-acc the 32 bit elements using intrinsics */ +void vector_scatter_32_acc (void ) +{ +/* copy the offsets and values to vectors */ +HVX_Vector offsetslo = *(HVX_Vector *)word_offsets; +HVX_Vector offsetshi = *(HVX_Vector *)&word_offsets[MATRIX_SIZE /2 ]; +HVX_Vector valueslo = *(HVX_Vector *)word_values_acc; +HVX_Vector valueshi = *(HVX_Vector *)&word_values_acc[MATRIX_SIZE /2 ]; + +VSCATTER_32_ACC (&vtcm.vscatter32, region_len, offsetslo, valueslo); +VSCATTER_32_ACC (&vtcm.vscatter32, region_len, offsetshi, valueshi); + +sync_scatter (vtcm.vscatter32); +} + +/* scatter the 32 bit elements using intrinsics */ +void vector_scatter_32_masked (void ) +{ +/* copy the offsets and values to vectors */ +HVX_Vector offsetslo = *(HVX_Vector *)word_offsets; +HVX_Vector offsetshi = *(HVX_Vector *)&word_offsets[MATRIX_SIZE /2 ]; +HVX_Vector valueslo = *(HVX_Vector *)word_values_masked; +HVX_Vector valueshi = *(HVX_Vector *)&word_values_masked[MATRIX_SIZE /2 ]; +HVX_Vector pred_reglo = *(HVX_Vector *)word_predicates; +HVX_Vector pred_reghi = *(HVX_Vector *)&word_predicates[MATRIX_SIZE /2 ]; +HVX_VectorPred predslo =VAND_VAL (pred_reglo, ~0 ); +HVX_VectorPred predshi =VAND_VAL (pred_reghi, ~0 ); + +VSCATTER_32_MASKED (predslo, &vtcm.vscatter32, region_len, offsetslo, + valueslo); +VSCATTER_32_MASKED (predshi, &vtcm.vscatter32, region_len, offsetshi, + valueshi); + +sync_scatter (vtcm.vscatter16); +} + +/* scatter the 16 bit elements with 32 bit offsets using intrinsics */ +void vector_scatter_16_32 (void ) +{ +HVX_VectorPair offsets; +HVX_Vector values; + +/* get the word offsets in a vector pair */ + offsets = *(HVX_VectorPair *)word_offsets; + +/* these values need to be shuffled for the scatter */ + values = *(HVX_Vector *)half_values; + values =VSHUFF_H (values); + +VSCATTER_16_32 (&vtcm.vscatter16_32, region_len, offsets, values); + +sync_scatter (vtcm.vscatter16_32); +} + +/* scatter-acc the 16 bit elements with 32 bit offsets using intrinsics */ +void vector_scatter_16_32_acc (void ) +{ +HVX_VectorPair offsets; +HVX_Vector values; + +/* get the word offsets in a vector pair */ + offsets = *(HVX_VectorPair *)word_offsets; + +/* these values need to be shuffled for the scatter */ + values = *(HVX_Vector *)half_values_acc; + values =VSHUFF_H (values); + +VSCATTER_16_32_ACC (&vtcm.vscatter16_32, region_len, offsets, values); + +sync_scatter (vtcm.vscatter16_32); +} + +/* masked scatter the 16 bit elements with 32 bit offsets using intrinsics */ +void vector_scatter_16_32_masked (void ) +{ +HVX_VectorPair offsets; +HVX_Vector values; +HVX_Vector pred_reg; + +/* get the word offsets in a vector pair */ + offsets = *(HVX_VectorPair *)word_offsets; + +/* these values need to be shuffled for the scatter */ + values = *(HVX_Vector *)half_values_masked; + values =VSHUFF_H (values); + + pred_reg = *(HVX_Vector *)half_predicates; + pred_reg =VSHUFF_H (pred_reg); +HVX_VectorPred preds =VAND_VAL (pred_reg, ~0 ); + +VSCATTER_16_32_MASKED (preds, &vtcm.vscatter16_32, region_len, offsets, + values); + +sync_scatter (vtcm.vscatter16_32); +} + +/* gather the elements from the scatter16 buffer */ +void vector_gather_16 (void ) +{ +HVX_Vector *vgather = (HVX_Vector *)&vtcm.vgather16; +HVX_Vector offsets = *(HVX_Vector *)half_offsets; + +VGATHER_16 (vgather, &vtcm.vscatter16, region_len, offsets); + +sync_gather (vgather); +} + +static unsigned short gather_16_masked_init (void ) +{ +char letter ='?' ; +return letter | (letter <<8 ); +} + +void vector_gather_16_masked (void ) +{ +HVX_Vector *vgather = (HVX_Vector *)&vtcm.vgather16; +HVX_Vector offsets = *(HVX_Vector *)half_offsets; +HVX_Vector pred_reg = *(HVX_Vector *)half_predicates; +HVX_VectorPred preds =VAND_VAL (pred_reg, ~0 ); + + *vgather =VSPLAT_H (gather_16_masked_init ()); +VGATHER_16_MASKED (vgather, preds, &vtcm.vscatter16, region_len, offsets); + +sync_gather (vgather); +} + +/* gather the elements from the scatter32 buffer */ +void vector_gather_32 (void ) +{ +HVX_Vector *vgatherlo = (HVX_Vector *)&vtcm.vgather32; +HVX_Vector *vgatherhi = + (HVX_Vector *)((int )&vtcm.vgather32 + (MATRIX_SIZE *2 )); +HVX_Vector offsetslo = *(HVX_Vector *)word_offsets; +HVX_Vector offsetshi = *(HVX_Vector *)&word_offsets[MATRIX_SIZE /2 ]; + +VGATHER_32 (vgatherlo, &vtcm.vscatter32, region_len, offsetslo); +VGATHER_32 (vgatherhi, &vtcm.vscatter32, region_len, offsetshi); + +sync_gather (vgatherhi); +} + +static unsigned int gather_32_masked_init (void ) +{ +char letter ='?' ; +return letter | (letter <<8 ) | (letter <<16 ) | (letter <<24 ); +} + +void vector_gather_32_masked (void ) +{ +HVX_Vector *vgatherlo = (HVX_Vector *)&vtcm.vgather32; +HVX_Vector *vgatherhi = + (HVX_Vector *)((int )&vtcm.vgather32 + (MATRIX_SIZE *2 )); +HVX_Vector offsetslo = *(HVX_Vector *)word_offsets; +HVX_Vector offsetshi = *(HVX_Vector *)&word_offsets[MATRIX_SIZE /2 ]; +HVX_Vector pred_reglo = *(HVX_Vector *)word_predicates; +HVX_VectorPred predslo =VAND_VAL (pred_reglo, ~0 ); +HVX_Vector pred_reghi = *(HVX_Vector *)&word_predicates[MATRIX_SIZE /2 ]; +HVX_VectorPred predshi =VAND_VAL (pred_reghi, ~0 ); + + *vgatherlo =VSPLAT_H (gather_32_masked_init ()); + *vgatherhi =VSPLAT_H (gather_32_masked_init ()); +VGATHER_32_MASKED (vgatherlo, predslo, &vtcm.vscatter32, region_len, + offsetslo); +VGATHER_32_MASKED (vgatherhi, predshi, &vtcm.vscatter32, region_len, + offsetshi); + +sync_gather (vgatherlo); +sync_gather (vgatherhi); +} + +/* gather the elements from the scatter16_32 buffer */ +void vector_gather_16_32 (void ) +{ +HVX_Vector *vgather; +HVX_VectorPair offsets; +HVX_Vector values; + +/* get the vtcm address to gather from */ + vgather = (HVX_Vector *)&vtcm.vgather16_32; + +/* get the word offsets in a vector pair */ + offsets = *(HVX_VectorPair *)word_offsets; + +VGATHER_16_32 (vgather, &vtcm.vscatter16_32, region_len, offsets); + +/* deal the elements to get the order back */ + values = *(HVX_Vector *)vgather; + values =VDEAL_H (values); + +/* write it back to vtcm address */ + *(HVX_Vector *)vgather = values; +} + +void vector_gather_16_32_masked (void ) +{ +HVX_Vector *vgather; +HVX_VectorPair offsets; +HVX_Vector pred_reg; +HVX_VectorPred preds; +HVX_Vector values; + +/* get the vtcm address to gather from */ + vgather = (HVX_Vector *)&vtcm.vgather16_32; + +/* get the word offsets in a vector pair */ + offsets = *(HVX_VectorPair *)word_offsets; + pred_reg = *(HVX_Vector *)half_predicates; + pred_reg =VSHUFF_H (pred_reg); + preds =VAND_VAL (pred_reg, ~0 ); + + *vgather =VSPLAT_H (gather_16_masked_init ()); +VGATHER_16_32_MASKED (vgather, preds, &vtcm.vscatter16_32, region_len, + offsets); + +/* deal the elements to get the order back */ + values = *(HVX_Vector *)vgather; + values =VDEAL_H (values); + +/* write it back to vtcm address */ + *(HVX_Vector *)vgather = values; +} + +static void check_buffer (const char *name,void *c,void *r,size_t size) +{ +char *check = (char *)c; +char *ref = (char *)r; +for (int i =0 ; i < size; i++) { +if (check[i] != ref[i]) { +printf ("ERROR %s [%d]: 0x%x (%c) != 0x%x (%c)\n" , name, i, + check[i], check[i], ref[i], ref[i]); + err++; + } + } +} + +/* +* These scalar functions are the C equivalents of the vector functions that +* use HVX +*/ + +/* scatter the 16 bit elements using C */ +void scalar_scatter_16 (unsigned short *vscatter16) +{ +for (int i =0 ; i <MATRIX_SIZE ; ++i) { + vscatter16[half_offsets[i] /2 ] = half_values[i]; + } +} + +void check_scatter_16 () +{ +memset (vscatter16_ref,FILL_CHAR , +SCATTER_BUFFER_SIZE *sizeof (unsigned short )); +scalar_scatter_16 (vscatter16_ref); +check_buffer (__func__, vtcm.vscatter16, vscatter16_ref, +SCATTER_BUFFER_SIZE *sizeof (unsigned short )); +} + +/* scatter the 16 bit elements using C */ +void scalar_scatter_16_acc (unsigned short *vscatter16) +{ +for (int i =0 ; i <MATRIX_SIZE ; ++i) { + vscatter16[half_offsets[i] /2 ] += half_values_acc[i]; + } +} + +void check_scatter_16_acc () +{ +memset (vscatter16_ref,FILL_CHAR , +SCATTER_BUFFER_SIZE *sizeof (unsigned short )); +scalar_scatter_16 (vscatter16_ref); +scalar_scatter_16_acc (vscatter16_ref); +check_buffer (__func__, vtcm.vscatter16, vscatter16_ref, +SCATTER_BUFFER_SIZE *sizeof (unsigned short )); +} + +/* scatter the 16 bit elements using C */ +void scalar_scatter_16_masked (unsigned short *vscatter16) +{ +for (int i =0 ; i <MATRIX_SIZE ; i++) { +if (half_predicates[i]) { + vscatter16[half_offsets[i] /2 ] = half_values_masked[i]; + } + } + +} + +void check_scatter_16_masked () +{ +memset (vscatter16_ref,FILL_CHAR , +SCATTER_BUFFER_SIZE *sizeof (unsigned short )); +scalar_scatter_16 (vscatter16_ref); +scalar_scatter_16_acc (vscatter16_ref); +scalar_scatter_16_masked (vscatter16_ref); +check_buffer (__func__, vtcm.vscatter16, vscatter16_ref, +SCATTER_BUFFER_SIZE *sizeof (unsigned short )); +} + +/* scatter the 32 bit elements using C */ +void scalar_scatter_32 (unsigned int *vscatter32) +{ +for (int i =0 ; i <MATRIX_SIZE ; ++i) { + vscatter32[word_offsets[i] /4 ] = word_values[i]; + } +} + +void check_scatter_32 () +{ +memset (vscatter32_ref,FILL_CHAR , +SCATTER_BUFFER_SIZE *sizeof (unsigned int )); +scalar_scatter_32 (vscatter32_ref); +check_buffer (__func__, vtcm.vscatter32, vscatter32_ref, +SCATTER_BUFFER_SIZE *sizeof (unsigned int )); +} + +/* scatter the 32 bit elements using C */ +void scalar_scatter_32_acc (unsigned int *vscatter32) +{ +for (int i =0 ; i <MATRIX_SIZE ; ++i) { + vscatter32[word_offsets[i] /4 ] += word_values_acc[i]; + } +} + +void check_scatter_32_acc () +{ +memset (vscatter32_ref,FILL_CHAR , +SCATTER_BUFFER_SIZE *sizeof (unsigned int )); +scalar_scatter_32 (vscatter32_ref); +scalar_scatter_32_acc (vscatter32_ref); +check_buffer (__func__, vtcm.vscatter32, vscatter32_ref, +SCATTER_BUFFER_SIZE *sizeof (unsigned int )); +} + +/* scatter the 32 bit elements using C */ +void scalar_scatter_32_masked (unsigned int *vscatter32) +{ +for (int i =0 ; i <MATRIX_SIZE ; i++) { +if (word_predicates[i]) { + vscatter32[word_offsets[i] /4 ] = word_values_masked[i]; + } + } +} + +void check_scatter_32_masked () +{ +memset (vscatter32_ref,FILL_CHAR , +SCATTER_BUFFER_SIZE *sizeof (unsigned int )); +scalar_scatter_32 (vscatter32_ref); +scalar_scatter_32_acc (vscatter32_ref); +scalar_scatter_32_masked (vscatter32_ref); +check_buffer (__func__, vtcm.vscatter32, vscatter32_ref, +SCATTER_BUFFER_SIZE *sizeof (unsigned int )); +} + +/* scatter the 32 bit elements using C */ +void scalar_scatter_16_32 (unsigned short *vscatter16_32) +{ +for (int i =0 ; i <MATRIX_SIZE ; ++i) { + vscatter16_32[word_offsets[i] /2 ] = half_values[i]; + } +} + +void check_scatter_16_32 () +{ +memset (vscatter16_32_ref,FILL_CHAR , +SCATTER_BUFFER_SIZE *sizeof (unsigned short )); +scalar_scatter_16_32 (vscatter16_32_ref); +check_buffer (__func__, vtcm.vscatter16_32, vscatter16_32_ref, +SCATTER_BUFFER_SIZE *sizeof (unsigned short )); +} + +/* scatter the 32 bit elements using C */ +void scalar_scatter_16_32_acc (unsigned short *vscatter16_32) +{ +for (int i =0 ; i <MATRIX_SIZE ; ++i) { + vscatter16_32[word_offsets[i] /2 ] += half_values_acc[i]; + } +} + +void check_scatter_16_32_acc () +{ +memset (vscatter16_32_ref,FILL_CHAR , +SCATTER_BUFFER_SIZE *sizeof (unsigned short )); +scalar_scatter_16_32 (vscatter16_32_ref); +scalar_scatter_16_32_acc (vscatter16_32_ref); +check_buffer (__func__, vtcm.vscatter16_32, vscatter16_32_ref, +SCATTER_BUFFER_SIZE *sizeof (unsigned short )); +} + +void scalar_scatter_16_32_masked (unsigned short *vscatter16_32) +{ +for (int i =0 ; i <MATRIX_SIZE ; i++) { +if (half_predicates[i]) { + vscatter16_32[word_offsets[i] /2 ] = half_values_masked[i]; + } + } +} + +void check_scatter_16_32_masked () +{ +memset (vscatter16_32_ref,FILL_CHAR , +SCATTER_BUFFER_SIZE *sizeof (unsigned short )); +scalar_scatter_16_32 (vscatter16_32_ref); +scalar_scatter_16_32_acc (vscatter16_32_ref); +scalar_scatter_16_32_masked (vscatter16_32_ref); +check_buffer (__func__, vtcm.vscatter16_32, vscatter16_32_ref, +SCATTER_BUFFER_SIZE *sizeof (unsigned short )); +} + +/* gather the elements from the scatter buffer using C */ +void scalar_gather_16 (unsigned short *vgather16) +{ +for (int i =0 ; i <MATRIX_SIZE ; ++i) { + vgather16[i] = vtcm.vscatter16[half_offsets[i] /2 ]; + } +} + +void check_gather_16 () +{ +memset (vgather16_ref,0 ,MATRIX_SIZE *sizeof (unsigned short )); +scalar_gather_16 (vgather16_ref); +check_buffer (__func__, vtcm.vgather16, vgather16_ref, +MATRIX_SIZE *sizeof (unsigned short )); +} + +void scalar_gather_16_masked (unsigned short *vgather16) +{ +for (int i =0 ; i <MATRIX_SIZE ; ++i) { +if (half_predicates[i]) { + vgather16[i] = vtcm.vscatter16[half_offsets[i] /2 ]; + } + } +} + +void check_gather_16_masked () +{ +memset (vgather16_ref,gather_16_masked_init (), +MATRIX_SIZE *sizeof (unsigned short )); +scalar_gather_16_masked (vgather16_ref); +check_buffer (__func__, vtcm.vgather16, vgather16_ref, +MATRIX_SIZE *sizeof (unsigned short )); +} + +/* gather the elements from the scatter buffer using C */ +void scalar_gather_32 (unsigned int *vgather32) +{ +for (int i =0 ; i <MATRIX_SIZE ; ++i) { + vgather32[i] = vtcm.vscatter32[word_offsets[i] /4 ]; + } +} + +void check_gather_32 (void ) +{ +memset (vgather32_ref,0 ,MATRIX_SIZE *sizeof (unsigned int )); +scalar_gather_32 (vgather32_ref); +check_buffer (__func__, vtcm.vgather32, vgather32_ref, +MATRIX_SIZE *sizeof (unsigned int )); +} + +void scalar_gather_32_masked (unsigned int *vgather32) +{ +for (int i =0 ; i <MATRIX_SIZE ; ++i) { +if (word_predicates[i]) { + vgather32[i] = vtcm.vscatter32[word_offsets[i] /4 ]; + } + } +} + + +void check_gather_32_masked (void ) +{ +memset (vgather32_ref,gather_32_masked_init (), +MATRIX_SIZE *sizeof (unsigned int )); +scalar_gather_32_masked (vgather32_ref); +check_buffer (__func__, vtcm.vgather32, + vgather32_ref,MATRIX_SIZE *sizeof (unsigned int )); +} + +/* gather the elements from the scatter buffer using C */ +void scalar_gather_16_32 (unsigned short *vgather16_32) +{ +for (int i =0 ; i <MATRIX_SIZE ; ++i) { + vgather16_32[i] = vtcm.vscatter16_32[word_offsets[i] /2 ]; + } +} + +void check_gather_16_32 (void ) +{ +memset (vgather16_32_ref,0 ,MATRIX_SIZE *sizeof (unsigned short )); +scalar_gather_16_32 (vgather16_32_ref); +check_buffer (__func__, vtcm.vgather16_32, vgather16_32_ref, +MATRIX_SIZE *sizeof (unsigned short )); +} + +void scalar_gather_16_32_masked (unsigned short *vgather16_32) +{ +for (int i =0 ; i <MATRIX_SIZE ; ++i) { +if (half_predicates[i]) { + vgather16_32[i] = vtcm.vscatter16_32[word_offsets[i] /2 ]; + } + } + +} + +void check_gather_16_32_masked (void ) +{ +memset (vgather16_32_ref,gather_16_masked_init (), +MATRIX_SIZE *sizeof (unsigned short )); +scalar_gather_16_32_masked (vgather16_32_ref); +check_buffer (__func__, vtcm.vgather16_32, vgather16_32_ref, +MATRIX_SIZE *sizeof (unsigned short )); +} + +/* print scatter16 buffer */ +void print_scatter16_buffer (void ) +{ +if (PRINT_DATA ) { +printf ("\n\nPrinting the 16 bit scatter buffer" ); + +for (int i =0 ; i <SCATTER_BUFFER_SIZE ; i++) { +if ((i %MATRIX_SIZE ) ==0 ) { +printf ("\n" ); + } +for (int j =0 ; j <2 ; j++) { +printf ("%c" , (char )((vtcm.vscatter16[i] >> j *8 ) &0xff )); + } +printf (" " ); + } +printf ("\n" ); + } +} + +/* print the gather 16 buffer */ +void print_gather_result_16 (void ) +{ +if (PRINT_DATA ) { +printf ("\n\nPrinting the 16 bit gather result\n" ); + +for (int i =0 ; i <MATRIX_SIZE ; i++) { +for (int j =0 ; j <2 ; j++) { +printf ("%c" , (char )((vtcm.vgather16[i] >> j *8 ) &0xff )); + } +printf (" " ); + } +printf ("\n" ); + } +} + +/* print the scatter32 buffer */ +void print_scatter32_buffer (void ) +{ +if (PRINT_DATA ) { +printf ("\n\nPrinting the 32 bit scatter buffer" ); + +for (int i =0 ; i <SCATTER_BUFFER_SIZE ; i++) { +if ((i %MATRIX_SIZE ) ==0 ) { +printf ("\n" ); + } +for (int j =0 ; j <4 ; j++) { +printf ("%c" , (char )((vtcm.vscatter32[i] >> j *8 ) &0xff )); + } +printf (" " ); + } +printf ("\n" ); + } +} + +/* print the gather 32 buffer */ +void print_gather_result_32 (void ) +{ +if (PRINT_DATA ) { +printf ("\n\nPrinting the 32 bit gather result\n" ); + +for (int i =0 ; i <MATRIX_SIZE ; i++) { +for (int j =0 ; j <4 ; j++) { +printf ("%c" , (char )((vtcm.vgather32[i] >> j *8 ) &0xff )); + } +printf (" " ); + } +printf ("\n" ); + } +} + +/* print the scatter16_32 buffer */ +void print_scatter16_32_buffer (void ) +{ +if (PRINT_DATA ) { +printf ("\n\nPrinting the 16_32 bit scatter buffer" ); + +for (int i =0 ; i <SCATTER_BUFFER_SIZE ; i++) { +if ((i %MATRIX_SIZE ) ==0 ) { +printf ("\n" ); + } +for (int j =0 ; j <2 ; j++) { +printf ("%c" , + (unsigned char )((vtcm.vscatter16_32[i] >> j *8 ) &0xff )); + } +printf (" " ); + } +printf ("\n" ); + } +} + +/* print the gather 16_32 buffer */ +void print_gather_result_16_32 (void ) +{ +if (PRINT_DATA ) { +printf ("\n\nPrinting the 16_32 bit gather result\n" ); + +for (int i =0 ; i <MATRIX_SIZE ; i++) { +for (int j =0 ; j <2 ; j++) { +printf ("%c" , + (unsigned char )((vtcm.vgather16_32[i] >> j *8 ) &0xff )); + } +printf (" " ); + } +printf ("\n" ); + } +} + +int main () +{ +prefill_vtcm_scratch (); + +/* 16 bit elements with 16 bit offsets */ +create_offsets_values_preds_16 (); + +vector_scatter_16 (); +print_scatter16_buffer (); +check_scatter_16 (); + +vector_gather_16 (); +print_gather_result_16 (); +check_gather_16 (); + +vector_gather_16_masked (); +print_gather_result_16 (); +check_gather_16_masked (); + +vector_scatter_16_acc (); +print_scatter16_buffer (); +check_scatter_16_acc (); + +vector_scatter_16_masked (); +print_scatter16_buffer (); +check_scatter_16_masked (); + +/* 32 bit elements with 32 bit offsets */ +create_offsets_values_preds_32 (); + +vector_scatter_32 (); +print_scatter32_buffer (); +check_scatter_32 (); + +vector_gather_32 (); +print_gather_result_32 (); +check_gather_32 (); + +vector_gather_32_masked (); +print_gather_result_32 (); +check_gather_32_masked (); + +vector_scatter_32_acc (); +print_scatter32_buffer (); +check_scatter_32_acc (); + +vector_scatter_32_masked (); +print_scatter32_buffer (); +check_scatter_32_masked (); + +/* 16 bit elements with 32 bit offsets */ +create_offsets_values_preds_16_32 (); + +vector_scatter_16_32 (); +print_scatter16_32_buffer (); +check_scatter_16_32 (); + +vector_gather_16_32 (); +print_gather_result_16_32 (); +check_gather_16_32 (); + +vector_gather_16_32_masked (); +print_gather_result_16_32 (); +check_gather_16_32_masked (); + +vector_scatter_16_32_acc (); +print_scatter16_32_buffer (); +check_scatter_16_32_acc (); + +vector_scatter_16_32_masked (); +print_scatter16_32_buffer (); +check_scatter_16_32_masked (); + +puts (err ?"FAIL" :"PASS" ); +return err; +}
tests/tcg/hexagon/Makefile.target +2 -0
@@ -39,11 +39,13 @@ HEX_TESTS += brev HEX_TESTS += load_unpack HEX_TESTS += load_align HEX_TESTS += vector_add_int +HEX_TESTS += scatter_gather HEX_TESTS += atomics HEX_TESTS += fpstuff HEX_TESTS += hvx_misc TESTS += $(HEX_TESTS) +scatter_gather: CFLAGS += -mhvx vector_add_int: CFLAGS += -mhvx -fvectorize hvx_misc: CFLAGS += -mhvx
Signature · 1 line
2.7.4
Re: [PATCH v4 29/30] Hexagon HVX (tests/tcg/hexagon) scatter_gather test
Quoted 6 lines · Taylor Simpson
Signed-off-by Taylor Simpson<[email protected]>--- tests/tcg/hexagon/scatter_gather.c | 1011 ++++++++++++++++++++++++++++++++++++ tests/tcg/hexagon/Makefile.target | 2 + 2 files changed, 1013 insertions(+)create mode 100644
tests/tcg/hexagon/scatter_gather.c
r~
PATCH v4 30/30 Hexagon HVX (tests/tcg/hexagon) histogram test
In reply to Taylor Simpson--- tests/tcg/hexagon/hvx_histogram_input.h | 717 ++++++++++++++++++++++++++++++++ tests/tcg/hexagon/hvx_histogram_row.h | 24 ++ tests/tcg/hexagon/hvx_histogram.c | 88 ++++ tests/tcg/hexagon/Makefile.target | 5 + tests/tcg/hexagon/hvx_histogram_row.S | 294 +++++++++++++ 5 files changed, 1128 insertions(+) create mode 100644 tests/tcg/hexagon/hvx_histogram_input.h create mode 100644 tests/tcg/hexagon/hvx_histogram_row.h create mode 100644 tests/tcg/hexagon/hvx_histogram.c create mode 100644 tests/tcg/hexagon/hvx_histogram_row.S
tests/tcg/hexagon/hvx_histogram_input.h new file +717 -0
@@ -0,0 +1,717 @@ +/* +* Copyright(c) 2021 Qualcomm Innovation Center, Inc. All Rights Reserved. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ + + {0x26 ,0x32 ,0x2e ,0x2e ,0x2d ,0x2c ,0x2d ,0x2d , +0x2c ,0x2e ,0x31 ,0x33 ,0x36 ,0x39 ,0x3b ,0x3f , +0x42 ,0x46 ,0x4a ,0x4c ,0x51 ,0x53 ,0x53 ,0x54 , +0x56 ,0x57 ,0x58 ,0x57 ,0x56 ,0x52 ,0x51 ,0x4f , +0x4c ,0x49 ,0x47 ,0x42 ,0x3e ,0x3b ,0x38 ,0x35 , +0x33 ,0x30 ,0x2e ,0x2c ,0x2b ,0x2a ,0x2a ,0x28 , +0x28 ,0x27 ,0x27 ,0x28 ,0x29 ,0x2a ,0x2c ,0x2e , +0x2f ,0x33 ,0x36 ,0x38 ,0x3c ,0x3d ,0x40 ,0x42 , +0x43 ,0x42 ,0x43 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66 ,0x66 ,0x66 ,0x65 ,0x64 ,0x63 ,0x61 ,0x62 , +0x60 ,0x60 ,0x5f ,0x5e ,0x5e ,0x5f ,0x60 ,0x62 , +0x65 ,0x67 ,0x69 ,0x6a ,0x69 ,0x68 ,0x69 ,0x67 , +0x66 ,0x64 ,0x62 ,0x5f ,0x5c ,0x58 ,0x54 ,0x51 , +0x4e ,0x4b ,0x49 ,0x45 ,0x43 ,0x41 ,0x40 ,0x3e , +0x3c ,0x3a ,0x3b ,0x3b ,0x3c ,0x3d ,0x3e ,0x3f , +0x41 ,0x42 ,0x44 ,0x46 ,0x46 ,0x48 ,0x49 ,0x4b , +0x4d ,0x50 ,0x51 ,0x53 ,0x55 ,0x57 ,0x58 ,0x5c , +0x5f ,0x60 ,0x63 ,0x64 ,0x64 ,0x65 ,0x66 ,0x66 , +0x66 ,0x65 ,0x65 ,0x63 ,0x61 ,0x5f ,0x5e ,0x5c , +0x5a ,0x58 ,0x56 ,0x55 ,0x54 ,0x53 ,0x52 ,0x52 , +0x53 ,0x52 ,0x52 ,0x52 ,0x52 ,0x53 ,0x53 ,0x53 , +0x54 ,0x53 ,0x53 ,0x52 ,0x53 ,0x51 ,0x53 ,0x53 , +0x55 ,0x57 ,0x58 ,0x59 ,0x5b ,0x5d ,0x62 ,0x64 , +0x68 ,0x6a ,0x6c ,0x6b ,0x69 ,0x68 ,0x67 ,0x64 , +0x61 ,0x5d ,0x57 ,0x54 ,0x50 ,0x4a ,0x48 ,0x47 , + 0x46, 0x45, 0x45, },
tests/tcg/hexagon/hvx_histogram_row.h new file +24 -0
@@ -0,0 +1,24 @@ +/* +* Copyright(c) 2021 Qualcomm Innovation Center, Inc. All Rights Reserved. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef HVX_HISTOGRAM_ROW_H +#define HVX_HISTOGRAM_ROW_H + +void hvx_histogram_row (uint8_t *src,int stride,int width,int height, +int *hist); + +#endif
tests/tcg/hexagon/hvx_histogram.c new file +88 -0
88 lines not on this page · raw message
tests/tcg/hexagon/Makefile.target +5 -0
@@ -43,9 +43,14 @@ HEX_TESTS += scatter_gather HEX_TESTS += atomics HEX_TESTS += fpstuff HEX_TESTS += hvx_misc +HEX_TESTS += hvx_histogram TESTS += $(HEX_TESTS) scatter_gather: CFLAGS += -mhvx vector_add_int: CFLAGS += -mhvx -fvectorize hvx_misc: CFLAGS += -mhvx +hvx_histogram: CFLAGS += -mhvx -Wno-gnu-folding-constant + +hvx_histogram: hvx_histogram.c hvx_histogram_row.S + $(CC) $(CFLAGS) $(CROSS_CC_GUEST_CFLAGS) $^ -o $@
tests/tcg/hexagon/hvx_histogram_row.S new file +294 -0
294 lines not on this page · raw message
Signature · 1 line
2.7.4
Re: [PATCH v4 30/30] Hexagon HVX (tests/tcg/hexagon) histogram test
Quoted 1 line · Taylor Simpson
Signe-off-by Taylor Simpson<[email protected]>
Signed.
Second instance that I've noticed; you might grep for it across your patches, just to be sure.
r~
RE: [PATCH v4 30/30] Hexagon HVX (tests/tcg/hexagon) histogram test
Quoted 10 lines
-----Original Message-----
From: Richard Henderson <[email protected]>
Sent: Friday, October 29, 2021 2:15 PM
To: Taylor Simpson <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; Brian Cain <[email protected]>
Subject: Re: [PATCH v4 30/30] Hexagon HVX (tests/tcg/hexagon) histogram test
Quoted 7 lines
Quoted 1 line · Taylor Simpson
Signe-off-by Taylor Simpson<[email protected]>Signed.
Second instance that I've noticed; you might grep for it across your patches, just to be sure.
I will double-check. Weird this would happen because I always use git commit -s.
Taylor