[PATCH v2 4/6] target/hexagon: add GVec overrides for HVX absolute difference

Brian Cain <[email protected]>
Newsgroups gmane.comp.emulators.qemu
Message-ID <[email protected]>
Reviewed-by: Marco Liebel <[email protected]>
Signed-off-by: Brian Cain <[email protected]>
---
 target/hexagon/gen_tcg_hvx.h | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/target/hexagon/gen_tcg_hvx.h b/target/hexagon/gen_tcg_hvx.h
index f843fe4e2e1..3cb52c761ae 100644
--- a/target/hexagon/gen_tcg_hvx.h
+++ b/target/hexagon/gen_tcg_hvx.h
@@ -332,6 +332,29 @@ static inline void assert_vhist_tmp(DisasContext *ctx)
     tcg_gen_gvec_mul(MO_16, VdV_off, VuV_off, VvV_off, \
                      VECTOR_SIZE_BYTE, VECTOR_SIZE_BYTE)
 
+#define fGEN_TCG_VEC_ABSDIFF(VECE, MAX_FN, MIN_FN) \
+    do { \
+        intptr_t tmpoff = offsetof(CPUHexagonState, vtmp); \
+        MAX_FN(VECE, tmpoff, VuV_off, VvV_off, \
+               VECTOR_SIZE_BYTE, VECTOR_SIZE_BYTE); \
+        MIN_FN(VECE, VdV_off, VuV_off, VvV_off, \
+               VECTOR_SIZE_BYTE, VECTOR_SIZE_BYTE); \
+        tcg_gen_gvec_sub(VECE, VdV_off, tmpoff, VdV_off, \
+                         VECTOR_SIZE_BYTE, VECTOR_SIZE_BYTE); \
+    } while (0)
+
+#define fGEN_TCG_V6_vabsdiffub(SHORTCODE) \
+    fGEN_TCG_VEC_ABSDIFF(MO_8, tcg_gen_gvec_umax, tcg_gen_gvec_umin)
+
+#define fGEN_TCG_V6_vabsdiffuh(SHORTCODE) \
+    fGEN_TCG_VEC_ABSDIFF(MO_16, tcg_gen_gvec_umax, tcg_gen_gvec_umin)
+
+#define fGEN_TCG_V6_vabsdiffh(SHORTCODE) \
+    fGEN_TCG_VEC_ABSDIFF(MO_16, tcg_gen_gvec_smax, tcg_gen_gvec_smin)
+
+#define fGEN_TCG_V6_vabsdiffw(SHORTCODE) \
+    fGEN_TCG_VEC_ABSDIFF(MO_32, tcg_gen_gvec_smax, tcg_gen_gvec_smin)
+
 /* Vector shift right - various forms */
 #define fGEN_TCG_V6_vasrh(SHORTCODE) \
     do { \
-- 
2.34.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.