From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: chauser@pullman.com
Subject: [PATCH v3 5/6] target/sparc: Implement STDFQ
Date: Fri, 16 Aug 2024 17:23:10 +1000 [thread overview]
Message-ID: <20240816072311.353234-6-richard.henderson@linaro.org> (raw)
In-Reply-To: <20240816072311.353234-1-richard.henderson@linaro.org>
Invalid encoding of addr should raise TT_ILL_INSN, so
check before supervisor, which might raise TT_PRIV_INSN.
Clear QNE after execution.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/sparc/translate.c | 24 +++++++++++++++++++++++-
target/sparc/insns.decode | 4 ++--
2 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/target/sparc/translate.c b/target/sparc/translate.c
index eb0158a11d..6d4c0e79c9 100644
--- a/target/sparc/translate.c
+++ b/target/sparc/translate.c
@@ -4531,17 +4531,39 @@ TRANS(STQFA, 64, do_st_fpr, a, MO_128)
static bool trans_STDFQ(DisasContext *dc, arg_STDFQ *a)
{
+ TCGv addr = gen_ldst_addr(dc, a->rs1, a->imm, a->rs2_or_imm);
+
if (!avail_32(dc)) {
return false;
}
+ if (addr == NULL) {
+ return false;
+ }
if (!supervisor(dc)) {
return raise_priv(dc);
}
+#if !defined(TARGET_SPARC64) && !defined(CONFIG_USER_ONLY)
if (gen_trap_ifnofpu(dc)) {
return true;
}
- gen_op_fpexception_im(dc, FSR_FTT_SEQ_ERROR);
+ if (dc->fsr_qne) {
+ TCGv_i64 fq = tcg_temp_new_i64();
+
+ /* Store the single element from the queue. */
+ tcg_gen_ld_i64(fq, tcg_env, offsetof(CPUSPARCState, fq.d));
+ tcg_gen_qemu_st_i64(fq, addr, dc->mem_idx, MO_TEUQ | MO_ALIGN_4);
+
+ /* Mark the queue empty, transitioning to fp_execute state. */
+ tcg_gen_st_i32(tcg_constant_i32(0), tcg_env,
+ offsetof(CPUSPARCState, fsr_qne));
+ dc->fsr_qne = 0;
+ } else {
+ gen_op_fpexception_im(dc, FSR_FTT_SEQ_ERROR);
+ }
return true;
+#else
+ qemu_build_not_reached();
+#endif
}
static bool trans_LDFSR(DisasContext *dc, arg_r_r_ri *a)
diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode
index fbcb4f7aef..923f348580 100644
--- a/target/sparc/insns.decode
+++ b/target/sparc/insns.decode
@@ -644,8 +644,8 @@ STF 11 ..... 100100 ..... . ............. @r_r_ri_na
STFSR 11 00000 100101 ..... . ............. @n_r_ri
STXFSR 11 00001 100101 ..... . ............. @n_r_ri
{
- STQF 11 ..... 100110 ..... . ............. @q_r_ri_na
- STDFQ 11 ----- 100110 ----- - -------------
+ STQF 11 ..... 100110 ..... . ............. @q_r_ri_na # v9
+ STDFQ 11 ..... 100110 ..... . ............. @r_r_ri # v7,v8
}
STDF 11 ..... 100111 ..... . ............. @d_r_ri_na
--
2.43.0
next prev parent reply other threads:[~2024-08-16 7:24 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-16 7:23 [PATCH for-9.2 v3 0/6] target/sparc: emulate floating point queue when raising fp traps Richard Henderson
2024-08-16 7:23 ` [PATCH v3 1/6] target/sparc: Restrict STQF to sparcv9 Richard Henderson
2024-08-16 7:58 ` Philippe Mathieu-Daudé
2024-08-16 7:23 ` [PATCH v3 2/6] target/sparc: Add FQ and FSR.QNE Richard Henderson
2024-08-16 7:23 ` [PATCH v3 3/6] target/sparc: Populate sparc32 FQ when raising fp exception Richard Henderson
2024-08-16 7:23 ` [PATCH v3 4/6] target/sparc: Add FSR_QNE to tb_flags Richard Henderson
2024-08-16 7:23 ` Richard Henderson [this message]
2024-08-16 7:23 ` [PATCH v3 6/6] target/sparc: Add gen_trap_if_nofpu_fpexception Richard Henderson
2024-08-16 21:19 ` [PATCH for-9.2 v3 0/6] target/sparc: emulate floating point queue when raising fp traps Carl Hauser
2024-08-16 21:46 ` Carl Hauser
2024-08-16 22:05 ` Richard Henderson
[not found] ` <a06ebc2a-e67b-49d9-91a8-ae2a7a1d8b9d@pullman.com>
2024-08-16 23:59 ` Richard Henderson
[not found] ` <aa172755-faf8-4587-a4e8-d1cbfdc139b1@pullman.com>
2024-08-17 0:16 ` Richard Henderson
[not found] ` <275021f0-887c-4de8-a86d-ad9abc83df95@pullman.com>
2024-08-19 2:42 ` [PATCH for-9.2 v3 0/6] target/sparc: emulate floating point queue when raising fp traps -- CORRECTION Richard Henderson
[not found] ` <24c5b02b-c401-4081-aa46-f745592002ca@pullman.com>
2024-08-20 22:16 ` Richard Henderson
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=20240816072311.353234-6-richard.henderson@linaro.org \
--to=richard.henderson@linaro.org \
--cc=chauser@pullman.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).