target/arm: partial vector cleanup
v3 cover target/arm: partial vector cleanup
This is not complete, but shows the direction I'd like to go.
Version 2 extracts more bits from my sve2 branch. There's still more to pull back, especially for crypto_helper.c, where there are also tail clearing bugs to fix.
Version 3 rebases on master, which has some of the arm neon decodetree conversion applied.
r~
Richard Henderson (16):
target/arm: Create gen_gvec_[us]sra
target/arm: Create gen_gvec_{u,s}{rshr,rsra} target/arm: Create gen_gvec_{sri,sli}
target/arm: Remove unnecessary range check for VSHL target/arm: Tidy handle_vec_simd_shri
target/arm: Create gen_gvec_{ceq,clt,cle,cgt,cge}0 target/arm: Create gen_gvec_{mla,mls}
target/arm: Swap argument order for VSHL during decode target/arm: Create gen_gvec_{cmtst,ushl,sshl} target/arm: Create gen_gvec_{uqadd,sqadd,uqsub,sqsub} target/arm: Remove fp_status from helper_{recpe,rsqrte}_u32 target/arm: Create gen_gvec_{qrdmla,qrdmls} target/arm: Pass pointer to qc to qrdmla/qrdmls target/arm: Clear tail in gvec_fmul_idx_*, gvec_fmla_idx_* target/arm: Vectorize SABD/UABD
target/arm: Vectorize SABA/UABA
target/arm/helper.h | 71 +- target/arm/translate.h | 84 +- target/arm/neon-dp.decode | 9 +- target/arm/neon_helper.c | 10 - target/arm/translate-a64.c | 210 +--- target/arm/translate-neon.inc.c | 59 +- target/arm/translate.c | 1908 ++++++++++++++++++++----------- target/arm/vec_helper.c | 233 +++- target/arm/vfp_helper.c | 4 +- 9 files changed, 1667 insertions(+), 921 deletions(-)
Signature · 1 line
2.20.1
PATCH v3 1/16 target/arm: Create gen_gvec_[us]sra
The functions eliminate duplication of the special cases for this operation. They match up with the GVecGen2iFn typedef.
Add out-of-line helpers. We got away with only having inline expanders because the neon vector size is only 16 bytes, and we know that the inline expansion will always succeed. When we reuse this for SVE, tcg-gvec-op may decide to use an out-of-line helper due to longer vector lengths.
--- target/arm/helper.h | 10 +++ target/arm/translate.h | 7 +- target/arm/translate-a64.c | 15 +--- target/arm/translate.c | 161 ++++++++++++++++++++++--------------- target/arm/vec_helper.c | 25 ++++++ 5 files changed, 139 insertions(+), 79 deletions(-)
target/arm/helper.h +10 -0
@@ -691,6 +691,16 @@ DEF_HELPER_FLAGS_4(gvec_pmull_q, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(neon_pmull_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_ssra_b, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_ssra_h, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_ssra_s, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_ssra_d, TCG_CALL_NO_RWG, void, ptr, ptr, i32) + +DEF_HELPER_FLAGS_3(gvec_usra_b, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_usra_h, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_usra_s, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_usra_d, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +#ifdef TARGET_AARCH64 #include "helper-a64.h" #include "helper-sve.h"
target/arm/translate.h +5 -2
@@ -285,8 +285,6 @@ extern const GVecGen3 mls_op[4];extern const GVecGen3 cmtst_op[4 ];extern const GVecGen3 sshl_op[4 ];extern const GVecGen3 ushl_op[4 ]; -extern const GVecGen2i ssra_op[4 ]; -extern const GVecGen2i usra_op[4 ];extern const GVecGen2i sri_op[4 ];extern const GVecGen2i sli_op[4 ];extern const GVecGen4 uqadd_op[4 ];
@@ -299,6 +297,11 @@ void gen_sshl_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b);void gen_ushl_i64 (TCGv_i64 d,TCGv_i64 a,TCGv_i64 b);void gen_sshl_i64 (TCGv_i64 d,TCGv_i64 a,TCGv_i64 b); +void gen_gvec_ssra (unsigned vece,uint32_t rd_ofs,uint32_t rm_ofs, +int64_t shift,uint32_t opr_sz,uint32_t max_sz); +void gen_gvec_usra (unsigned vece,uint32_t rd_ofs,uint32_t rm_ofs, +int64_t shift,uint32_t opr_sz,uint32_t max_sz); +/* * Forward to the isar_feature_* tests given a DisasContext pointer. */
target/arm/translate-a64.c +2 -13
@@ -10188,19 +10188,8 @@ static void handle_vec_simd_shri(DisasContext *s, bool is_q, bool is_u,switch (opcode) {case 0x02 :/* SSRA / USRA (accumulate) */ -if (is_u) { -/* Shift count same as element size produces zero to add. */ -if (shift ==8 << size) { - goto done; - } -gen_gvec_op2i (s, is_q, rd, rn, shift, &usra_op[size]); - }else { -/* Shift count same as element size produces all sign to add. */ -if (shift ==8 << size) { - shift -=1 ; - } -gen_gvec_op2i (s, is_q, rd, rn, shift, &ssra_op[size]); - } +gen_gvec_fn2i (s, is_q, rd, rn, shift, + is_u ? gen_gvec_usra : gen_gvec_ssra, size);return ;case 0x08 :/* SRI */ /* Shift count same as element size is valid but does nothing. */
target/arm/translate.c +97 -64
182 lines not on this page · raw message
target/arm/vec_helper.c +25 -0
@@ -899,6 +899,31 @@ void HELPER(gvec_sqsub_d)(void *vd, void *vq, void *vn,clear_tail (d, oprsz,simd_maxsz (desc)); } + +#define DO_SRA (NAME ,TYPE ) \ +void HELPER(NAME)(void *vd, void *vn, uint32_t desc) \ +{ \ + intptr_t i, oprsz = simd_oprsz(desc); \ + int shift = simd_data(desc); \ + TYPE *d = vd, *n = vn; \ + for (i = 0; i < oprsz / sizeof(TYPE); i++) { \ + d[i] += n[i] >> shift; \ + } \ + clear_tail(d, oprsz, simd_maxsz(desc)); \ +} + +DO_SRA(gvec_ssra_b, int8_t) +DO_SRA(gvec_ssra_h, int16_t) +DO_SRA(gvec_ssra_s, int32_t) +DO_SRA(gvec_ssra_d, int64_t) + +DO_SRA(gvec_usra_b, uint8_t) +DO_SRA(gvec_usra_h, uint16_t) +DO_SRA(gvec_usra_s, uint32_t) +DO_SRA(gvec_usra_d, uint64_t) + +#undef DO_SRA +/* * Convert float16 to float32, raising no exceptions and * preserving exceptional values, including SNaN.
Signature · 1 line
2.20.1
Re: [PATCH v3 01/16] target/arm: Create gen_gvec_[us]sra
Quoted 11 lines · Richard Henderson
The functions eliminate duplication of the special cases for this operation. They match up with the GVecGen2iFn typedef.
Add out-of-line helpers. We got away with only having inline expanders because the neon vector size is only 16 bytes, and we know that the inline expansion will always succeed. When we reuse this for SVE, tcg-gvec-op may decide to use an out-of-line helper due to longer vector lengths.
Signed-off-by Richard Henderson <[email protected]>
thanks
-- PMM
PATCH v3 2/16 target/arm: Create gen_gvec_{u,s}{rshr,rsra}
In reply to Richard HendersonCreate vectorized versions of handle_shri_with_rndacc for shift+round and shift+round+accumulate. Add out-of-line helpers in preparation for longer vector lengths from SVE.
--- target/arm/helper.h | 20 ++ target/arm/translate.h | 9 + target/arm/translate-a64.c | 11 +- target/arm/translate.c | 461 +++++++++++++++++++++++++++++++++++-- target/arm/vec_helper.c | 50 ++++ 5 files changed, 525 insertions(+), 26 deletions(-)
target/arm/helper.h +20 -0
@@ -701,6 +701,26 @@ DEF_HELPER_FLAGS_3(gvec_usra_h, TCG_CALL_NO_RWG, void, ptr, ptr, i32) DEF_HELPER_FLAGS_3(gvec_usra_s, TCG_CALL_NO_RWG, void, ptr, ptr, i32) DEF_HELPER_FLAGS_3(gvec_usra_d, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_srshr_b, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_srshr_h, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_srshr_s, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_srshr_d, TCG_CALL_NO_RWG, void, ptr, ptr, i32) + +DEF_HELPER_FLAGS_3(gvec_urshr_b, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_urshr_h, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_urshr_s, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_urshr_d, TCG_CALL_NO_RWG, void, ptr, ptr, i32) + +DEF_HELPER_FLAGS_3(gvec_srsra_b, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_srsra_h, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_srsra_s, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_srsra_d, TCG_CALL_NO_RWG, void, ptr, ptr, i32) + +DEF_HELPER_FLAGS_3(gvec_ursra_b, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_ursra_h, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_ursra_s, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_ursra_d, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +#ifdef TARGET_AARCH64 #include "helper-a64.h" #include "helper-sve.h"
target/arm/translate.h +9 -0
@@ -302,6 +302,15 @@ void gen_gvec_ssra(unsigned vece, uint32_t rd_ofs, uint32_t rm_ofs,void gen_gvec_usra (unsigned vece,uint32_t rd_ofs,uint32_t rm_ofs,int64_t shift,uint32_t opr_sz,uint32_t max_sz); +void gen_gvec_srshr (unsigned vece,uint32_t rd_ofs,uint32_t rm_ofs, +int64_t shift,uint32_t opr_sz,uint32_t max_sz); +void gen_gvec_urshr (unsigned vece,uint32_t rd_ofs,uint32_t rm_ofs, +int64_t shift,uint32_t opr_sz,uint32_t max_sz); +void gen_gvec_srsra (unsigned vece,uint32_t rd_ofs,uint32_t rm_ofs, +int64_t shift,uint32_t opr_sz,uint32_t max_sz); +void gen_gvec_ursra (unsigned vece,uint32_t rd_ofs,uint32_t rm_ofs, +int64_t shift,uint32_t opr_sz,uint32_t max_sz); +/* * Forward to the isar_feature_* tests given a DisasContext pointer. */
target/arm/translate-a64.c +8 -3
@@ -10218,10 +10218,15 @@ static void handle_vec_simd_shri(DisasContext *s, bool is_q, bool is_u,return ;case 0x04 :/* SRSHR / URSHR (rounding) */ -break ; +gen_gvec_fn2i (s, is_q, rd, rn, shift, + is_u ? gen_gvec_urshr : gen_gvec_srshr, size); +return ; +case 0x06 :/* SRSRA / URSRA (accum + rounding) */ - accumulate = true; -break ; +gen_gvec_fn2i (s, is_q, rd, rn, shift, + is_u ? gen_gvec_ursra : gen_gvec_srsra, size); +return ; +default :g_assert_not_reached (); }
target/arm/translate.c +438 -23
497 lines not on this page · raw message
target/arm/vec_helper.c +50 -0
56 lines not on this page · raw message
Signature · 1 line
2.20.1
Re: [PATCH v3 02/16] target/arm: Create gen_gvec_{u,s}{rshr,rsra}
Quoted 38 lines · Richard Henderson
Create vectorized versions of
handle_shri_with_rndaccfor shift+round and shift+round+accumulate. Add out-of-line helpers in preparation for longer vector lengths from SVE.Signed-off-by Richard Henderson <[email protected]>--- target/arm/helper.h | 20 ++ target/arm/translate.h | 9 + target/arm/translate-a64.c | 11 +- target/arm/translate.c | 461 +++++++++++++++++++++++++++++++++++-- target/arm/vec_helper.c | 50 ++++ 5 files changed, 525 insertions(+), 26 deletions(-)target/arm/translate.c +22
-0+void gen_gvec_srshr (unsigned vece,uint32_t rd_ofs,uint32_t rm_ofs, +int64_t shift,uint32_t opr_sz,uint32_t max_sz) +{ +static const TCGOpcode vecop_list[] = { + INDEX_op_shri_vec, INDEX_op_sari_vec, INDEX_op_add_vec,0 + }; +static const GVecGen2i ops[4 ] = { + { .fni8 = gen_srshr8_i64, + .fniv = gen_srshr_vec, + .fno = gen_helper_gvec_srshr_b, + .opt_opc = vecop_list, + .vece =MO_8 }, + { .fni8 = gen_srshr16_i64, + .fniv = gen_srshr_vec, + .fno = gen_helper_gvec_srshr_h, + .opt_opc = vecop_list, + .vece =MO_16 }, + { .fni4 = gen_srshr32_i32, + .fniv = gen_srshr_vec, + .fno = gen_helper_gvec_srshr_s, + .opt_opc = vecop_list, + .vece =MO_32 },
target/arm/translate.c void gen_gvec_usra(unsigned vece, uint32_t rd_ofs, uint32_t rm_ofs, · line 4097
Quoted 10 lines
target/arm/translate.c +10
-0+ { .fni8 = gen_srshr64_i64, + .fniv = gen_srshr_vec, + .fno = gen_helper_gvec_srshr_d, + .prefer_i64 = TCG_TARGET_REG_BITS == 64, + .opt_opc = vecop_list, + .vece = MO_64 }, + }; + +/* tszimm encoding produces immediates in the range [1..esize] */ +tcg_debug_assert (shift >0 );
This assert can be triggered:
#4 0x00000000004ee086 in gen_gvec_ursra (vece=3, rd_ofs=3112, rm_ofs=3296, shift=-6, opr_sz=8,
max_sz=8) at
/home/petmay01/linaro/qemu-from-laptop/qemu/target/arm/translate.c:4413 #5 0x00000000004f17ad in disas_neon_data_insn (s=0x7fffffffe000, insn=4089066426)
at /home/petmay01/linaro/qemu-from-laptop/qemu/target/arm/translate.c:5702
#6 0x0000000000510dfa in disas_arm_insn (s=0x7fffffffe000, insn=4089066426)
at /home/petmay01/linaro/qemu-from-laptop/qemu/target/arm/translate.c:10803
#7 0x0000000000511b6b in arm_tr_translate_insn
(dcbase=0x7fffffffe000, cpu=0xd04ea0)
at /home/petmay01/linaro/qemu-from-laptop/qemu/target/arm/translate.c:11277
#8 0x000000000045a833 in translator_loop (ops=0xc2ad40
<arm_translator_ops>, db=0x7fffffffe000,
cpu=0xd04ea0, tb=0x7fffe80e3540 <code_gen_buffer+931091>, max_insns=512)
at /home/petmay01/linaro/qemu-from-laptop/qemu/accel/tcg/translator.c:102
#9 0x0000000000512303 in gen_intermediate_code (cpu=0xd04ea0,
tb=0x7fffe80e3540 <code_gen_buffer+931091>, max_insns=512)
at /home/petmay01/linaro/qemu-from-laptop/qemu/target/arm/translate.c:11568
#10 0x0000000000458c01 in tb_gen_code (cpu=0xd04ea0, pc=4268188000,
cs_base=0, flags=1196032,
cflags=-16777216) at
/home/petmay01/linaro/qemu-from-laptop/qemu/accel/tcg/translate-all.c:1718
#11 0x0000000000455f73 in tb_find (cpu=0xd04ea0, last_tb=0x0,
tb_exit=0, cf_mask=0)
at /home/petmay01/linaro/qemu-from-laptop/qemu/accel/tcg/cpu-exec.c:407
#12 0x00000000004566d3 in cpu_exec (cpu=0xd04ea0)
at /home/petmay01/linaro/qemu-from-laptop/qemu/accel/tcg/cpu-exec.c:731#13 0x000000000049a380 in cpu_loop (env=0xd0d180)
at /home/petmay01/linaro/qemu-from-laptop/qemu/linux-user/arm/cpu_loop.c:219
#14 0x0000000000465637 in main (argc=5, argv=0x7fffffffeb28, envp=0x7fffffffeb58)
at /home/petmay01/linaro/qemu-from-laptop/qemu/linux-user/main.c:872
Quoted 31 lines
target/arm/translate.c +25
-0+tcg_debug_assert (shift <= (8 << vece)); + +if (shift == (8 << vece)) { +/* +* Shifts larger than the element size are architecturally valid. +* Signed results in all sign bits. With rounding, this produces +* (-1 + 1) >> 1 == 0, or (0 + 1) >> 1 == 0. +* I.e. always zero. +*/ +tcg_gen_gvec_dup_imm (vece, rd_ofs, opr_sz, max_sz,0 ); + }else { +tcg_gen_gvec_2i (rd_ofs, rm_ofs, opr_sz, max_sz, shift, &ops[vece]); + } +}@@ -5269,6 +5685,28 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) }return 0 ; +case 2 :/* VRSHR */ +/* Right shift comes here negative. */ + shift = -shift; +if (u) { +gen_gvec_urshr (size, rd_ofs, rm_ofs, shift, + vec_size, vec_size); + }else { +gen_gvec_srshr (size, rd_ofs, rm_ofs, shift, + vec_size, vec_size); + } +return 0 ;
target/arm/translate.c static int disas_neon_data_insn(DisasContext *s, uint32_t insn) · line 5708
Quoted 10 lines
target/arm/translate.c +10
-0+ +case 3 :/* VRSRA */ +if (u) { +gen_gvec_ursra (size, rd_ofs, rm_ofs, shift, + vec_size, vec_size); + }else { +gen_gvec_srsra (size, rd_ofs, rm_ofs, shift, + vec_size, vec_size); + } +return 0 ;
I think the VRSRA case needs the same "shift = -shift" as VRSHR.
thanks
-- PMM
Peter Maydell
Reviewed-byRe: [PATCH v3 02/16] target/arm: Create gen_gvec_{u,s}{rshr,rsra}
Quoted 8 lines · Peter Maydell
Quoted 5 lines · Richard Henderson
Create vectorized versions of
handle_shri_with_rndaccfor shift+round and shift+round+accumulate. Add out-of-line helpers in preparation for longer vector lengths from SVE.
Quoted 5 lines
Review
Quoted 3 lines
Signed-off-by Richard Henderson <[email protected]>(quoted diff) +2
-0+ /* tszimm encoding produces immediates in the range [1..esize] */ + tcg_debug_assert(shift > 0);This assert can be triggered:
(well, not this assert, but the equivalent one in gen_gvec_ursra)
Quoted 6 lines
Quoted 6 lines
target/arm/translate.c +6
-0+static void gen_srshr_vec (unsigned vece,TCGv_vec d,TCGv_vec a,int64_t sh) +{ +TCGv_vec t =tcg_temp_new_vec_matching (d); +TCGv_vec ones =tcg_temp_new_vec_matching (d); + +tcg_gen_shri_vec (vece, t, a, sh -1 );
Quoted 8 lines
target/arm/translate.c void gen_gvec_usra(unsigned vece, uint32_t rd_ofs, uint32_t rm_ofs, · line 4064
Quoted 8 lines
target/arm/translate.c +8
-0+tcg_gen_dupi_vec (vece, ones,1 ); +tcg_gen_and_vec (vece, t, t, ones); +tcg_gen_sari_vec (vece, d, a, sh); +tcg_gen_add_vec (vece, d, d, t); + +tcg_temp_free_vec (t); +tcg_temp_free_vec (ones); +}
+void gen_gvec_srshr(unsigned vece, uint32_t rd_ofs, uint32_t rm_ofs,
+ int64_t shift, uint32_t opr_sz, uint32_t max_sz)
+{
+ static const TCGOpcode vecop_list[] = {
+ INDEX_op_shri_vec, INDEX_op_sari_vec, INDEX_op_add_vec, 0
+ };
Is there documentation somewhere of which vector operations don't need to be listed in the vecop list? Here gen_srshr_vec() also uses 'dupi_vec' and 'and_vec', which aren't listed, presumably because we guarantee them to be implemented? (Hopefully we don't encounter a future host vector architecture which breaks that assumption :-))
Quoted 19 lines
Quoted 19 lines
target/arm/translate.c +15
-0@@ -5269,6 +5685,28 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) }return 0 ; +case 2 :/* VRSHR */ +/* Right shift comes here negative. */ + shift = -shift; +if (u) { +gen_gvec_urshr (size, rd_ofs, rm_ofs, shift, + vec_size, vec_size); + }else { +gen_gvec_srshr (size, rd_ofs, rm_ofs, shift, + vec_size, vec_size); + } +return 0 ; + +case 3 :/* VRSRA */ +if (u) { + gen_gvec_ursra(size, rd_ofs, rm_ofs, shift,
Quoted 8 lines
target/arm/translate.c static int disas_neon_data_insn(DisasContext *s, uint32_t insn) · line 5708
Quoted 6 lines
target/arm/translate.c +6
-0+ vec_size, vec_size); + }else { +gen_gvec_srsra (size, rd_ofs, rm_ofs, shift, + vec_size, vec_size); + } +return 0 ;I think the VRSRA case needs the same "shift = -shift" as VRSHR.
With this bug fixed,
thanks
-- PMM
Re: [PATCH v3 02/16] target/arm: Create gen_gvec_{u,s}{rshr,rsra}
Quoted 6 lines · Peter Maydell
target/arm/translate.c +6
-0+void gen_gvec_srshr (unsigned vece,uint32_t rd_ofs,uint32_t rm_ofs, +int64_t shift,uint32_t opr_sz,uint32_t max_sz) +{ +static const TCGOpcode vecop_list[] = { + INDEX_op_shri_vec, INDEX_op_sari_vec, INDEX_op_add_vec,0 + };
Quoted 7 lines
Is there documentation somewhere of which vector operations don't need to be listed in the vecop list? Heregen_srshr_vec()also uses 'dupi_vec' and 'and_vec', which aren't listed, presumably because we guarantee them to be implemented? (Hopefully we don't encounter a future host vector architecture which breaks that assumption :-))
Yes, though perhaps not perfectly easy to find: it's at the top of tcg-op-vec.c.
Correct, that the logicals and mov/dupi etc are mandatory and should not be listed. Moreover, I assert that they are *not* listed, so we get a CONFIG_DEBUG_TCG check of this list both positive and negative.
I'm going to hope that no future architecture is so irregular as to not implement logicals. ;-) Or even be as irregular as Intel.
Quoted 4 lines
Quoted 1 line
I think the VRSRA case needs the same "shift = -shift" as VRSHR.
With this bug fixed,
Reviewed-by Peter Maydell <[email protected]>
Thanks, fixed.
r~
Re: [PATCH v3 02/16] target/arm: Create gen_gvec_{u,s}{rshr,rsra}
In reply to Richard HendersonQuoted 10 lines · Richard Henderson
Create vectorized versions of
handle_shri_with_rndaccfor shift+round and shift+round+accumulate. Add out-of-line helpers in preparation for longer vector lengths from SVE.Signed-off-by Richard Henderson <[email protected]>target/arm/translate.c +2
-0+/* tszimm encoding produces immediates in the range [1..esize] */ +tcg_debug_assert (shift >0 );
target/arm/translate.c void gen_gvec_usra(unsigned vece, uint32_t rd_ofs, uint32_t rm_ofs, · line 4107
Quoted 10 lines
target/arm/translate.c +10
-0+tcg_debug_assert (shift <= (8 << vece)); + +if (shift == (8 << vece)) { +/* +* Shifts larger than the element size are architecturally valid. +* Signed results in all sign bits. With rounding, this produces +* (-1 + 1) >> 1 == 0, or (0 + 1) >> 1 == 0. +* I.e. always zero. +*/ +tcg_gen_gvec_dup_imm (vece, rd_ofs, opr_sz, max_sz,0 );
Knew I'd forgotten a review comment -- should this "dup_imm to clear to zeroes" be using a fixed element size rather than 'vece' to avoid the "dup_imm doesn't handle 128 bits" issue? (Similarly elsewhere.)
target/arm/translate.c void gen_gvec_usra(unsigned vece, uint32_t rd_ofs, uint32_t rm_ofs, · line 4111
Quoted 4 lines
target/arm/translate.c +4
-0+ }else { +tcg_gen_gvec_2i (rd_ofs, rm_ofs, opr_sz, max_sz, shift, &ops[vece]); + } +}
thanks
-- PMM
Re: [PATCH v3 02/16] target/arm: Create gen_gvec_{u,s}{rshr,rsra}
Quoted 5 lines · Peter Maydell
Quoted 1 line
+
tcg_gen_gvec_dup_imm(vece, rd_ofs, opr_sz, max_sz, 0);Knew I'd forgotten a review comment -- should this "
dup_immto clear to zeroes" be using a fixed element size rather than 'vece' to avoid the "dup_immdoesn't handle 128 bits" issue? (Similarly elsewhere.)
No, because here we cannot have 128-bit elements (not 128-bit vectors).
r~
PATCH v3 3/16 target/arm: Create gen_gvec_{sri,sli}
In reply to Richard HendersonThe functions eliminate duplication of the special cases for this operation. They match up with the GVecGen2iFn typedef.
Add out-of-line helpers. We got away with only having inline expanders because the neon vector size is only 16 bytes, and we know that the inline expansion will always succeed. When we reuse this for SVE, tcg-gvec-op may decide to use an out-of-line helper due to longer vector lengths.
--- target/arm/helper.h | 10 ++ target/arm/translate.h | 7 +- target/arm/translate-a64.c | 20 +--- target/arm/translate.c | 186 +++++++++++++++++++++---------------- target/arm/vec_helper.c | 38 ++++++++ 5 files changed, 160 insertions(+), 101 deletions(-)
target/arm/helper.h +10 -0
@@ -721,6 +721,16 @@ DEF_HELPER_FLAGS_3(gvec_ursra_h, TCG_CALL_NO_RWG, void, ptr, ptr, i32) DEF_HELPER_FLAGS_3(gvec_ursra_s, TCG_CALL_NO_RWG, void, ptr, ptr, i32) DEF_HELPER_FLAGS_3(gvec_ursra_d, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_sri_b, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_sri_h, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_sri_s, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_sri_d, TCG_CALL_NO_RWG, void, ptr, ptr, i32) + +DEF_HELPER_FLAGS_3(gvec_sli_b, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_sli_h, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_sli_s, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_sli_d, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +#ifdef TARGET_AARCH64 #include "helper-a64.h" #include "helper-sve.h"
target/arm/translate.h +5 -2
@@ -285,8 +285,6 @@ extern const GVecGen3 mls_op[4];extern const GVecGen3 cmtst_op[4 ];extern const GVecGen3 sshl_op[4 ];extern const GVecGen3 ushl_op[4 ]; -extern const GVecGen2i sri_op[4 ]; -extern const GVecGen2i sli_op[4 ];extern const GVecGen4 uqadd_op[4 ];extern const GVecGen4 sqadd_op[4 ];extern const GVecGen4 uqsub_op[4 ];
@@ -311,6 +309,11 @@ void gen_gvec_srsra(unsigned vece, uint32_t rd_ofs, uint32_t rm_ofs,void gen_gvec_ursra (unsigned vece,uint32_t rd_ofs,uint32_t rm_ofs,int64_t shift,uint32_t opr_sz,uint32_t max_sz); +void gen_gvec_sri (unsigned vece,uint32_t rd_ofs,uint32_t rm_ofs, +int64_t shift,uint32_t opr_sz,uint32_t max_sz); +void gen_gvec_sli (unsigned vece,uint32_t rd_ofs,uint32_t rm_ofs, +int64_t shift,uint32_t opr_sz,uint32_t max_sz); +/* * Forward to the isar_feature_* tests given a DisasContext pointer. */
target/arm/translate-a64.c +3 -17
@@ -585,16 +585,6 @@ static void gen_gvec_op2(DisasContext *s, bool is_q, int rd, is_q ? 16 : 8, vec_full_reg_size(s), gvec_op); } -/* Expand a 2-operand + immediate AdvSIMD vector operation using -* an op descriptor. -*/ -static void gen_gvec_op2i (DisasContext *s,bool is_q,int rd, -int rn,int64_t imm,const GVecGen2i *gvec_op) -{ -tcg_gen_gvec_2i (vec_full_reg_offset (s, rd),vec_full_reg_offset (s, rn), - is_q ?16 :8 ,vec_full_reg_size (s), imm, gvec_op); -} -/* Expand a 3-operand AdvSIMD vector operation using an op descriptor. */ static void gen_gvec_op3 (DisasContext *s,bool is_q,int rd,int rn,int rm,const GVecGen3 *gvec_op)
@@ -10191,12 +10181,9 @@ static void handle_vec_simd_shri(DisasContext *s, bool is_q, bool is_u,gen_gvec_fn2i (s, is_q, rd, rn, shift, is_u ? gen_gvec_usra : gen_gvec_ssra, size);return ; +case 0x08 :/* SRI */ -/* Shift count same as element size is valid but does nothing. */ -if (shift ==8 << size) { - goto done; - } -gen_gvec_op2i (s, is_q, rd, rn, shift, &sri_op[size]); +gen_gvec_fn2i (s, is_q, rd, rn, shift, gen_gvec_sri, size);return ;case 0x00 :/* SSHR / USHR */
@@ -10247,7 +10234,6 @@ static void handle_vec_simd_shri(DisasContext *s, bool is_q, bool is_u, }tcg_temp_free_i64 (tcg_round); - done:clear_vec_high (s, is_q, rd); }
@@ -10272,7 +10258,7 @@ static void handle_vec_simd_shli(DisasContext *s, bool is_q, bool insert, }if (insert) { -gen_gvec_op2i (s, is_q, rd, rn, shift, &sli_op[size]); +gen_gvec_fn2i (s, is_q, rd, rn, shift, gen_gvec_sli, size); }else {gen_gvec_fn2i (s, is_q, rd, rn, shift, tcg_gen_gvec_shli, size); }
target/arm/translate.c +104 -82
218 lines not on this page · raw message
target/arm/vec_helper.c +38 -0
@@ -974,6 +974,44 @@ DO_RSRA(gvec_ursra_d, uint64_t)#undef DO_RSRA +#define DO_SRI (NAME ,TYPE ) \ +void HELPER(NAME)(void *vd, void *vn, uint32_t desc) \ +{ \ + intptr_t i, oprsz = simd_oprsz(desc); \ + int shift = simd_data(desc); \ + TYPE *d = vd, *n = vn; \ + for (i = 0; i < oprsz / sizeof(TYPE); i++) { \ + d[i] = deposit64(d[i], 0, sizeof(TYPE) * 8 - shift, n[i] >> shift); \ + } \ + clear_tail(d, oprsz, simd_maxsz(desc)); \ +} + +DO_SRI(gvec_sri_b, uint8_t) +DO_SRI(gvec_sri_h, uint16_t) +DO_SRI(gvec_sri_s, uint32_t) +DO_SRI(gvec_sri_d, uint64_t) + +#undef DO_SRI + +#define DO_SLI (NAME ,TYPE ) \ +void HELPER(NAME)(void *vd, void *vn, uint32_t desc) \ +{ \ + intptr_t i, oprsz = simd_oprsz(desc); \ + int shift = simd_data(desc); \ + TYPE *d = vd, *n = vn; \ + for (i = 0; i < oprsz / sizeof(TYPE); i++) { \ + d[i] = deposit64(d[i], shift, sizeof(TYPE) * 8 - shift, n[i]); \ + } \ + clear_tail(d, oprsz, simd_maxsz(desc)); \ +} + +DO_SLI(gvec_sli_b, uint8_t) +DO_SLI(gvec_sli_h, uint16_t) +DO_SLI(gvec_sli_s, uint32_t) +DO_SLI(gvec_sli_d, uint64_t) + +#undef DO_SLI +/* * Convert float16 to float32, raising no exceptions and * preserving exceptional values, including SNaN.
Signature · 1 line
2.20.1
Re: [PATCH v3 03/16] target/arm: Create gen_gvec_{sri,sli}
Quoted 11 lines · Richard Henderson
The functions eliminate duplication of the special cases for this operation. They match up with the GVecGen2iFn typedef.
Add out-of-line helpers. We got away with only having inline expanders because the neon vector size is only 16 bytes, and we know that the inline expansion will always succeed. When we reuse this for SVE, tcg-gvec-op may decide to use an out-of-line helper due to longer vector lengths.
Signed-off-by Richard Henderson <[email protected]>
thanks
-- PMM
PATCH v3 4/16 target/arm: Remove unnecessary range check for VSHL
In reply to Richard HendersonIn 1dc8425e551, while converting to gvec, I added an extra range check against the shift count. This was unnecessary because the encoding of the shift count produces 0 to the element size - 1.
--- target/arm/translate.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
target/arm/translate.c +2 -10
@@ -5750,16 +5750,8 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)gen_gvec_sli (size, rd_ofs, rm_ofs, shift, vec_size, vec_size); }else {/* VSHL */ -/* Shifts larger than the element size are -* architecturally valid and results in zero. -*/ -if (shift >=8 << size) { -tcg_gen_gvec_dup_imm (size, rd_ofs, - vec_size, vec_size,0 ); - }else { -tcg_gen_gvec_shli (size, rd_ofs, rm_ofs, shift, - vec_size, vec_size); - } +tcg_gen_gvec_shli (size, rd_ofs, rm_ofs, shift, + vec_size, vec_size); }return 0 ; }
Signature · 1 line
2.20.1
Re: [PATCH v3 04/16] target/arm: Remove unnecessary range check for VSHL
Quoted 10 lines · Richard Henderson
In
1dc8425e551, while converting to gvec, I added an extra range check against the shift count. This was unnecessary because the encoding of the shift count produces 0 to the element size - 1.Signed-off-by Richard Henderson <[email protected]>--- target/arm/translate.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
thanks
-- PMM
PATCH v3 5/16 target/arm: Tidy handle_vec_simd_shri
In reply to Richard HendersonNow that we've converted all cases to gvec, there is quite a bit of dead code at the end of the function. Remove it.
Sink the call to gen_gvec_fn2i to the end, loading a function pointer within the switch statement.
--- target/arm/translate-a64.c | 56 ++++++++++---------------------------- 1 file changed, 14 insertions(+), 42 deletions(-)
target/arm/translate-a64.c +14 -42
@@ -10155,16 +10155,7 @@ static void handle_vec_simd_shri(DisasContext *s, bool is_q, bool is_u,int size =32 -clz32 (immh) -1 ;int immhb = immh <<3 | immb;int shift =2 * (8 << size) - immhb; -bool accumulate = false; -int dsize = is_q ?128 :64 ; -int esize =8 << size; -int elements = dsize/esize; -MemOp memop = size | (is_u ?0 :MO_SIGN ); -TCGv_i64 tcg_rn =new_tmp_a64 (s); -TCGv_i64 tcg_rd =new_tmp_a64 (s); -TCGv_i64 tcg_round; -uint64_t round_const; -int i; +GVecGen2iFn *gvec_fn;if (extract32 (immh,3 ,1 ) && !is_q) {unallocated_encoding (s);
@@ -10178,13 +10169,12 @@ static void handle_vec_simd_shri(DisasContext *s, bool is_q, bool is_u,switch (opcode) {case 0x02 :/* SSRA / USRA (accumulate) */ -gen_gvec_fn2i (s, is_q, rd, rn, shift, - is_u ? gen_gvec_usra : gen_gvec_ssra, size); -return ; + gvec_fn = is_u ? gen_gvec_usra : gen_gvec_ssra; +break ;case 0x08 :/* SRI */ -gen_gvec_fn2i (s, is_q, rd, rn, shift, gen_gvec_sri, size); -return ; + gvec_fn = gen_gvec_sri; +break ;case 0x00 :/* SSHR / USHR */ if (is_u) {
@@ -10192,49 +10182,31 @@ static void handle_vec_simd_shri(DisasContext *s, bool is_q, bool is_u,/* Shift count the same size as element size produces zero. */ tcg_gen_gvec_dup_imm (size,vec_full_reg_offset (s, rd), is_q ?16 :8 ,vec_full_reg_size (s),0 ); - }else { -gen_gvec_fn2i (s, is_q, rd, rn, shift, tcg_gen_gvec_shri, size); +return ; } + gvec_fn = tcg_gen_gvec_shri; }else {/* Shift count the same size as element size produces all sign. */ if (shift ==8 << size) { shift -=1 ; } -gen_gvec_fn2i (s, is_q, rd, rn, shift, tcg_gen_gvec_sari, size); + gvec_fn = tcg_gen_gvec_sari; } -return ; +break ;case 0x04 :/* SRSHR / URSHR (rounding) */ -gen_gvec_fn2i (s, is_q, rd, rn, shift, - is_u ? gen_gvec_urshr : gen_gvec_srshr, size); -return ; + gvec_fn = is_u ? gen_gvec_urshr : gen_gvec_srshr; +break ;case 0x06 :/* SRSRA / URSRA (accum + rounding) */ -gen_gvec_fn2i (s, is_q, rd, rn, shift, - is_u ? gen_gvec_ursra : gen_gvec_srsra, size); -return ; + gvec_fn = is_u ? gen_gvec_ursra : gen_gvec_srsra; +break ;default :g_assert_not_reached (); } - round_const =1ULL << (shift -1 ); - tcg_round =tcg_const_i64 (round_const); - -for (i =0 ; i < elements; i++) { -read_vec_element (s, tcg_rn, rn, i, memop); -if (accumulate) { -read_vec_element (s, tcg_rd, rd, i, memop); - } - -handle_shri_with_rndacc (tcg_rd, tcg_rn, tcg_round, - accumulate, is_u, size, shift); - -write_vec_element (s, tcg_rd, rd, i, size); - } -tcg_temp_free_i64 (tcg_round); - -clear_vec_high (s, is_q, rd); +gen_gvec_fn2i (s, is_q, rd, rn, shift, gvec_fn, size); }/* SHL/SLI - Vector shift left */
Signature · 1 line
2.20.1
Re: [PATCH v3 05/16] target/arm: Tidy handle_vec_simd_shri
Quoted 4 lines · Richard Henderson
Now that we've converted all cases to gvec, there is quite a bit of dead code at the end of the function. Remove it.
Quoted 8 lines
Sink the call to
gen_gvec_fn2ito the end, loading a function pointer within the switch statement.Signed-off-by Richard Henderson <[email protected]>--- target/arm/translate-a64.c | 56 ++++++++++---------------------------- 1 file changed, 14 insertions(+), 42 deletions(-)
thanks
-- PMM
PATCH v3 6/16 target/arm: Create gen_gvec_{ceq,clt,cle,cgt,cge}0
In reply to Richard HendersonProvide a functional interface for the vector expansion. This fits better with the existing set of helpers that we provide for other operations.
Macro-ize the 5 nearly identical comparisons.
--- target/arm/translate.h | 16 ++- target/arm/translate-a64.c | 22 ++-- target/arm/translate.c | 254 ++++++++----------------------------- 3 files changed, 74 insertions(+), 218 deletions(-)
target/arm/translate.h +11 -5
@@ -275,11 +275,17 @@ static inline void gen_swstep_exception(DisasContext *s, int isv, int ex)uint64_t vfp_expand_imm (int size,uint8_t imm8);/* Vector operations shared between ARM and AArch64. */ -extern const GVecGen2 ceq0_op[4 ]; -extern const GVecGen2 clt0_op[4 ]; -extern const GVecGen2 cgt0_op[4 ]; -extern const GVecGen2 cle0_op[4 ]; -extern const GVecGen2 cge0_op[4 ]; +void gen_gvec_ceq0 (unsigned vece,uint32_t rd_ofs,uint32_t rm_ofs, +uint32_t opr_sz,uint32_t max_sz); +void gen_gvec_clt0 (unsigned vece,uint32_t rd_ofs,uint32_t rm_ofs, +uint32_t opr_sz,uint32_t max_sz); +void gen_gvec_cgt0 (unsigned vece,uint32_t rd_ofs,uint32_t rm_ofs, +uint32_t opr_sz,uint32_t max_sz); +void gen_gvec_cle0 (unsigned vece,uint32_t rd_ofs,uint32_t rm_ofs, +uint32_t opr_sz,uint32_t max_sz); +void gen_gvec_cge0 (unsigned vece,uint32_t rd_ofs,uint32_t rm_ofs, +uint32_t opr_sz,uint32_t max_sz); +extern const GVecGen3 mla_op[4 ];extern const GVecGen3 mls_op[4 ];extern const GVecGen3 cmtst_op[4 ];
target/arm/translate-a64.c +11 -11
@@ -577,14 +577,6 @@ static void gen_gvec_fn4(DisasContext *s, bool is_q, int rd, int rn, int rm, is_q ? 16 : 8, vec_full_reg_size(s)); } -/* Expand a 2-operand AdvSIMD vector operation using an op descriptor. */ -static void gen_gvec_op2 (DisasContext *s,bool is_q,int rd, -int rn,const GVecGen2 *gvec_op) -{ -tcg_gen_gvec_2 (vec_full_reg_offset (s, rd),vec_full_reg_offset (s, rn), - is_q ?16 :8 ,vec_full_reg_size (s), gvec_op); -} -/* Expand a 3-operand AdvSIMD vector operation using an op descriptor. */ static void gen_gvec_op3 (DisasContext *s,bool is_q,int rd,int rn,int rm,const GVecGen3 *gvec_op)
@@ -12310,13 +12302,21 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) }break ;case 0x8 :/* CMGT, CMGE */ -gen_gvec_op2 (s, is_q, rd, rn, u ? &cge0_op[size] : &cgt0_op[size]); +if (u) { +gen_gvec_fn2 (s, is_q, rd, rn, gen_gvec_cge0, size); + }else { +gen_gvec_fn2 (s, is_q, rd, rn, gen_gvec_cgt0, size); + }return ;case 0x9 :/* CMEQ, CMLE */ -gen_gvec_op2 (s, is_q, rd, rn, u ? &cle0_op[size] : &ceq0_op[size]); +if (u) { +gen_gvec_fn2 (s, is_q, rd, rn, gen_gvec_cle0, size); + }else { +gen_gvec_fn2 (s, is_q, rd, rn, gen_gvec_ceq0, size); + }return ;case 0xa :/* CMLT */ -gen_gvec_op2 (s, is_q, rd, rn, &clt0_op[size]); +gen_gvec_fn2 (s, is_q, rd, rn, gen_gvec_clt0, size);return ;case 0xb :if (u) {/* ABS, NEG */
target/arm/translate.c +52 -202
280 lines not on this page · raw message
Signature · 1 line
2.20.1
Re: [PATCH v3 06/16] target/arm: Create gen_gvec_{ceq, clt, cle, cgt, cge}0
Quoted 9 lines · Richard Henderson
Provide a functional interface for the vector expansion. This fits better with the existing set of helpers that we provide for other operations.
Macro-ize the 5 nearly identical comparisons.
Signed-off-by Richard Henderson <[email protected]>--
thanks
-- PMM
PATCH v3 7/16 target/arm: Create gen_gvec_{mla,mls}
In reply to Richard HendersonProvide a functional interface for the vector expansion. This fits better with the existing set of helpers that we provide for other operations.
--- target/arm/translate.h | 7 +- target/arm/translate-a64.c | 4 +- target/arm/translate-neon.inc.c | 16 +---- target/arm/translate.c | 117 +++++++++++++++++--------------- 4 files changed, 71 insertions(+), 73 deletions(-)
target/arm/translate.h +5 -2
@@ -286,8 +286,11 @@ void gen_gvec_cle0(unsigned vece, uint32_t rd_ofs, uint32_t rm_ofs,void gen_gvec_cge0 (unsigned vece,uint32_t rd_ofs,uint32_t rm_ofs,uint32_t opr_sz,uint32_t max_sz); -extern const GVecGen3 mla_op[4 ]; -extern const GVecGen3 mls_op[4 ]; +void gen_gvec_mla (unsigned vece,uint32_t rd_ofs,uint32_t rn_ofs, +uint32_t rm_ofs,uint32_t opr_sz,uint32_t max_sz); +void gen_gvec_mls (unsigned vece,uint32_t rd_ofs,uint32_t rn_ofs, +uint32_t rm_ofs,uint32_t opr_sz,uint32_t max_sz); +extern const GVecGen3 cmtst_op[4 ];extern const GVecGen3 sshl_op[4 ];extern const GVecGen3 ushl_op[4 ];
target/arm/translate-a64.c +2 -2
@@ -11226,9 +11226,9 @@ static void disas_simd_3same_int(DisasContext *s, uint32_t insn)return ;case 0x12 :/* MLA, MLS */ if (u) { -gen_gvec_op3 (s, is_q, rd, rn, rm, &mls_op[size]); +gen_gvec_fn3 (s, is_q, rd, rn, rm, gen_gvec_mls, size); }else { -gen_gvec_op3 (s, is_q, rd, rn, rm, &mla_op[size]); +gen_gvec_fn3 (s, is_q, rd, rn, rm, gen_gvec_mla, size); }return ;case 0x11 :
target/arm/translate-neon.inc.c +2 -14
@@ -632,6 +632,8 @@ DO_3SAME_NO_SZ_3(VMAX_U, tcg_gen_gvec_umax) DO_3SAME_NO_SZ_3(VMIN_S, tcg_gen_gvec_smin) DO_3SAME_NO_SZ_3(VMIN_U, tcg_gen_gvec_umin) DO_3SAME_NO_SZ_3(VMUL, tcg_gen_gvec_mul) +DO_3SAME_NO_SZ_3(VMLA, gen_gvec_mla) +DO_3SAME_NO_SZ_3(VMLS, gen_gvec_mls)#define DO_3SAME_CMP (INSN ,COND ) \ static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, \
@@ -685,20 +687,6 @@ static bool trans_VMUL_p_3s(DisasContext *s, arg_3same *a)return do_3same (s, a, gen_VMUL_p_3s); } -#define DO_3SAME_GVEC3_NO_SZ_3 (INSN ,OPARRAY ) \ - static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, \ - uint32_t rn_ofs, uint32_t rm_ofs, \ - uint32_t oprsz, uint32_t maxsz) \ - { \ - tcg_gen_gvec_3(rd_ofs, rn_ofs, rm_ofs, \ - oprsz, maxsz, &OPARRAY[vece]); \ - } \ - DO_3SAME_NO_SZ_3(INSN, gen_##INSN##_3s) - - -DO_3SAME_GVEC3_NO_SZ_3(VMLA, mla_op) -DO_3SAME_GVEC3_NO_SZ_3(VMLS, mls_op) -#define DO_3SAME_GVEC3_SHIFT (INSN ,OPARRAY ) \ static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, \ uint32_t rn_ofs, uint32_t rm_ofs, \
target/arm/translate.c +62 -55
124 lines not on this page · raw message
Signature · 1 line
2.20.1
Re: [PATCH v3 07/16] target/arm: Create gen_gvec_{mla,mls}
Quoted 7 lines · Richard Henderson
Provide a functional interface for the vector expansion. This fits better with the existing set of helpers that we provide for other operations.
Signed-off-by Richard Henderson <[email protected]>---
thanks
-- PMM
PATCH v3 8/16 target/arm: Swap argument order for VSHL during decode
In reply to Richard HendersonRather than perform the argument swap during code generation, perform it during decode. This means it doesn't have to be special cased later, and we can share code with aarch64 code generation. Hopefully the decode comment addresses any confusion that might arise in between.
--- target/arm/neon-dp.decode | 9 +++++++-- target/arm/translate-neon.inc.c | 3 +-- 2 files changed, 8 insertions(+), 4 deletions(-)
target/arm/neon-dp.decode +7 -2
@@ -65,8 +65,13 @@ VCGT_U_3s 1111 001 1 0 . .. .... .... 0011 . . . 0 .... @3same VCGE_S_3s 1111 001 0 0 . .. .... .... 0011 . . . 1 .... @3same VCGE_U_3s 1111 001 1 0 . .. .... .... 0011 . . . 1 .... @3same -VSHL_S_3s 1111 001 0 0 . .. .... .... 0100 . . . 0 .... @3same -VSHL_U_3s 1111 001 1 0 . .. .... .... 0100 . . . 0 .... @3same +# The shift operations are of the form Vd = Vm << Vn. +# By reversing the names of the fields here, we can use standard expanders. +@3same_rev .... ... . . . size:2 .... .... .... . q:1 . . .... \ + &3same vn=%vm_dp vm=%vn_dp vd=%vd_dp + +VSHL_S_3s 1111 001 0 0 . .. .... .... 0100 . . . 0 .... @3same_rev +VSHL_U_3s 1111 001 1 0 . .. .... .... 0100 . . . 0 .... @3same_rev VMAX_S_3s 1111 001 0 0 . .. .... .... 0110 . . . 0 .... @3same VMAX_U_3s 1111 001 1 0 . .. .... .... 0110 . . . 0 .... @3same
target/arm/translate-neon.inc.c +1 -2
@@ -692,8 +692,7 @@ static bool trans_VMUL_p_3s(DisasContext *s, arg_3same *a) uint32_t rn_ofs, uint32_t rm_ofs, \ uint32_t oprsz, uint32_t maxsz) \ { \ -/* Note the operation is vshl vd,vm,vn */ \ -tcg_gen_gvec_3 (rd_ofs ,rm_ofs ,rn_ofs , \ +tcg_gen_gvec_3 (rd_ofs ,rn_ofs ,rm_ofs , \ oprsz, maxsz, &OPARRAY[vece]); \ } \ DO_3SAME(INSN, gen_##INSN##_3s)
Signature · 1 line
2.20.1
Re: [PATCH v3 08/16] target/arm: Swap argument order for VSHL during decode
Quoted 18 lines · Richard Henderson
Rather than perform the argument swap during code generation, perform it during decode. This means it doesn't have to be special cased later, and we can share code with aarch64 code generation. Hopefully the decode comment addresses any confusion that might arise in between.
Signed-off-by Richard Henderson <[email protected]>--- target/arm/neon-dp.decode | 9 +++++++-- target/arm/translate-neon.inc.c | 3 +-- 2 files changed, 8 insertions(+), 4 deletions(-)target/arm/neon-dp.decode +0
-0
target/arm/neon-dp.decode VCGT_U_3s 1111 001 1 0 . .. .... .... 0011 . . . 0 .... @3same · line 69
Quoted 7 lines
target/arm/neon-dp.decode +2
-2@@ -65,8 +65,13 @@ VCGT_U_3s 1111 001 1 0 . .. .... .... 0011 . . . 0 .... @3same VCGE_S_3s 1111 001 0 0 . .. .... .... 0011 . . . 1 .... @3same VCGE_U_3s 1111 001 1 0 . .. .... .... 0011 . . . 1 .... @3same -VSHL_S_3s 1111 001 0 0 . .. .... .... 0100 . . . 0 .... @3same -VSHL_U_3s 1111 001 1 0 . .. .... .... 0100 . . . 0 .... @3same +# The shift operations are of the form Vd = Vm << Vn. +# By reversing the names of the fields here, we can use standard expanders.
My work-in-progress v2 of the neon decodetree stuff has a slightly more expanded comment for @3same_rev:
# The _rev suffix indicates that Vn and Vm are reversed. This is
# the case for shifts. In the Arm ARM these insns are documented # with the Vm and Vn fields in their usual places, but in the # assembly the operands are listed "backwards", ie in the order # Dd, Dm, Dn where other insns use Dd, Dn, Dm. For QEMU we choose # to consider Vm and Vm as being in different fields in the insn, # which allows us to avoid special-casing shifts in the trans_ # function code (where we would otherwise need to manually swap # the operands over to call Neon helper functions that are shared # with AArch64 which does not have this odd reversed-operand situation).
Quoted 23 lines
target/arm/neon-dp.decode +5
-0+@3same_rev .... ... . . . size:2 .... .... .... . q:1 . . .... \ + &3same vn=%vm_dp vm=%vn_dp vd=%vd_dp + +VSHL_S_3s 1111 001 0 0 . .. .... .... 0100 . . . 0 .... @3same_rev +VSHL_U_3s 1111 001 1 0 . .. .... .... 0100 . . . 0 .... @3same_rev VMAX_S_3s 1111 001 0 0 . .. .... .... 0110 . . . 0 .... @3same VMAX_U_3s 1111 001 1 0 . .. .... .... 0110 . . . 0 .... @3sametarget/arm/translate-neon.inc.c +1
-3@@ -692,8 +692,7 @@ static bool trans_VMUL_p_3s(DisasContext *s, arg_3same *a) uint32_t rn_ofs, uint32_t rm_ofs, \ uint32_t oprsz, uint32_t maxsz) \ { \ -/* Note the operation is vshl vd,vm,vn */ \ -tcg_gen_gvec_3 (rd_ofs ,rm_ofs ,rn_ofs , \ +tcg_gen_gvec_3 (rd_ofs ,rn_ofs ,rm_ofs , \ oprsz, maxsz, &OPARRAY[vece]); \ } \ DO_3SAME(INSN, gen_##INSN##_3s) --
Quoted 1 line
2.20.1
Otherwise
thanks
-- PMM
PATCH v3 9/16 target/arm: Create gen_gvec_{cmtst,ushl,sshl}
In reply to Richard HendersonProvide a functional interface for the vector expansion. This fits better with the existing set of helpers that we provide for other operations.
--- target/arm/translate.h | 10 ++- target/arm/translate-a64.c | 18 ++-- target/arm/translate-neon.inc.c | 23 +---- target/arm/translate.c | 146 +++++++++++++++++--------------- 4 files changed, 95 insertions(+), 102 deletions(-)
target/arm/translate.h +7 -3
@@ -291,9 +291,13 @@ void gen_gvec_mla(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs,void gen_gvec_mls (unsigned vece,uint32_t rd_ofs,uint32_t rn_ofs,uint32_t rm_ofs,uint32_t opr_sz,uint32_t max_sz); -extern const GVecGen3 cmtst_op[4 ]; -extern const GVecGen3 sshl_op[4 ]; -extern const GVecGen3 ushl_op[4 ]; +void gen_gvec_cmtst (unsigned vece,uint32_t rd_ofs,uint32_t rn_ofs, +uint32_t rm_ofs,uint32_t opr_sz,uint32_t max_sz); +void gen_gvec_sshl (unsigned vece,uint32_t rd_ofs,uint32_t rn_ofs, +uint32_t rm_ofs,uint32_t opr_sz,uint32_t max_sz); +void gen_gvec_ushl (unsigned vece,uint32_t rd_ofs,uint32_t rn_ofs, +uint32_t rm_ofs,uint32_t opr_sz,uint32_t max_sz); +extern const GVecGen4 uqadd_op[4 ];extern const GVecGen4 sqadd_op[4 ];extern const GVecGen4 uqsub_op[4 ];
target/arm/translate-a64.c +6 -12
@@ -577,15 +577,6 @@ static void gen_gvec_fn4(DisasContext *s, bool is_q, int rd, int rn, int rm, is_q ? 16 : 8, vec_full_reg_size(s)); } -/* Expand a 3-operand AdvSIMD vector operation using an op descriptor. */ -static void gen_gvec_op3 (DisasContext *s,bool is_q,int rd, -int rn,int rm,const GVecGen3 *gvec_op) -{ -tcg_gen_gvec_3 (vec_full_reg_offset (s, rd),vec_full_reg_offset (s, rn), -vec_full_reg_offset (s, rm), is_q ?16 :8 , -vec_full_reg_size (s), gvec_op); -} -/* Expand a 3-operand operation using an out-of-line helper. */ static void gen_gvec_op3_ool (DisasContext *s,bool is_q,int rd,int rn,int rm,int data,gen_helper_gvec_3 *fn)
@@ -11193,8 +11184,11 @@ static void disas_simd_3same_int(DisasContext *s, uint32_t insn) (u ? uqsub_op : sqsub_op) + size);return ;case 0x08 :/* SSHL, USHL */ -gen_gvec_op3 (s, is_q, rd, rn, rm, - u ? &ushl_op[size] : &sshl_op[size]); +if (u) { +gen_gvec_fn3 (s, is_q, rd, rn, rm, gen_gvec_ushl, size); + }else { +gen_gvec_fn3 (s, is_q, rd, rn, rm, gen_gvec_sshl, size); + }return ;case 0x0c :/* SMAX, UMAX */ if (u) {
@@ -11233,7 +11227,7 @@ static void disas_simd_3same_int(DisasContext *s, uint32_t insn)return ;case 0x11 :if (!u) {/* CMTST */ -gen_gvec_op3 (s, is_q, rd, rn, rm, &cmtst_op[size]); +gen_gvec_fn3 (s, is_q, rd, rn, rm, gen_gvec_cmtst, size);return ; }/* else CMEQ */
target/arm/translate-neon.inc.c +3 -20
@@ -603,6 +603,8 @@ DO_3SAME(VBIC, tcg_gen_gvec_andc) DO_3SAME(VORR, tcg_gen_gvec_or) DO_3SAME(VORN, tcg_gen_gvec_orc) DO_3SAME(VEOR, tcg_gen_gvec_xor) +DO_3SAME(VSHL_S, gen_gvec_sshl) +DO_3SAME (VSHL_U , gen_gvec_ushl) /* These insns are all gvec_bitsel but with the inputs in various orders. */#define DO_3SAME_BITSEL (INSN ,O1 ,O2 ,O3 ) \
@@ -634,6 +636,7 @@ DO_3SAME_NO_SZ_3(VMIN_U, tcg_gen_gvec_umin) DO_3SAME_NO_SZ_3(VMUL, tcg_gen_gvec_mul) DO_3SAME_NO_SZ_3(VMLA, gen_gvec_mla) DO_3SAME_NO_SZ_3(VMLS, gen_gvec_mls) +DO_3SAME_NO_SZ_3(VTST, gen_gvec_cmtst)#define DO_3SAME_CMP (INSN ,COND ) \ static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, \
@@ -650,13 +653,6 @@ DO_3SAME_CMP(VCGE_S, TCG_COND_GE) DO_3SAME_CMP(VCGE_U, TCG_COND_GEU) DO_3SAME_CMP(VCEQ, TCG_COND_EQ) -static void gen_VTST_3s (unsigned vece,uint32_t rd_ofs,uint32_t rn_ofs, -uint32_t rm_ofs,uint32_t oprsz,uint32_t maxsz) -{ -tcg_gen_gvec_3 (rd_ofs, rn_ofs, rm_ofs, oprsz, maxsz, &cmtst_op[vece]); -} -DO_3SAME_NO_SZ_3(VTST, gen_VTST_3s) -#define DO_3SAME_GVEC4 (INSN ,OPARRAY ) \ static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, \ uint32_t rn_ofs, uint32_t rm_ofs, \
@@ -686,16 +682,3 @@ static bool trans_VMUL_p_3s(DisasContext *s, arg_3same *a) }return do_3same (s, a, gen_VMUL_p_3s); } - -#define DO_3SAME_GVEC3_SHIFT (INSN ,OPARRAY ) \ - static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, \ - uint32_t rn_ofs, uint32_t rm_ofs, \ - uint32_t oprsz, uint32_t maxsz) \ - { \ - tcg_gen_gvec_3(rd_ofs, rn_ofs, rm_ofs, \ - oprsz, maxsz, &OPARRAY[vece]); \ - } \ - DO_3SAME(INSN, gen_##INSN##_3s) - -DO_3SAME_GVEC3_SHIFT(VSHL_S, sshl_op) -DO_3SAME_GVEC3_SHIFT (VSHL_U , ushl_op)
target/arm/translate.c +79 -67
164 lines not on this page · raw message
Signature · 1 line
2.20.1
Re: [PATCH v3 09/16] target/arm: Create gen_gvec_{cmtst,ushl,sshl}
Quoted 7 lines · Richard Henderson
Provide a functional interface for the vector expansion. This fits better with the existing set of helpers that we provide for other operations.
Signed-off-by Richard Henderson <[email protected]>---
thanks
-- PMM
PATCH v3 10/16 target/arm: Create gen_gvec_{uqadd, sqadd, uqsub, sqsub}
In reply to Richard HendersonProvide a functional interface for the vector expansion. This fits better with the existing set of helpers that we provide for other operations.
--- target/arm/translate.h | 13 +- target/arm/translate-a64.c | 22 ++- target/arm/translate-neon.inc.c | 19 +-- target/arm/translate.c | 228 +++++++++++++++++--------------- 4 files changed, 147 insertions(+), 135 deletions(-)
target/arm/translate.h +9 -4
@@ -298,16 +298,21 @@ void gen_gvec_sshl(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs,void gen_gvec_ushl (unsigned vece,uint32_t rd_ofs,uint32_t rn_ofs,uint32_t rm_ofs,uint32_t opr_sz,uint32_t max_sz); -extern const GVecGen4 uqadd_op[4 ]; -extern const GVecGen4 sqadd_op[4 ]; -extern const GVecGen4 uqsub_op[4 ]; -extern const GVecGen4 sqsub_op[4 ];void gen_cmtst_i64 (TCGv_i64 d,TCGv_i64 a,TCGv_i64 b);void gen_ushl_i32 (TCGv_i32 d,TCGv_i32 a,TCGv_i32 b);void gen_sshl_i32 (TCGv_i32 d,TCGv_i32 a,TCGv_i32 b);void gen_ushl_i64 (TCGv_i64 d,TCGv_i64 a,TCGv_i64 b);void gen_sshl_i64 (TCGv_i64 d,TCGv_i64 a,TCGv_i64 b); +void gen_gvec_uqadd_qc (unsigned vece,uint32_t rd_ofs,uint32_t rn_ofs, +uint32_t rm_ofs,uint32_t opr_sz,uint32_t max_sz); +void gen_gvec_sqadd_qc (unsigned vece,uint32_t rd_ofs,uint32_t rn_ofs, +uint32_t rm_ofs,uint32_t opr_sz,uint32_t max_sz); +void gen_gvec_uqsub_qc (unsigned vece,uint32_t rd_ofs,uint32_t rn_ofs, +uint32_t rm_ofs,uint32_t opr_sz,uint32_t max_sz); +void gen_gvec_sqsub_qc (unsigned vece,uint32_t rd_ofs,uint32_t rn_ofs, +uint32_t rm_ofs,uint32_t opr_sz,uint32_t max_sz); +void gen_gvec_ssra (unsigned vece,uint32_t rd_ofs,uint32_t rm_ofs,int64_t shift,uint32_t opr_sz,uint32_t max_sz); void gen_gvec_usra(unsigned vece, uint32_t rd_ofs, uint32_t rm_ofs,
target/arm/translate-a64.c +10 -12
@@ -11168,20 +11168,18 @@ static void disas_simd_3same_int(DisasContext *s, uint32_t insn)switch (opcode) {case 0x01 :/* SQADD, UQADD */ -tcg_gen_gvec_4 (vec_full_reg_offset (s, rd), - offsetof(CPUARMState, vfp.qc), -vec_full_reg_offset (s, rn), -vec_full_reg_offset (s, rm), - is_q ?16 :8 ,vec_full_reg_size (s), - (u ? uqadd_op : sqadd_op) + size); +if (u) { +gen_gvec_fn3 (s, is_q, rd, rn, rm, gen_gvec_uqadd_qc, size); + }else { +gen_gvec_fn3 (s, is_q, rd, rn, rm, gen_gvec_sqadd_qc, size); + }return ;case 0x05 :/* SQSUB, UQSUB */ -tcg_gen_gvec_4 (vec_full_reg_offset (s, rd), - offsetof(CPUARMState, vfp.qc), -vec_full_reg_offset (s, rn), -vec_full_reg_offset (s, rm), - is_q ?16 :8 ,vec_full_reg_size (s), - (u ? uqsub_op : sqsub_op) + size); +if (u) { +gen_gvec_fn3 (s, is_q, rd, rn, rm, gen_gvec_uqsub_qc, size); + }else { +gen_gvec_fn3 (s, is_q, rd, rn, rm, gen_gvec_sqsub_qc, size); + }return ;case 0x08 :/* SSHL, USHL */ if (u) {
target/arm/translate-neon.inc.c +4 -15
@@ -605,6 +605,10 @@ DO_3SAME(VORN, tcg_gen_gvec_orc) DO_3SAME(VEOR, tcg_gen_gvec_xor) DO_3SAME(VSHL_S, gen_gvec_sshl) DO_3SAME(VSHL_U, gen_gvec_ushl) +DO_3SAME(VQADD_S, gen_gvec_sqadd_qc) +DO_3SAME(VQADD_U, gen_gvec_uqadd_qc) +DO_3SAME(VQSUB_S, gen_gvec_sqsub_qc) +DO_3SAME (VQSUB_U , gen_gvec_uqsub_qc) /* These insns are all gvec_bitsel but with the inputs in various orders. */#define DO_3SAME_BITSEL (INSN ,O1 ,O2 ,O3 ) \
@@ -653,21 +657,6 @@ DO_3SAME_CMP(VCGE_S, TCG_COND_GE) DO_3SAME_CMP(VCGE_U, TCG_COND_GEU) DO_3SAME_CMP(VCEQ, TCG_COND_EQ) -#define DO_3SAME_GVEC4 (INSN ,OPARRAY ) \ - static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, \ - uint32_t rn_ofs, uint32_t rm_ofs, \ - uint32_t oprsz, uint32_t maxsz) \ - { \ - tcg_gen_gvec_4(rd_ofs, offsetof(CPUARMState, vfp.qc), \ - rn_ofs, rm_ofs, oprsz, maxsz, &OPARRAY[vece]); \ - } \ - DO_3SAME(INSN, gen_##INSN##_3s) - -DO_3SAME_GVEC4(VQADD_S, sqadd_op) -DO_3SAME_GVEC4(VQADD_U, uqadd_op) -DO_3SAME_GVEC4(VQSUB_S, sqsub_op) -DO_3SAME_GVEC4(VQSUB_U, uqsub_op) -static void gen_VMUL_p_3s (unsigned vece,uint32_t rd_ofs,uint32_t rn_ofs,uint32_t rm_ofs,uint32_t oprsz,uint32_t maxsz) {
target/arm/translate.c +124 -104
252 lines not on this page · raw message
Signature · 1 line
2.20.1
Re: [PATCH v3 10/16] target/arm: Create gen_gvec_{uqadd, sqadd, uqsub, sqsub}
Quoted 7 lines · Richard Henderson
Provide a functional interface for the vector expansion. This fits better with the existing set of helpers that we provide for other operations.
Signed-off-by Richard Henderson <[email protected]>--
thanks
-- PMM
PATCH v3 11/16 target/arm: Remove fp_status from helper_{recpe, rsqrte}_u32
In reply to Richard HendersonThese operations do not touch fp_status.
--- target/arm/helper.h | 4 ++-- target/arm/translate-a64.c | 5 ++--- target/arm/translate.c | 12 ++---------- target/arm/vfp_helper.c | 4 ++-- 4 files changed, 8 insertions(+), 17 deletions(-)
target/arm/helper.h +2 -2
@@ -211,8 +211,8 @@ DEF_HELPER_FLAGS_2(recpe_f64, TCG_CALL_NO_RWG, f64, f64, ptr) DEF_HELPER_FLAGS_2(rsqrte_f16, TCG_CALL_NO_RWG, f16, f16, ptr) DEF_HELPER_FLAGS_2(rsqrte_f32, TCG_CALL_NO_RWG, f32, f32, ptr) DEF_HELPER_FLAGS_2(rsqrte_f64, TCG_CALL_NO_RWG, f64, f64, ptr) -DEF_HELPER_2(recpe_u32, i32, i32, ptr) -DEF_HELPER_FLAGS_2(rsqrte_u32, TCG_CALL_NO_RWG, i32, i32, ptr) +DEF_HELPER_FLAGS_1(recpe_u32, TCG_CALL_NO_RWG, i32, i32) +DEF_HELPER_FLAGS_1(rsqrte_u32, TCG_CALL_NO_RWG, i32, i32) DEF_HELPER_FLAGS_4(neon_tbl, TCG_CALL_NO_RWG, i32, i32, i32, ptr, i32)DEF_HELPER_3 (shl_cc, i32, env, i32, i32)
target/arm/translate-a64.c +2 -3
@@ -9699,7 +9699,7 @@ static void handle_2misc_reciprocal(DisasContext *s, int opcode,switch (opcode) {case 0x3c :/* URECPE */ -gen_helper_recpe_u32 (tcg_res, tcg_op, fpst); +gen_helper_recpe_u32 (tcg_res, tcg_op);break ;case 0x3d :/* FRECPE */ gen_helper_recpe_f32 (tcg_res, tcg_op, fpst);
@@ -12244,7 +12244,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn)unallocated_encoding (s);return ; } - need_fpstatus = true;break ;case 0x1e :/* FRINT32Z */ case 0x1f :/* FRINT64Z */
@@ -12412,7 +12411,7 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn)gen_helper_rints_exact (tcg_res, tcg_op, tcg_fpstatus);break ;case 0x7c :/* URSQRTE */ -gen_helper_rsqrte_u32 (tcg_res, tcg_op, tcg_fpstatus); +gen_helper_rsqrte_u32 (tcg_res, tcg_op);break ;case 0x1e :/* FRINT32Z */ case 0x5e :/* FRINT32X */
target/arm/translate.c +2 -10
@@ -6873,19 +6873,11 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)break ; }case NEON_2RM_VRECPE : - { -TCGv_ptr fpstatus =get_fpstatus_ptr (1 ); -gen_helper_recpe_u32 (tmp, tmp, fpstatus); -tcg_temp_free_ptr (fpstatus); +gen_helper_recpe_u32 (tmp, tmp);break ; - }case NEON_2RM_VRSQRTE : - { -TCGv_ptr fpstatus =get_fpstatus_ptr (1 ); -gen_helper_rsqrte_u32 (tmp, tmp, fpstatus); -tcg_temp_free_ptr (fpstatus); +gen_helper_rsqrte_u32 (tmp, tmp);break ; - }case NEON_2RM_VRECPE_F : {TCGv_ptr fpstatus =get_fpstatus_ptr (1 );
target/arm/vfp_helper.c +2 -2
@@ -1023,7 +1023,7 @@ float64 HELPER(rsqrte_f64)(float64 input, void *fpstp)return make_float64 (val); } -uint32_t HELPER (recpe_u32 )(uint32_t a,void *fpstp) +uint32_t HELPER (recpe_u32 )(uint32_t a) {/* float_status *s = fpstp; */ int input, estimate;
@@ -1038,7 +1038,7 @@ uint32_t HELPER(recpe_u32)(uint32_t a, void *fpstp)return deposit32 (0 , (32 -9 ),9 , estimate); } -uint32_t HELPER (rsqrte_u32 )(uint32_t a,void *fpstp) +uint32_t HELPER (rsqrte_u32 )(uint32_t a) {int estimate;
Signature · 1 line
2.20.1
Re: [PATCH v3 11/16] target/arm: Remove fp_status from helper_{recpe, rsqrte}_u32
Quoted 11 lines · Richard Henderson
These operations do not touch
fp_status.Signed-off-by Richard Henderson <[email protected]>---
target/arm/vfp_helper.c +0
-0
target/arm/vfp_helper.c float64 HELPER(rsqrte_f64)(float64 input, void *fpstp) · line 1028
Quoted 7 lines
target/arm/vfp_helper.c +1
-1@@ -1023,7 +1023,7 @@ float64 HELPER(rsqrte_f64)(float64 input, void *fpstp)return make_float64 (val); } -uint32_t HELPER (recpe_u32 )(uint32_t a,void *fpstp) +uint32_t HELPER (recpe_u32 )(uint32_t a) {/* float_status *s = fpstp; */
We should delete this stale commented out line of code too.
target/arm/vfp_helper.c uint32_t HELPER(recpe_u32)(uint32_t a, void *fpstp) · line 1043
Quoted 9 lines
target/arm/vfp_helper.c +1
-1int input, estimate;@@ -1038,7 +1038,7 @@ uint32_t HELPER(recpe_u32)(uint32_t a, void *fpstp)return deposit32 (0 , (32 -9 ),9 , estimate); } -uint32_t HELPER (rsqrte_u32 )(uint32_t a,void *fpstp) +uint32_t HELPER (rsqrte_u32 )(uint32_t a) {int estimate;
Otherwise
thanks
-- PMM
PATCH v3 12/16 target/arm: Create gen_gvec_{qrdmla,qrdmls}
In reply to Richard HendersonProvide a functional interface for the vector expansion. This fits better with the existing set of helpers that we provide for other operations.
--- target/arm/translate.h | 5 ++++ target/arm/translate-a64.c | 34 ++---------------------- target/arm/translate.c | 54 +++++++++++++++++++------------------- 3 files changed, 34 insertions(+), 59 deletions(-)
target/arm/translate.h +5 -0
@@ -332,6 +332,11 @@ void gen_gvec_sri(unsigned vece, uint32_t rd_ofs, uint32_t rm_ofs,void gen_gvec_sli (unsigned vece,uint32_t rd_ofs,uint32_t rm_ofs,int64_t shift,uint32_t opr_sz,uint32_t max_sz); +void gen_gvec_sqrdmlah_qc (unsigned vece,uint32_t rd_ofs,uint32_t rn_ofs, +uint32_t rm_ofs,uint32_t opr_sz,uint32_t max_sz); +void gen_gvec_sqrdmlsh_qc (unsigned vece,uint32_t rd_ofs,uint32_t rn_ofs, +uint32_t rm_ofs,uint32_t opr_sz,uint32_t max_sz); +/* * Forward to the isar_feature_* tests given a DisasContext pointer. */
target/arm/translate-a64.c +2 -32
@@ -587,18 +587,6 @@ static void gen_gvec_op3_ool(DisasContext *s, bool is_q, int rd, is_q ? 16 : 8, vec_full_reg_size(s), data, fn); } -/* Expand a 3-operand + env pointer operation using -* an out-of-line helper. -*/ -static void gen_gvec_op3_env (DisasContext *s,bool is_q,int rd, -int rn,int rm,gen_helper_gvec_3_ptr *fn) -{ -tcg_gen_gvec_3_ptr (vec_full_reg_offset (s, rd), -vec_full_reg_offset (s, rn), -vec_full_reg_offset (s, rm), cpu_env, - is_q ?16 :8 ,vec_full_reg_size (s),0 , fn); -} -/* Expand a 3-operand + fpstatus pointer + simd data value operation using * an out-of-line helper. */
@@ -11693,29 +11681,11 @@ static void disas_simd_three_reg_same_extra(DisasContext *s, uint32_t insn)switch (opcode) {case 0x0 :/* SQRDMLAH (vector) */ -switch (size) { -case 1 : -gen_gvec_op3_env (s, is_q, rd, rn, rm, gen_helper_gvec_qrdmlah_s16); -break ; -case 2 : -gen_gvec_op3_env (s, is_q, rd, rn, rm, gen_helper_gvec_qrdmlah_s32); -break ; -default : -g_assert_not_reached (); - } +gen_gvec_fn3 (s, is_q, rd, rn, rm, gen_gvec_sqrdmlah_qc, size);return ;case 0x1 :/* SQRDMLSH (vector) */ -switch (size) { -case 1 : -gen_gvec_op3_env (s, is_q, rd, rn, rm, gen_helper_gvec_qrdmlsh_s16); -break ; -case 2 : -gen_gvec_op3_env (s, is_q, rd, rn, rm, gen_helper_gvec_qrdmlsh_s32); -break ; -default : -g_assert_not_reached (); - } +gen_gvec_fn3 (s, is_q, rd, rn, rm, gen_gvec_sqrdmlsh_qc, size);return ;case 0x2 :/* SDOT / UDOT */
target/arm/translate.c +27 -27
73 lines not on this page · raw message
Signature · 1 line
2.20.1
Re: [PATCH v3 12/16] target/arm: Create gen_gvec_{qrdmla,qrdmls}
Quoted 6 lines · Richard Henderson
Provide a functional interface for the vector expansion. This fits better with the existing set of helpers that we provide for other operations.
Signed-off-by Richard Henderson <[email protected]>
thanks
-- PMM
PATCH v3 13/16 target/arm: Pass pointer to qc to qrdmla/qrdmls
In reply to Richard HendersonPass a pointer directly to env->vfp.qc[0], rather than env. This will allow SVE2, which does not modify QC, to pass a pointer to dummy storage.
--- target/arm/translate.c | 18 ++++++++--- target/arm/vec_helper.c | 70 +++++++++++++++++++++++------------------ 2 files changed, 54 insertions(+), 34 deletions(-)
target/arm/translate.c +14 -4
@@ -3629,6 +3629,18 @@ static const uint8_t neon_2rm_sizes[] = { [NEON_2RM_VCVT_UF] = 0x4, }; +static void gen_gvec_fn3_qc (uint32_t rd_ofs,uint32_t rn_ofs,uint32_t rm_ofs, +uint32_t opr_sz,uint32_t max_sz, +gen_helper_gvec_3_ptr *fn) +{ +TCGv_ptr qc_ptr =tcg_temp_new_ptr (); + + tcg_gen_addi_ptr(qc_ptr, cpu_env, offsetof(CPUARMState, vfp.qc)); +tcg_gen_gvec_3_ptr (rd_ofs, rn_ofs, rm_ofs, qc_ptr, + opr_sz, max_sz,0 , fn); +tcg_temp_free_ptr (qc_ptr); +} +void gen_gvec_sqrdmlah_qc (unsigned vece,uint32_t rd_ofs,uint32_t rn_ofs,uint32_t rm_ofs,uint32_t opr_sz,uint32_t max_sz) {
@@ -3636,8 +3648,7 @@ void gen_gvec_sqrdmlah_qc(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, gen_helper_gvec_qrdmlah_s16, gen_helper_gvec_qrdmlah_s32 };tcg_debug_assert (vece >=1 && vece <=2 ); -tcg_gen_gvec_3_ptr (rd_ofs, rn_ofs, rm_ofs, cpu_env, - opr_sz, max_sz,0 , fns[vece -1 ]); +gen_gvec_fn3_qc (rd_ofs, rn_ofs, rm_ofs, opr_sz, max_sz, fns[vece -1 ]); } void gen_gvec_sqrdmlsh_qc(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs,
@@ -3647,8 +3658,7 @@ void gen_gvec_sqrdmlsh_qc(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, gen_helper_gvec_qrdmlsh_s16, gen_helper_gvec_qrdmlsh_s32 };tcg_debug_assert (vece >=1 && vece <=2 ); -tcg_gen_gvec_3_ptr (rd_ofs, rn_ofs, rm_ofs, cpu_env, - opr_sz, max_sz,0 , fns[vece -1 ]); +gen_gvec_fn3_qc (rd_ofs, rn_ofs, rm_ofs, opr_sz, max_sz, fns[vece -1 ]); }#define GEN_CMP0 (NAME ,COND ) \
target/arm/vec_helper.c +40 -30
185 lines not on this page · raw message
Signature · 1 line
2.20.1
Re: [PATCH v3 13/16] target/arm: Pass pointer to qc to qrdmla/qrdmls
target/arm/vec_helper.c static void clear_tail(void *vd, uintptr_t opr_sz, uintptr_t max_sz) · line 51
Quoted 13 lines · Richard Henderson
Pass a pointer directly to env->vfp.qc[0], rather than env. This will allow SVE2, which does not modify QC, to pass a pointer to dummy storage.
Signed-off-by Richard Henderson <[email protected]>---
/* Signed saturating rounding doubling multiply-accumulate high half, 16-bit */
target/arm/vec_helper.c +2
-2-static uint16_t inl_qrdmlah_s16 (CPUARMState *env,int16_t src1, -int16_t src2,int16_t src3) +static int16_t inl_qrdmlah_s16 (int16_t src1,int16_t src2, +int16_t src3,uint32_t *sat)
Why has the return type changed here ? The new type does make more sense (there's no behaviour change since the return value is always assigned to either an int16_t or uint16_t lvalue), but it also doesn't seem related to the passing-of-QC that this patch is doing.
target/arm/vec_helper.c static uint16_t inl_qrdmlah_s16(CPUARMState *env, int16_t src1, · line 93
Quoted 9 lines
{
/* Simplify:
* = ((a3 << 16) + ((e1 * e2) << 1) + (1 << 15)) >> 16/* Signed saturating rounding doubling multiply-subtract high half, 16-bit */
target/arm/vec_helper.c +2
-2-static uint16_t inl_qrdmlsh_s16 (CPUARMState *env,int16_t src1, -int16_t src2,int16_t src3) +static int16_t inl_qrdmlsh_s16 (int16_t src1,int16_t src2, +int16_t src3,uint32_t *sat)
Ditto.
Otherwise
thanks
-- PMM
PATCH v3 14/16 target/arm: Clear tail in gvec_fmul_idx_*, gvec_fmla_idx_*
In reply to Richard HendersonMust clear the tail for AdvSIMD when SVE is enabled.
--- target/arm/vec_helper.c | 2 ++ 1 file changed, 2 insertions(+)
target/arm/vec_helper.c +2 -0
@@ -747,6 +747,7 @@ void HELPER(NAME)(void *vd, void *vn, void *vm, void *stat, uint32_t desc) \ d[i + j] = TYPE##_mul(n[i + j], mm, stat); \ } \ } \ +clear_tail (d, oprsz,simd_maxsz (desc)); \ }DO_MUL_IDX (gvec_fmul_idx_h, float16,H2 )
@@ -771,6 +772,7 @@ void HELPER(NAME)(void *vd, void *vn, void *vm, void *va, \ mm, a[i + j], 0, stat); \ } \ } \ +clear_tail (d, oprsz,simd_maxsz (desc)); \ }DO_FMLA_IDX (gvec_fmla_idx_h, float16,H2 )
Signature · 1 line
2.20.1
Re: [PATCH v3 14/16] target/arm: Clear tail in gvec_fmul_idx_*, gvec_fmla_idx_*
Quoted 5 lines · Richard Henderson
Must clear the tail for AdvSIMD when SVE is enabled.
Fixes ca40a6e6e39Signed-off-by Richard Henderson <[email protected]>
Is it worth adding a "Cc: [email protected]" ?
thanks
-- PMM
PATCH v3 15/16 target/arm: Vectorize SABD/UABD
In reply to Richard HendersonInclude 64-bit element size in preparation for SVE2.
--- target/arm/helper.h | 10 +++ target/arm/translate.h | 5 ++ target/arm/translate-a64.c | 8 ++- target/arm/translate.c | 133 ++++++++++++++++++++++++++++++++++++- target/arm/vec_helper.c | 24 +++++++ 5 files changed, 176 insertions(+), 4 deletions(-)
target/arm/helper.h +10 -0
@@ -731,6 +731,16 @@ DEF_HELPER_FLAGS_3(gvec_sli_h, TCG_CALL_NO_RWG, void, ptr, ptr, i32) DEF_HELPER_FLAGS_3(gvec_sli_s, TCG_CALL_NO_RWG, void, ptr, ptr, i32) DEF_HELPER_FLAGS_3(gvec_sli_d, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_sabd_b, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_sabd_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_sabd_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_sabd_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) + +DEF_HELPER_FLAGS_4(gvec_uabd_b, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_uabd_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_uabd_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_uabd_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +#ifdef TARGET_AARCH64 #include "helper-a64.h" #include "helper-sve.h"
target/arm/translate.h +5 -0
@@ -337,6 +337,11 @@ void gen_gvec_sqrdmlah_qc(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs,void gen_gvec_sqrdmlsh_qc (unsigned vece,uint32_t rd_ofs,uint32_t rn_ofs,uint32_t rm_ofs,uint32_t opr_sz,uint32_t max_sz); +void gen_gvec_sabd (unsigned vece,uint32_t rd_ofs,uint32_t rn_ofs, +uint32_t rm_ofs,uint32_t opr_sz,uint32_t max_sz); +void gen_gvec_uabd (unsigned vece,uint32_t rd_ofs,uint32_t rn_ofs, +uint32_t rm_ofs,uint32_t opr_sz,uint32_t max_sz); +/* * Forward to the isar_feature_* tests given a DisasContext pointer. */
target/arm/translate-a64.c +7 -1
@@ -11190,6 +11190,13 @@ static void disas_simd_3same_int(DisasContext *s, uint32_t insn)gen_gvec_fn3 (s, is_q, rd, rn, rm, tcg_gen_gvec_smin, size); }return ; +case 0xe :/* SABD, UABD */ +if (u) { +gen_gvec_fn3 (s, is_q, rd, rn, rm, gen_gvec_uabd, size); + }else { +gen_gvec_fn3 (s, is_q, rd, rn, rm, gen_gvec_sabd, size); + } +return ;case 0x10 :/* ADD, SUB */ if (u) {gen_gvec_fn3 (s, is_q, rd, rn, rm, tcg_gen_gvec_sub, size);
@@ -11322,7 +11329,6 @@ static void disas_simd_3same_int(DisasContext *s, uint32_t insn) genenvfn = fns[size][u];break ; } -case 0xe :/* SABD, UABD */ case 0xf :/* SABA, UABA */ {static NeonGenTwoOpFn *const fns[3 ][2 ] = {
target/arm/translate.c +130 -3
151 lines not on this page · raw message
target/arm/vec_helper.c +24 -0
@@ -1407,3 +1407,27 @@ DO_CMP0(gvec_cgt0_h, int16_t, >) DO_CMP0(gvec_cge0_h, int16_t, >=) #undef DO_CMP0 + +#define DO_ABD(NAME, TYPE) \ +void HELPER(NAME)(void *vd, void *vn, void *vm, uint32_t desc) \ +{ \ +intptr_t i, opr_sz =simd_oprsz (desc); \ +TYPE *d = vd, *n = vn, *m = vm; \ + \ +for (i =0 ; i < opr_sz /sizeof (TYPE ); ++i) { \ + d[i] = n[i] < m[i] ? m[i] - n[i] : n[i] - m[i]; \ + } \ +clear_tail (d, opr_sz,simd_maxsz (desc)); \ +} + +DO_ABD(gvec_sabd_b, int8_t) +DO_ABD(gvec_sabd_h, int16_t) +DO_ABD(gvec_sabd_s, int32_t) +DO_ABD(gvec_sabd_d, int64_t) + +DO_ABD(gvec_uabd_b, uint8_t) +DO_ABD(gvec_uabd_h, uint16_t) +DO_ABD(gvec_uabd_s, uint32_t) +DO_ABD(gvec_uabd_d, uint64_t) + +#undef DO_ABD
Signature · 1 line
2.20.1
Re: [PATCH v3 15/16] target/arm: Vectorize SABD/UABD
Quoted 4 lines · Richard Henderson
Include 64-bit element size in preparation for SVE2.
Signed-off-by Richard Henderson <[email protected]>
thanks
-- PMM
PATCH v3 16/16 target/arm: Vectorize SABA/UABA
In reply to Richard HendersonInclude 64-bit element size in preparation for SVE2.
--- target/arm/helper.h | 17 +++-- target/arm/translate.h | 5 ++ target/arm/neon_helper.c | 10 --- target/arm/translate-a64.c | 17 ++--- target/arm/translate.c | 134 +++++++++++++++++++++++++++++++++++-- target/arm/vec_helper.c | 24 +++++++ 6 files changed, 174 insertions(+), 33 deletions(-)
target/arm/helper.h +10 -7
@@ -284,13 +284,6 @@ DEF_HELPER_2(neon_pmax_s8, i32, i32, i32) DEF_HELPER_2(neon_pmax_u16, i32, i32, i32) DEF_HELPER_2(neon_pmax_s16, i32, i32, i32) -DEF_HELPER_2(neon_abd_u8, i32, i32, i32) -DEF_HELPER_2(neon_abd_s8, i32, i32, i32) -DEF_HELPER_2(neon_abd_u16, i32, i32, i32) -DEF_HELPER_2(neon_abd_s16, i32, i32, i32) -DEF_HELPER_2(neon_abd_u32, i32, i32, i32) -DEF_HELPER_2(neon_abd_s32, i32, i32, i32) - DEF_HELPER_2(neon_shl_u16, i32, i32, i32) DEF_HELPER_2(neon_shl_s16, i32, i32, i32)DEF_HELPER_2 (neon_rshl_u8, i32, i32, i32)
@@ -741,6 +734,16 @@ DEF_HELPER_FLAGS_4(gvec_uabd_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_uabd_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_uabd_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_saba_b, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_saba_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_saba_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_saba_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) + +DEF_HELPER_FLAGS_4(gvec_uaba_b, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_uaba_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_uaba_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_uaba_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +#ifdef TARGET_AARCH64 #include "helper-a64.h" #include "helper-sve.h"
target/arm/translate.h +5 -0
@@ -342,6 +342,11 @@ void gen_gvec_sabd(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs,void gen_gvec_uabd (unsigned vece,uint32_t rd_ofs,uint32_t rn_ofs,uint32_t rm_ofs,uint32_t opr_sz,uint32_t max_sz); +void gen_gvec_saba (unsigned vece,uint32_t rd_ofs,uint32_t rn_ofs, +uint32_t rm_ofs,uint32_t opr_sz,uint32_t max_sz); +void gen_gvec_uaba (unsigned vece,uint32_t rd_ofs,uint32_t rn_ofs, +uint32_t rm_ofs,uint32_t opr_sz,uint32_t max_sz); +/* * Forward to the isar_feature_* tests given a DisasContext pointer. */
target/arm/neon_helper.c +0 -10
@@ -576,16 +576,6 @@ NEON_POP(pmax_s16, neon_s16, 2) NEON_POP(pmax_u16, neon_u16, 2)#undef NEON_FN -#define NEON_FN (dest, src1, src2) \ - dest = (src1 > src2) ? (src1 - src2) : (src2 - src1) -NEON_VOP(abd_s8, neon_s8, 4) -NEON_VOP(abd_u8, neon_u8, 4) -NEON_VOP(abd_s16, neon_s16, 2) -NEON_VOP(abd_u16, neon_u16, 2) -NEON_VOP(abd_s32, neon_s32, 1) -NEON_VOP(abd_u32, neon_u32, 1) -#undef NEON_FN -#define NEON_FN (dest, src1, src2) do { \ int8_t tmp; \ tmp = (int8_t)src2; \
target/arm/translate-a64.c +7 -10
@@ -11197,6 +11197,13 @@ static void disas_simd_3same_int(DisasContext *s, uint32_t insn)gen_gvec_fn3 (s, is_q, rd, rn, rm, gen_gvec_sabd, size); }return ; +case 0xf :/* SABA, UABA */ +if (u) { +gen_gvec_fn3 (s, is_q, rd, rn, rm, gen_gvec_uaba, size); + }else { +gen_gvec_fn3 (s, is_q, rd, rn, rm, gen_gvec_saba, size); + } +return ;case 0x10 :/* ADD, SUB */ if (u) {gen_gvec_fn3 (s, is_q, rd, rn, rm, tcg_gen_gvec_sub, size);
@@ -11329,16 +11336,6 @@ static void disas_simd_3same_int(DisasContext *s, uint32_t insn) genenvfn = fns[size][u];break ; } -case 0xf :/* SABA, UABA */ - { -static NeonGenTwoOpFn *const fns[3 ][2 ] = { - { gen_helper_neon_abd_s8, gen_helper_neon_abd_u8 }, - { gen_helper_neon_abd_s16, gen_helper_neon_abd_u16 }, - { gen_helper_neon_abd_s32, gen_helper_neon_abd_u32 }, - }; - genfn = fns[size][u]; -break ; - }case 0x16 :/* SQDMULH, SQRDMULH */ {static NeonGenTwoOpEnvFn *const fns[2 ][2 ] = {
target/arm/translate.c +128 -6
152 lines not on this page · raw message
target/arm/vec_helper.c +24 -0
@@ -1431,3 +1431,27 @@ DO_ABD(gvec_uabd_s, uint32_t) DO_ABD(gvec_uabd_d, uint64_t)#undef DO_ABD + +#define DO_ABA (NAME ,TYPE ) \ +void HELPER(NAME)(void *vd, void *vn, void *vm, uint32_t desc) \ +{ \ + intptr_t i, opr_sz = simd_oprsz(desc); \ + TYPE *d = vd, *n = vn, *m = vm; \ + \ + for (i = 0; i < opr_sz / sizeof(TYPE); ++i) { \ + d[i] += n[i] < m[i] ? m[i] - n[i] : n[i] - m[i]; \ + } \ + clear_tail(d, opr_sz, simd_maxsz(desc)); \ +} + +DO_ABA(gvec_saba_b, int8_t) +DO_ABA(gvec_saba_h, int16_t) +DO_ABA(gvec_saba_s, int32_t) +DO_ABA(gvec_saba_d, int64_t) + +DO_ABA(gvec_uaba_b, uint8_t) +DO_ABA(gvec_uaba_h, uint16_t) +DO_ABA(gvec_uaba_s, uint32_t) +DO_ABA(gvec_uaba_d, uint64_t) + +#undef DO_ABA
Signature · 1 line
2.20.1
Re: [PATCH v3 16/16] target/arm: Vectorize SABA/UABA
Quoted 4 lines · Richard Henderson
Include 64-bit element size in preparation for SVE2.
Signed-off-by Richard Henderson <[email protected]>
thanks
-- PMM
Quoted 9 lines · Richard Henderson
This is not complete, but shows the direction I'd like to go.
Version 2 extracts more bits from my sve2 branch. There's still more to pull back, especially for
crypto_helper.c, where there are also tail clearing bugs to fix.Version 3 rebases on master, which has some of the arm neon decodetree conversion applied.
Something in this patchset produces a failure on VRSRA:
testcases/aarch32-all-v80/insn_VRSRA__INC.risu.bin from Alex's set produces different results.
thanks
-- PMM