mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
target/arm: Implement MVE VMLALDAV
Implement the MVE VMLALDAV insn, which multiplies pairs of integer elements, accumulating them into a 64-bit result in a pair of general-purpose registers. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20210617121628.20116-20-peter.maydell@linaro.org
This commit is contained in:
parent
ac6ad1dca8
commit
1d2386f70a
5 changed files with 163 additions and 0 deletions
|
@ -31,6 +31,7 @@
|
|||
typedef void MVEGenLdStFn(TCGv_ptr, TCGv_ptr, TCGv_i32);
|
||||
typedef void MVEGenOneOpFn(TCGv_ptr, TCGv_ptr, TCGv_ptr);
|
||||
typedef void MVEGenTwoOpFn(TCGv_ptr, TCGv_ptr, TCGv_ptr, TCGv_ptr);
|
||||
typedef void MVEGenDualAccOpFn(TCGv_i64, TCGv_ptr, TCGv_ptr, TCGv_ptr, TCGv_i64);
|
||||
|
||||
/* Return the offset of a Qn register (same semantics as aa32_vfp_qreg()) */
|
||||
static inline long mve_qreg_offset(unsigned reg)
|
||||
|
@ -88,6 +89,22 @@ static void mve_update_eci(DisasContext *s)
|
|||
}
|
||||
}
|
||||
|
||||
static bool mve_skip_first_beat(DisasContext *s)
|
||||
{
|
||||
/* Return true if PSR.ECI says we must skip the first beat of this insn */
|
||||
switch (s->eci) {
|
||||
case ECI_NONE:
|
||||
return false;
|
||||
case ECI_A0:
|
||||
case ECI_A0A1:
|
||||
case ECI_A0A1A2:
|
||||
case ECI_A0A1A2B0:
|
||||
return true;
|
||||
default:
|
||||
g_assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
static bool do_ldst(DisasContext *s, arg_VLDR_VSTR *a, MVEGenLdStFn *fn)
|
||||
{
|
||||
TCGv_i32 addr;
|
||||
|
@ -365,3 +382,82 @@ DO_2OP(VMULL_BS, vmullbs)
|
|||
DO_2OP(VMULL_BU, vmullbu)
|
||||
DO_2OP(VMULL_TS, vmullts)
|
||||
DO_2OP(VMULL_TU, vmulltu)
|
||||
|
||||
static bool do_long_dual_acc(DisasContext *s, arg_vmlaldav *a,
|
||||
MVEGenDualAccOpFn *fn)
|
||||
{
|
||||
TCGv_ptr qn, qm;
|
||||
TCGv_i64 rda;
|
||||
TCGv_i32 rdalo, rdahi;
|
||||
|
||||
if (!dc_isar_feature(aa32_mve, s) ||
|
||||
!mve_check_qreg_bank(s, a->qn | a->qm) ||
|
||||
!fn) {
|
||||
return false;
|
||||
}
|
||||
/*
|
||||
* rdahi == 13 is UNPREDICTABLE; rdahi == 15 is a related
|
||||
* encoding; rdalo always has bit 0 clear so cannot be 13 or 15.
|
||||
*/
|
||||
if (a->rdahi == 13 || a->rdahi == 15) {
|
||||
return false;
|
||||
}
|
||||
if (!mve_eci_check(s) || !vfp_access_check(s)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
qn = mve_qreg_ptr(a->qn);
|
||||
qm = mve_qreg_ptr(a->qm);
|
||||
|
||||
/*
|
||||
* This insn is subject to beat-wise execution. Partial execution
|
||||
* of an A=0 (no-accumulate) insn which does not execute the first
|
||||
* beat must start with the current rda value, not 0.
|
||||
*/
|
||||
if (a->a || mve_skip_first_beat(s)) {
|
||||
rda = tcg_temp_new_i64();
|
||||
rdalo = load_reg(s, a->rdalo);
|
||||
rdahi = load_reg(s, a->rdahi);
|
||||
tcg_gen_concat_i32_i64(rda, rdalo, rdahi);
|
||||
tcg_temp_free_i32(rdalo);
|
||||
tcg_temp_free_i32(rdahi);
|
||||
} else {
|
||||
rda = tcg_const_i64(0);
|
||||
}
|
||||
|
||||
fn(rda, cpu_env, qn, qm, rda);
|
||||
tcg_temp_free_ptr(qn);
|
||||
tcg_temp_free_ptr(qm);
|
||||
|
||||
rdalo = tcg_temp_new_i32();
|
||||
rdahi = tcg_temp_new_i32();
|
||||
tcg_gen_extrl_i64_i32(rdalo, rda);
|
||||
tcg_gen_extrh_i64_i32(rdahi, rda);
|
||||
store_reg(s, a->rdalo, rdalo);
|
||||
store_reg(s, a->rdahi, rdahi);
|
||||
tcg_temp_free_i64(rda);
|
||||
mve_update_eci(s);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool trans_VMLALDAV_S(DisasContext *s, arg_vmlaldav *a)
|
||||
{
|
||||
static MVEGenDualAccOpFn * const fns[4][2] = {
|
||||
{ NULL, NULL },
|
||||
{ gen_helper_mve_vmlaldavsh, gen_helper_mve_vmlaldavxsh },
|
||||
{ gen_helper_mve_vmlaldavsw, gen_helper_mve_vmlaldavxsw },
|
||||
{ NULL, NULL },
|
||||
};
|
||||
return do_long_dual_acc(s, a, fns[a->size][a->x]);
|
||||
}
|
||||
|
||||
static bool trans_VMLALDAV_U(DisasContext *s, arg_vmlaldav *a)
|
||||
{
|
||||
static MVEGenDualAccOpFn * const fns[4][2] = {
|
||||
{ NULL, NULL },
|
||||
{ gen_helper_mve_vmlaldavuh, NULL },
|
||||
{ gen_helper_mve_vmlaldavuw, NULL },
|
||||
{ NULL, NULL },
|
||||
};
|
||||
return do_long_dual_acc(s, a, fns[a->size][a->x]);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue