This patch includes: - XVABSD.{B/H/W/D}[U]. Signed-off-by: Song Gao <gaos...@loongson.cn> Reviewed-by: Richard Henderson <richard.hender...@linaro.org> --- target/loongarch/vec.h | 2 ++ target/loongarch/insns.decode | 9 +++++++++ target/loongarch/disas.c | 9 +++++++++ target/loongarch/vec_helper.c | 2 -- target/loongarch/insn_trans/trans_lasx.c.inc | 9 +++++++++ 5 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/target/loongarch/vec.h b/target/loongarch/vec.h index 6ac6b22f20..6767073635 100644 --- a/target/loongarch/vec.h +++ b/target/loongarch/vec.h @@ -53,4 +53,6 @@ #define DO_VAVG(a, b) ((a >> 1) + (b >> 1) + (a & b & 1)) #define DO_VAVGR(a, b) ((a >> 1) + (b >> 1) + ((a | b) & 1)) +#define DO_VABSD(a, b) ((a > b) ? (a - b) : (b - a)) + #endif /* LOONGARCH_VEC_H */ diff --git a/target/loongarch/insns.decode b/target/loongarch/insns.decode index a2cb39750d..c086ee9b22 100644 --- a/target/loongarch/insns.decode +++ b/target/loongarch/insns.decode @@ -1423,6 +1423,15 @@ xvavgr_hu 0111 01000110 10101 ..... ..... ..... @vvv xvavgr_wu 0111 01000110 10110 ..... ..... ..... @vvv xvavgr_du 0111 01000110 10111 ..... ..... ..... @vvv +xvabsd_b 0111 01000110 00000 ..... ..... ..... @vvv +xvabsd_h 0111 01000110 00001 ..... ..... ..... @vvv +xvabsd_w 0111 01000110 00010 ..... ..... ..... @vvv +xvabsd_d 0111 01000110 00011 ..... ..... ..... @vvv +xvabsd_bu 0111 01000110 00100 ..... ..... ..... @vvv +xvabsd_hu 0111 01000110 00101 ..... ..... ..... @vvv +xvabsd_wu 0111 01000110 00110 ..... ..... ..... @vvv +xvabsd_du 0111 01000110 00111 ..... ..... ..... @vvv + xvreplgr2vr_b 0111 01101001 11110 00000 ..... ..... @vr xvreplgr2vr_h 0111 01101001 11110 00001 ..... ..... @vr xvreplgr2vr_w 0111 01101001 11110 00010 ..... ..... @vr diff --git a/target/loongarch/disas.c b/target/loongarch/disas.c index 8296aafa98..d0b1de39b8 100644 --- a/target/loongarch/disas.c +++ b/target/loongarch/disas.c @@ -1842,6 +1842,15 @@ INSN_LASX(xvavgr_hu, vvv) INSN_LASX(xvavgr_wu, vvv) INSN_LASX(xvavgr_du, vvv) +INSN_LASX(xvabsd_b, vvv) +INSN_LASX(xvabsd_h, vvv) +INSN_LASX(xvabsd_w, vvv) +INSN_LASX(xvabsd_d, vvv) +INSN_LASX(xvabsd_bu, vvv) +INSN_LASX(xvabsd_hu, vvv) +INSN_LASX(xvabsd_wu, vvv) +INSN_LASX(xvabsd_du, vvv) + INSN_LASX(xvreplgr2vr_b, vr) INSN_LASX(xvreplgr2vr_h, vr) INSN_LASX(xvreplgr2vr_w, vr) diff --git a/target/loongarch/vec_helper.c b/target/loongarch/vec_helper.c index a5d425e965..939ea11f19 100644 --- a/target/loongarch/vec_helper.c +++ b/target/loongarch/vec_helper.c @@ -375,8 +375,6 @@ DO_3OP(vavgr_hu, 16, UH, DO_VAVGR) DO_3OP(vavgr_wu, 32, UW, DO_VAVGR) DO_3OP(vavgr_du, 64, UD, DO_VAVGR) -#define DO_VABSD(a, b) ((a > b) ? (a -b) : (b-a)) - DO_3OP(vabsd_b, 8, B, DO_VABSD) DO_3OP(vabsd_h, 16, H, DO_VABSD) DO_3OP(vabsd_w, 32, W, DO_VABSD) diff --git a/target/loongarch/insn_trans/trans_lasx.c.inc b/target/loongarch/insn_trans/trans_lasx.c.inc index bcd4b03afc..2be165a839 100644 --- a/target/loongarch/insn_trans/trans_lasx.c.inc +++ b/target/loongarch/insn_trans/trans_lasx.c.inc @@ -161,6 +161,15 @@ TRANS(xvavgr_hu, LASX, gvec_vvv, 32, MO_16, do_vavgr_u) TRANS(xvavgr_wu, LASX, gvec_vvv, 32, MO_32, do_vavgr_u) TRANS(xvavgr_du, LASX, gvec_vvv, 32, MO_64, do_vavgr_u) +TRANS(xvabsd_b, LASX, gvec_vvv, 32, MO_8, do_vabsd_s) +TRANS(xvabsd_h, LASX, gvec_vvv, 32, MO_16, do_vabsd_s) +TRANS(xvabsd_w, LASX, gvec_vvv, 32, MO_32, do_vabsd_s) +TRANS(xvabsd_d, LASX, gvec_vvv, 32, MO_64, do_vabsd_s) +TRANS(xvabsd_bu, LASX, gvec_vvv, 32, MO_8, do_vabsd_u) +TRANS(xvabsd_hu, LASX, gvec_vvv, 32, MO_16, do_vabsd_u) +TRANS(xvabsd_wu, LASX, gvec_vvv, 32, MO_32, do_vabsd_u) +TRANS(xvabsd_du, LASX, gvec_vvv, 32, MO_64, do_vabsd_u) + TRANS(xvreplgr2vr_b, LASX, gvec_dup, 32, MO_8) TRANS(xvreplgr2vr_h, LASX, gvec_dup, 32, MO_16) TRANS(xvreplgr2vr_w, LASX, gvec_dup, 32, MO_32) -- 2.39.1