Skip to content

Commit

Permalink
target/arm: Implement SVE2 SPLICE, EXT
Browse files Browse the repository at this point in the history
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stephen Long <steplong@quicinc.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20210525010358.152808-48-richard.henderson@linaro.org
Message-Id: <20200423180347.9403-1-steplong@quicinc.com>
[rth: Rename the trans_* functions to *_sve2.]
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
  • Loading branch information
steplong authored and pm215 committed May 25, 2021
1 parent 4f26756 commit 7511479
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 7 deletions.
11 changes: 9 additions & 2 deletions target/arm/sve.decode
Expand Up @@ -494,10 +494,14 @@ CPY_z_i 00000101 .. 01 .... 00 . ........ ..... @rdn_pg4 imm=%sh8_i8s

### SVE Permute - Extract Group

# SVE extract vector (immediate offset)
# SVE extract vector (destructive)
EXT 00000101 001 ..... 000 ... rm:5 rd:5 \
&rrri rn=%reg_movprfx imm=%imm8_16_10

# SVE2 extract vector (constructive)
EXT_sve2 00000101 011 ..... 000 ... rn:5 rd:5 \
&rri imm=%imm8_16_10

### SVE Permute - Unpredicated Group

# SVE broadcast general register
Expand Down Expand Up @@ -588,9 +592,12 @@ REVH 00000101 .. 1001 01 100 ... ..... ..... @rd_pg_rn
REVW 00000101 .. 1001 10 100 ... ..... ..... @rd_pg_rn
RBIT 00000101 .. 1001 11 100 ... ..... ..... @rd_pg_rn

# SVE vector splice (predicated)
# SVE vector splice (predicated, destructive)
SPLICE 00000101 .. 101 100 100 ... ..... ..... @rdn_pg_rm

# SVE2 vector splice (predicated, constructive)
SPLICE_sve2 00000101 .. 101 101 100 ... ..... ..... @rd_pg_rn

### SVE Select Vectors Group

# SVE select vector elements (predicated)
Expand Down
35 changes: 30 additions & 5 deletions target/arm/translate-sve.c
Expand Up @@ -2266,18 +2266,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.
Expand All @@ -2296,6 +2296,19 @@ 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);
}

static bool trans_EXT_sve2(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);
}

/*
*** SVE Permute - Unpredicated Group
*/
Expand Down Expand Up @@ -3013,6 +3026,18 @@ static bool trans_SPLICE(DisasContext *s, arg_rprr_esz *a)
return true;
}

static bool trans_SPLICE_sve2(DisasContext *s, arg_rpr_esz *a)
{
if (!dc_isar_feature(aa64_sve2, s)) {
return false;
}
if (sve_access_check(s)) {
gen_gvec_ool_zzzp(s, gen_helper_sve_splice,
a->rd, a->rn, (a->rn + 1) % 32, a->pg, a->esz);
}
return true;
}

/*
*** SVE Integer Compare - Vectors Group
*/
Expand Down

0 comments on commit 7511479

Please sign in to comment.