On 8/30/23 01:48, Song Gao wrote:
This patch includes:
- XVDIV.{B/H/W/D}[U];
- XVMOD.{B/H/W/D}[U].
Signed-off-by: Song Gao<gaos...@loongson.cn>
---
target/loongarch/vec.h | 7 +++++++
target/loongarch/insns.decode | 17 +++++++++++++++++
target/loongarch/disas.c | 17 +++++++++++++++++
target/loongarch/vec_helper.c | 10 ++--------
target/loongarch/insn_trans/trans_lasx.c.inc | 17 +++++++++++++++++
5 files changed, 60 insertions(+), 8 deletions(-)
diff --git a/target/loongarch/vec.h b/target/loongarch/vec.h
index 06c8d7e314..ee50d53f4e 100644
--- a/target/loongarch/vec.h
+++ b/target/loongarch/vec.h
@@ -65,4 +65,11 @@
#define DO_MADD(a, b, c) (a + b * c)
#define DO_MSUB(a, b, c) (a - b * c)
+#define DO_DIVU(N, M) (unlikely(M == 0) ? 0 : N / M)
+#define DO_REMU(N, M) (unlikely(M == 0) ? 0 : N % M)
+#define DO_DIV(N, M) (unlikely(M == 0) ? 0 :\
+ unlikely((N == -N) && (M == (__typeof(N))(-1))) ? N : N / M)
+#define DO_REM(N, M) (unlikely(M == 0) ? 0 :\
+ unlikely((N == -N) && (M == (__typeof(N))(-1))) ? 0 : N % M)
+
#endif /* LOONGARCH_VEC_H */
Aside from this movement,
Reviewed-by: Richard Henderson <richard.hender...@linaro.org>
r~