target/arm: Implement SVE2 SPLICE, EXT
RFC PATCH 1/1 target/arm: Implement SVE2 SPLICE, EXT
Signed-off-by Stephen Long <[email protected]>
I'm not sure I can just use the SVE helper functions for the SVE2 variants of EXT and SPLICE.
--- target/arm/sve.decode | 8 ++++++++ target/arm/translate-sve.c | 39 +++++++++++++++++++++++++++++++++----- 2 files changed, 42 insertions(+), 5 deletions(-)
target/arm/sve.decode +8 -0
@@ -1387,3 +1387,11 @@ UMLSLT_zzzw 01000100 .. 0 ..... 010 111 ..... ..... @rda_rn_rm CMLA_zzzz 01000100 esz:2 0 rm:5 0010 rot:2 rn:5 rd:5 ra=%reg_movprfx SQRDCMLAH_zzzz 01000100 esz:2 0 rm:5 0011 rot:2 rn:5 rd:5 ra=%reg_movprfx + +### SVE2 vector splice (predicated, constructive) + +SPLICE_zpz 00000101 .. 101 101 100 ... ..... ..... @rd_pg_rn + +### SVE2 extract vector (immediate offset) +EXT_zzi 00000101 011 ..... 000 ... rn:5 rd:5 \ + &rri imm=%imm8_16_10
target/arm/translate-sve.c +34 -5
@@ -2269,18 +2269,18 @@ static bool trans_CPY_z_i(DisasContext *s, arg_CPY_z_i *a)*** SVE Permute Extract Group */ -static bool trans_EXT (DisasContext *s,arg_EXT *a) +static bool do_EXT (DisasContext *s,int rd,int rn,int rm,int imm) {if (!sve_access_check (s)) {return true; }unsigned vsz =vec_full_reg_size (s); -unsigned n_ofs = a->imm >= vsz ?0 : a->imm; +unsigned n_ofs = imm >= vsz ?0 : imm;unsigned n_siz = vsz - n_ofs; -unsigned d =vec_full_reg_offset (s, a->rd); -unsigned n =vec_full_reg_offset (s, a->rn); -unsigned m =vec_full_reg_offset (s, a->rm); +unsigned d =vec_full_reg_offset (s, rd); +unsigned n =vec_full_reg_offset (s, rn); +unsigned m =vec_full_reg_offset (s, rm);/* Use host vector move insns if we have appropriate sizes * and no unfortunate overlap.
@@ -2299,6 +2299,11 @@ static bool trans_EXT(DisasContext *s, arg_EXT *a)return true; } +static bool trans_EXT (DisasContext *s,arg_EXT *a) +{ +return do_EXT (s, a->rd, a->rn, a->rm, a->imm); +} +/* *** SVE Permute - Unpredicated Group */
@@ -7882,3 +7887,27 @@ static bool trans_SQRDCMLAH_zzzz(DisasContext *s, arg_CMLA_zzzz *a) };return do_sve2_zzzz_fn (s, a->rd, a->rn, a->rm, a->ra, fns[a->esz], a->rot); } + +static bool trans_SPLICE_zpz (DisasContext *s,arg_rpr_esz *a) +{ +if (!dc_isar_feature (aa64_sve2, s)) { +return false; + } +if (sve_access_check (s)) { +unsigned vsz =vec_full_reg_size (s); +tcg_gen_gvec_4_ool (vec_full_reg_offset (s, a->rd), +vec_full_reg_offset (s, a->rn), +vec_full_reg_offset (s, (a->rn +1 ) %32 ), +pred_full_reg_offset (s, a->pg), + vsz, vsz, a->esz, gen_helper_sve_splice); + } +return true; +} + +static bool trans_EXT_zzi (DisasContext *s,arg_rri *a) +{ +if (!dc_isar_feature (aa64_sve2, s)) { +return false; + } +return do_EXT (s, a->rd, a->rn, (a->rn +1 ) %32 , a->imm); +}
Signature · 1 line
2.17.1
Richard Henderson
AppliedQuoted 4 lines · Stephen Long
Signed-off-by Stephen Long <[email protected]>I'm not sure I can just use the SVE helper functions for the SVE2 variants of EXT and SPLICE.
Absolutely. The new insns are functionally identical to movprfx + the old
insn. I presume the new insns were added for code density reasons, but I don't know for sure.
target/arm/sve.decode UMLSLT_zzzw 01000100 .. 0 ..... 010 111 ..... ..... @rda_rn_rm · line 1396
Quoted 2 lines
target/arm/sve.decode +2
-0+SPLICE_zpz 00000101 .. 101 101 100 ... ..... ..... @rd_pg_rn +EXT_zzi 00000101 011 ..... 000 ... rn:5 rd:5 \
I have renamed these to SPLICE_sve2 and EXT_sve2, since the same suffix applies to the original too.
Applied to my SVE2 branch. Thanks!
r~