From: Helge Deller <deller@kernel.org>
To: qemu-devel@nongnu.org
Cc: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>,
Max Filippov <jcmvbkbc@gmail.com>, Helge Deller <deller@gmx.de>,
Yoshinori Sato <yoshinori.sato@nifty.com>,
Laurent Vivier <laurent@vivier.eu>,
Matt Turner <mattst88@gmail.com>,
Richard Henderson <richard.henderson@linaro.org>
Subject: [PULL 8/8] target/sh4: decode_gusa: recognize add#imm with prior mov Rm, Rn
Date: Mon, 8 Jun 2026 21:42:56 +0200 [thread overview]
Message-ID: <20260608194256.13794-9-deller@kernel.org> (raw)
In-Reply-To: <20260608194256.13794-1-deller@kernel.org>
From: Matt Turner <mattst88@gmail.com>
The gUSA pattern matcher rejected `add #imm, Rn` whenever any prior
`mov Rm, Rn` appeared (mv_src >= 0), forcing a fallback to
cpu_exec_step_atomic for sequences like:
mov.l @r2, r3 ; load
mov r3, r7 ; save old value (mv_src == ld_dst)
add #1, r7 ; increment copy
mov.l r7, @r2 ; store
When mv_src == ld_dst the move merely copies the loaded value to
preserve it -- exactly the situation already accepted for the
`add Rm, Rn` form. The immediate form can be handled identically with
tcg_gen_atomic_fetch_add_i32 + tcg_gen_add_i32, so translate it inline
instead of taking the slower single-step atomic fallback.
Signed-off-by: Matt Turner <mattst88@gmail.com>
Cc: Yoshinori Sato <yoshinori.sato@nifty.com>
Cc: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Helge Deller <deller@gmx.de>
---
target/sh4/translate.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target/sh4/translate.c b/target/sh4/translate.c
index 5adf650744..d38a6bd352 100644
--- a/target/sh4/translate.c
+++ b/target/sh4/translate.c
@@ -1974,7 +1974,7 @@ static void decode_gusa(DisasContext *ctx, CPUSH4State *env)
break;
case 0x7000 ... 0x700f: /* add #imm,Rn */
- if (op_dst != B11_8 || mv_src >= 0) {
+ if (op_dst != B11_8 || (mv_src >= 0 && mv_src != ld_dst)) {
goto fail;
}
op_opc = INDEX_op_add;
--
2.54.0
prev parent reply other threads:[~2026-06-08 19:44 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-08 19:42 [PULL 0/8] Linux user patches Helge Deller
2026-06-08 19:42 ` [PULL 1/8] linux-user: implement fsmount(2) series of syscalls Helge Deller
2026-06-08 19:42 ` [PULL 2/8] linux-user/strace: add fsmount " Helge Deller
2026-06-08 19:42 ` [PULL 3/8] linux-user/alpha: add coredump support Helge Deller
2026-06-08 19:42 ` [PULL 4/8] linux-user/sparc: " Helge Deller
2026-06-08 19:42 ` [PULL 5/8] linux-user/sparc: restore L/I registers from RSA in sparc64_set_context Helge Deller
2026-06-08 19:42 ` [PULL 6/8] linux-user/sparc: call block_signals() before set_sigmask() in setcontext Helge Deller
2026-06-08 19:42 ` [PULL 7/8] linux-user/sparc: flush register windows before core dump Helge Deller
2026-06-08 19:42 ` Helge Deller [this message]
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=20260608194256.13794-9-deller@kernel.org \
--to=deller@kernel.org \
--cc=deller@gmx.de \
--cc=jcmvbkbc@gmail.com \
--cc=laurent@vivier.eu \
--cc=mattst88@gmail.com \
--cc=pierrick.bouvier@oss.qualcomm.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=yoshinori.sato@nifty.com \
/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.