From a389e63e33ca264f4040651433ef848acef7d71c Mon Sep 17 00:00:00 2001 From: Denis Drakhnia Date: Fri, 19 Jul 2024 11:20:35 +0300 Subject: [PATCH] e2k: add plog_{and,xor,or} --- target/e2k/alop.decode | 40 ++++++++++++++-------------- target/e2k/trans/alop-v5.c.inc | 13 ++++----- target/e2k/translate.c | 48 ++++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+), 26 deletions(-) diff --git a/target/e2k/alop.decode b/target/e2k/alop.decode index 022c0328da..76db50f8eb 100644 --- a/target/e2k/alop.decode +++ b/target/e2k/alop.decode @@ -1446,26 +1446,26 @@ qpfhadds 1----- ------- --- 00000010 11000000 . 1111100 ........ .... qpfhsubs 1----- ------- --- 00000010 11000000 . 1111101 ........ ........ ........ @alf1 qpfaddsubs 1----- ------- --- 00000010 11000000 . 1111110 ........ ........ ........ @alf1 qpfaddsubd 1----- ------- --- 00000010 11000000 . 1111111 ........ ........ ........ @alf1 -#{ -# [ -# plog_and 1----- ------- -0- 00010001 ........ . 0000000 ........ ........ ........ @alf21 -# plog_xor 1----- ------- -0- 00010001 ........ . 0010110 ........ ........ ........ @alf21 -# plog_sel3 1----- ------- -0- 00010001 ........ . 1011000 ........ ........ ........ @alf21 -# plog_mjr 1----- ------- -0- 00010001 ........ . 1101000 ........ ........ ........ @alf21 -# plog_or 1----- ------- -0- 00010001 ........ . 1111110 ........ ........ ........ @alf21 -# ] -plog 1----- ------- -0- 0001000. ........ . ....... ........ ........ ........ @alf21_log -#} -#{ -# [ -# qplog_and 1----- ------- --- 00010011 ........ . 0000000 ........ ........ ........ @alf21 -# qplog_xor 1----- ------- --- 00010011 ........ . 0010110 ........ ........ ........ @alf21 -# qplog_sel3 1----- ------- --- 00010011 ........ . 1011000 ........ ........ ........ @alf21 -# qplog_mjr 1----- ------- --- 00010011 ........ . 1101000 ........ ........ ........ @alf21 -# qplog_or 1----- ------- --- 00010011 ........ . 1111110 ........ ........ ........ @alf21 -# ] -qplog 1----- ------- --- 0001001. ........ . ....... ........ ........ ........ @alf21_log -#} +{ + [ + plog_and 1----- ------- -0- 00010001 ........ . 0000000 ........ ........ ........ @alf21 + plog_xor 1----- ------- -0- 00010001 ........ . 0010110 ........ ........ ........ @alf21 + #plog_sel3 1----- ------- -0- 00010001 ........ . 1011000 ........ ........ ........ @alf21 + #plog_mjr 1----- ------- -0- 00010001 ........ . 1101000 ........ ........ ........ @alf21 + plog_or 1----- ------- -0- 00010001 ........ . 1111110 ........ ........ ........ @alf21 + ] + plog 1----- ------- -0- 0001000. ........ . ....... ........ ........ ........ @alf21_log +} +{ + [ + qplog_and 1----- ------- --- 00010011 ........ . 0000000 ........ ........ ........ @alf21 + qplog_xor 1----- ------- --- 00010011 ........ . 0010110 ........ ........ ........ @alf21 + #qplog_sel3 1----- ------- --- 00010011 ........ . 1011000 ........ ........ ........ @alf21 + #qplog_mjr 1----- ------- --- 00010011 ........ . 1101000 ........ ........ ........ @alf21 + qplog_or 1----- ------- --- 00010011 ........ . 1111110 ........ ........ ........ @alf21 + ] + qplog 1----- ------- --- 0001001. ........ . ....... ........ ........ ........ @alf21_log +} qppermb 1----- ------- -0- 00010111 ........ . 0001101 ........ ........ ........ @alf21 qpshufb 1----- ------- -0- 00010111 ........ . 1001101 ........ ........ ........ @alf21 qpmerge 1----- ------- -0- 00010111 ........ . 1101101 ........ ........ ........ @alf21 diff --git a/target/e2k/trans/alop-v5.c.inc b/target/e2k/trans/alop-v5.c.inc index 81feb07a96..d4dbdda25d 100644 --- a/target/e2k/trans/alop-v5.c.inc +++ b/target/e2k/trans/alop-v5.c.inc @@ -175,17 +175,18 @@ TRANSW(qpfhadds, 5, 5, 5, 5, 5, 5, P,P,P,0, alf1, _env_, gen_helper_ TRANSW(qpfhsubs, 5, 5, 5, 5, 5, 5, P,P,P,0, alf1, _env_, gen_helper_qpfhsubs); TRANSW(qpfaddsubs, 5, 5, 5, 5, 5, 5, P,P,P,0, alf1, _env_, gen_helper_qpfaddsubs); TRANSW(qpfaddsubd, 5, 5, 5, 5, 5, 5, P,P,P,0, alf1, _env_, gen_helper_qpfaddsubd); -//plog_and, 5, 5, 0, 5, 5, 0, D,D,D,D, alf21, AF_ALIAS -//plog_xor, 5, 5, 0, 5, 5, 0, D,D,D,D, alf21, AF_ALIAS +TRANSW(plog_and, 5, 5, 0, 5, 5, 0, D,D,D,D, alf21, _, gen_plog_and) +TRANSW(plog_xor, 5, 5, 0, 5, 5, 0, D,D,D,D, alf21, _, gen_plog_xor) //plog_sel3, 5, 5, 0, 5, 5, 0, D,D,D,D, alf21, AF_ALIAS //plog_mjr, 5, 5, 0, 5, 5, 0, D,D,D,D, alf21, AF_ALIAS -//plog_or, 5, 5, 0, 5, 5, 0, D,D,D,D, alf21, AF_ALIAS +TRANSW(plog_or, 5, 5, 0, 5, 5, 0, D,D,D,D, alf21, _, gen_plog_or) TRANSW(plog, 5, 5, 0, 5, 5, 0, D,D,D,D, alf21_log, _, gen_plog); -//qplog_and, 5, 5, 7, 5, 5, 7, P,P,P,P, alf21_lt3, AF_ALIAS -//qplog_xor, 5, 5, 7, 5, 5, 7, P,P,P,P, alf21_lt3, AF_ALIAS +// TODO: implement alf21_lt3 for v7 +TRANSW(qplog_and, 5, 5, 7, 5, 5, 7, P,P,P,P, alf21, _, gen_qplog_and); +TRANSW(qplog_xor, 5, 5, 7, 5, 5, 7, P,P,P,P, alf21, _, gen_qplog_xor); //qplog_sel3, 5, 5, 7, 5, 5, 7, P,P,P,P, alf21_lt3, AF_ALIAS //qplog_mjr, 5, 5, 7, 5, 5, 7, P,P,P,P, alf21_lt3, AF_ALIAS -//qplog_or, 5, 5, 7, 5, 5, 7, P,P,P,P, alf21_lt3, AF_ALIAS +TRANSW(qplog_or, 5, 5, 7, 5, 5, 7, P,P,P,P, alf21, _, gen_qplog_or); TRANSW(qplog, 5, 5, 7, 5, 5, 7, P,P,P,P, alf21_log, _, gen_qplog); TRANSW(qppermb, 5, 5, 0, 5, 5, 0, P,P,P,P, alf21, _, gen_helper_qppermb); TRANSW(qpshufb, 5, 5, 0, 5, 5, 0, P,P,P,P, alf21, _, gen_helper_qpshufb); diff --git a/target/e2k/translate.c b/target/e2k/translate.c index 5cd9b0544f..1729ad6b81 100644 --- a/target/e2k/translate.c +++ b/target/e2k/translate.c @@ -3665,6 +3665,54 @@ static void gen_qplog(TCGv_i128 ret, uint32_t table, TCGv_i128 s1, gen_helper_qplog(ret, s1, s2, s3, tcg_constant_i32(table)); } +#define IMPL_GEN_PLOG(name, op) \ + static void name(TCGv_i64 ret, TCGv_i64 s1, TCGv_i64 s2, TCGv_i64 s3) \ + { \ + TCGv_i64 t0 = tcg_temp_new_i64(); \ + op(t0, s1, s2); \ + op(ret, t0, s3); \ + } + +IMPL_GEN_PLOG(gen_plog_and, tcg_gen_and_i64) +IMPL_GEN_PLOG(gen_plog_xor, tcg_gen_xor_i64) +IMPL_GEN_PLOG(gen_plog_or, tcg_gen_or_i64) + +#if 0 +static void gen_plog_mgr(TCGv_i64 ret, TCGv_i64 s1, TCGv_i64 s2, TCGv_i64 s3) +{ + TCGv_i64 t0 = tcg_temp_new_i64(); + TCGv_i64 t1 = tcg_temp_new_i64(); + + tcg_gen_and_i64(t0, s1, s2); + tcg_gen_and_i64(t1, s1, s3); + tcg_gen_or_i64(t0, t0, t1); + tcg_gen_and_i64(t1, s2, s3); + tcg_gen_or_i64(ret, t0, t1); +} +#endif + +#define IMPL_GEN_ALOPF1_QQQQ(name, op) \ + static void name(TCGv_i128 ret, TCGv_i128 s1, TCGv_i128 s2, TCGv_i128 s3) \ + { \ + TCGv_i64 t0 = tcg_temp_new_i64(); \ + TCGv_i64 t1 = tcg_temp_new_i64(); \ + TCGv_i64 t2 = tcg_temp_new_i64(); \ + TCGv_i64 t3 = tcg_temp_new_i64(); \ + TCGv_i64 t4 = tcg_temp_new_i64(); \ + TCGv_i64 t5 = tcg_temp_new_i64(); \ + \ + gen_qpunpackdl(t0, t1, s1); \ + gen_qpunpackdl(t2, t3, s2); \ + gen_qpunpackdl(t4, t5, s3); \ + op(t0, t0, t2, t4); \ + op(t1, t1, t3, t5); \ + gen_qppackdl(ret, t0, t1); \ + } + +IMPL_GEN_ALOPF1_QQQQ(gen_qplog_and, gen_plog_and) +IMPL_GEN_ALOPF1_QQQQ(gen_qplog_xor, gen_plog_xor) +IMPL_GEN_ALOPF1_QQQQ(gen_qplog_or, gen_plog_or) + #define IMPL_GEN_ALOPF7_QQB(name, op1, op2) \ static void name(TCGv_i64 ret, TCGv_i128 s1, TCGv_i128 s2) \ { \