From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Aleksandar Rikalo" <arikalo@gmail.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
"Aurelien Jarno" <aurelien@aurel32.net>
Subject: [PATCH v2 4/6] target/mips: Decode LSA shift amount using decodetree function
Date: Tue, 12 Nov 2024 18:20:20 +0100 [thread overview]
Message-ID: <20241112172022.88348-5-philmd@linaro.org> (raw)
In-Reply-To: <20241112172022.88348-1-philmd@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/mips/tcg/msa.decode | 3 ++-
target/mips/tcg/rel6.decode | 4 +++-
target/mips/tcg/msa_translate.c | 4 ++--
target/mips/tcg/rel6_translate.c | 9 +++++++--
4 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/target/mips/tcg/msa.decode b/target/mips/tcg/msa.decode
index 4410e2a02e..798e8c401a 100644
--- a/target/mips/tcg/msa.decode
+++ b/target/mips/tcg/msa.decode
@@ -21,6 +21,7 @@
&msa_elm_df df wd ws n
&msa_elm wd ws
+%lsa_sa 6:2 !function=plus_1
%elm_df 16:6 !function=elm_df
%elm_n 16:6 !function=elm_n
%bit_df 16:7 !function=bit_df
@@ -29,7 +30,7 @@
%3r_df_h 21:1 !function=plus_1
%3r_df_w 21:1 !function=plus_2
-@lsa ...... rs:5 rt:5 rd:5 ... sa:2 ...... &r
+@lsa ...... rs:5 rt:5 rd:5 ... .. ...... &r sa=%lsa_sa
@ldst ...... sa:s10 ws:5 wd:5 .... df:2 &msa_i
@bz_v ...... ... .. wt:5 sa:s16 &msa_bz df=3
@bz ...... ... df:2 wt:5 sa:s16 &msa_bz
diff --git a/target/mips/tcg/rel6.decode b/target/mips/tcg/rel6.decode
index d6989cf56e..a9031171b5 100644
--- a/target/mips/tcg/rel6.decode
+++ b/target/mips/tcg/rel6.decode
@@ -16,7 +16,9 @@
&r rs rt rd sa
-@lsa ...... rs:5 rt:5 rd:5 ... sa:2 ...... &r
+%lsa_sa 6:2 !function=plus_1
+
+@lsa ...... rs:5 rt:5 rd:5 ... .. ...... &r sa=%lsa_sa
LSA 000000 ..... ..... ..... 000 .. 000101 @lsa
DLSA 000000 ..... ..... ..... 000 .. 010101 @lsa
diff --git a/target/mips/tcg/msa_translate.c b/target/mips/tcg/msa_translate.c
index 82b149922f..75cf80a20e 100644
--- a/target/mips/tcg/msa_translate.c
+++ b/target/mips/tcg/msa_translate.c
@@ -780,7 +780,7 @@ TRANS_DF_iv(ST, trans_msa_ldst, gen_helper_msa_st);
static bool trans_LSA(DisasContext *ctx, arg_r *a)
{
- return gen_lsa(ctx, a->rd, a->rt, a->rs, a->sa + 1);
+ return gen_lsa(ctx, a->rd, a->rt, a->rs, a->sa);
}
static bool trans_DLSA(DisasContext *ctx, arg_r *a)
@@ -788,5 +788,5 @@ static bool trans_DLSA(DisasContext *ctx, arg_r *a)
if (TARGET_LONG_BITS != 64) {
return false;
}
- return gen_dlsa(ctx, a->rd, a->rt, a->rs, a->sa + 1);
+ return gen_dlsa(ctx, a->rd, a->rt, a->rs, a->sa);
}
diff --git a/target/mips/tcg/rel6_translate.c b/target/mips/tcg/rel6_translate.c
index 363bc86491..2522ecae2b 100644
--- a/target/mips/tcg/rel6_translate.c
+++ b/target/mips/tcg/rel6_translate.c
@@ -11,6 +11,11 @@
#include "qemu/osdep.h"
#include "translate.h"
+static inline int plus_1(DisasContext *ctx, int x)
+{
+ return x + 1;
+}
+
/* Include the auto-generated decoders. */
#include "decode-rel6.c.inc"
@@ -23,7 +28,7 @@ bool trans_REMOVED(DisasContext *ctx, arg_REMOVED *a)
static bool trans_LSA(DisasContext *ctx, arg_r *a)
{
- return gen_lsa(ctx, a->rd, a->rt, a->rs, a->sa + 1);
+ return gen_lsa(ctx, a->rd, a->rt, a->rs, a->sa);
}
static bool trans_DLSA(DisasContext *ctx, arg_r *a)
@@ -31,5 +36,5 @@ static bool trans_DLSA(DisasContext *ctx, arg_r *a)
if (TARGET_LONG_BITS != 64) {
return false;
}
- return gen_dlsa(ctx, a->rd, a->rt, a->rs, a->sa + 1);
+ return gen_dlsa(ctx, a->rd, a->rt, a->rs, a->sa);
}
--
2.45.2
next prev parent reply other threads:[~2024-11-12 17:21 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-12 17:20 [PATCH v2 0/6] target/mips: Convert nanoMIPS LSA opcode to decodetree Philippe Mathieu-Daudé
2024-11-12 17:20 ` [PATCH v2 1/6] target/mips: Introduce decode tree bindings for microMIPS ISA Philippe Mathieu-Daudé
2024-11-12 18:14 ` Richard Henderson
2024-11-26 13:19 ` Philippe Mathieu-Daudé
2024-11-12 17:20 ` [PATCH v2 2/6] target/mips: Introduce decode tree bindings for nanoMIPS ISA Philippe Mathieu-Daudé
2024-11-26 13:20 ` Philippe Mathieu-Daudé
2024-11-12 17:20 ` [PATCH v2 3/6] target/mips: Have gen_[d]lsa() callers add 1 to shift amount argument Philippe Mathieu-Daudé
2024-11-12 18:16 ` Richard Henderson
2024-11-12 17:20 ` Philippe Mathieu-Daudé [this message]
2024-11-12 18:16 ` [PATCH v2 4/6] target/mips: Decode LSA shift amount using decodetree function Richard Henderson
2024-11-12 17:20 ` [PATCH v2 5/6] target/mips: Convert microMIPS LSA opcode to decodetree Philippe Mathieu-Daudé
2024-11-12 18:17 ` Richard Henderson
2024-11-12 17:20 ` [PATCH v2 6/6] target/mips: Convert nanoMIPS " Philippe Mathieu-Daudé
2024-11-12 18:18 ` Richard Henderson
2024-11-15 15:40 ` [PATCH v2 0/6] " Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241112172022.88348-5-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=arikalo@gmail.com \
--cc=aurelien@aurel32.net \
--cc=jiaxun.yang@flygoat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.