mirror of
https://github.com/qemu/qemu.git
synced 2024-11-28 22:33:36 +08:00
target/arm: Implement MVE VABS
Implement the MVE VABS functions (both integer and floating point). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20210617121628.20116-8-peter.maydell@linaro.org
This commit is contained in:
parent
8abd3c80b1
commit
59c9177338
@ -49,3 +49,9 @@ DEF_HELPER_FLAGS_3(mve_vrev64h, TCG_CALL_NO_WG, void, env, ptr, ptr)
|
||||
DEF_HELPER_FLAGS_3(mve_vrev64w, TCG_CALL_NO_WG, void, env, ptr, ptr)
|
||||
|
||||
DEF_HELPER_FLAGS_3(mve_vmvn, TCG_CALL_NO_WG, void, env, ptr, ptr)
|
||||
|
||||
DEF_HELPER_FLAGS_3(mve_vabsb, TCG_CALL_NO_WG, void, env, ptr, ptr)
|
||||
DEF_HELPER_FLAGS_3(mve_vabsh, TCG_CALL_NO_WG, void, env, ptr, ptr)
|
||||
DEF_HELPER_FLAGS_3(mve_vabsw, TCG_CALL_NO_WG, void, env, ptr, ptr)
|
||||
DEF_HELPER_FLAGS_3(mve_vfabsh, TCG_CALL_NO_WG, void, env, ptr, ptr)
|
||||
DEF_HELPER_FLAGS_3(mve_vfabss, TCG_CALL_NO_WG, void, env, ptr, ptr)
|
||||
|
@ -77,3 +77,6 @@ VREV32 1111 1111 1 . 11 .. 00 ... 0 0000 11 . 0 ... 0 @1op
|
||||
VREV64 1111 1111 1 . 11 .. 00 ... 0 0000 01 . 0 ... 0 @1op
|
||||
|
||||
VMVN 1111 1111 1 . 11 00 00 ... 0 0101 11 . 0 ... 0 @1op_nosz
|
||||
|
||||
VABS 1111 1111 1 . 11 .. 01 ... 0 0011 01 . 0 ... 0 @1op
|
||||
VABS_fp 1111 1111 1 . 11 .. 01 ... 0 0111 01 . 0 ... 0 @1op
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "exec/helper-proto.h"
|
||||
#include "exec/cpu_ldst.h"
|
||||
#include "exec/exec-all.h"
|
||||
#include "tcg/tcg.h"
|
||||
|
||||
static uint16_t mve_element_mask(CPUARMState *env)
|
||||
{
|
||||
@ -281,3 +282,15 @@ DO_1OP(vrev64w, 8, uint64_t, wswap64)
|
||||
#define DO_NOT(N) (~(N))
|
||||
|
||||
DO_1OP(vmvn, 8, uint64_t, DO_NOT)
|
||||
|
||||
#define DO_ABS(N) ((N) < 0 ? -(N) : (N))
|
||||
#define DO_FABSH(N) ((N) & dup_const(MO_16, 0x7fff))
|
||||
#define DO_FABSS(N) ((N) & dup_const(MO_32, 0x7fffffff))
|
||||
|
||||
DO_1OP(vabsb, 1, int8_t, DO_ABS)
|
||||
DO_1OP(vabsh, 2, int16_t, DO_ABS)
|
||||
DO_1OP(vabsw, 4, int32_t, DO_ABS)
|
||||
|
||||
/* We can do these 64 bits at a time */
|
||||
DO_1OP(vfabsh, 8, uint64_t, DO_FABSH)
|
||||
DO_1OP(vfabss, 8, uint64_t, DO_FABSS)
|
||||
|
@ -199,6 +199,7 @@ static bool do_1op(DisasContext *s, arg_1op *a, MVEGenOneOpFn fn)
|
||||
|
||||
DO_1OP(VCLZ, vclz)
|
||||
DO_1OP(VCLS, vcls)
|
||||
DO_1OP(VABS, vabs)
|
||||
|
||||
static bool trans_VREV16(DisasContext *s, arg_1op *a)
|
||||
{
|
||||
@ -237,3 +238,17 @@ static bool trans_VMVN(DisasContext *s, arg_1op *a)
|
||||
{
|
||||
return do_1op(s, a, gen_helper_mve_vmvn);
|
||||
}
|
||||
|
||||
static bool trans_VABS_fp(DisasContext *s, arg_1op *a)
|
||||
{
|
||||
static MVEGenOneOpFn * const fns[] = {
|
||||
NULL,
|
||||
gen_helper_mve_vfabsh,
|
||||
gen_helper_mve_vfabss,
|
||||
NULL,
|
||||
};
|
||||
if (!dc_isar_feature(aa32_mve_fp, s)) {
|
||||
return false;
|
||||
}
|
||||
return do_1op(s, a, fns[a->size]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user