From: Oleg Endo <olegendo1024@gmail.com>
To: gdb-patches@sourceware.org
Subject: [SH] Check FPSCR.PR for fldi0, fldi1 insns in simulator
Date: Wed, 11 Mar 2026 12:02:25 +0900 [thread overview]
Message-ID: <016918b6653a40835d2272c3c37d05b0d7e470b6.camel@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 220 bytes --]
Hi,
On SH variants with double-precision FPU the insns fli0 and flid1 require
that FPSCR.PR must be set to 0, i.e. single-precision mode. The attached
patch fixes that.
OK to apply?
Best regards,
Oleg Endo
[-- Attachment #2: 0001-simsh-check-PFSCRPR-setting-for-fldi0-and-fldi1-insns.patch --]
[-- Type: text/x-patch, Size: 1096 bytes --]
From 3417353c867efd502da6df1e80b9a8bdb0a422f0 Mon Sep 17 00:00:00 2001
From: Oleg Endo <olegendo@gcc.gnu.org>
Date: Wed, 11 Mar 2026 11:55:20 +0900
Subject: [PATCH] sim/sh: check PFSCR.PR setting for fldi0 and fldi1 insns
---
sim/sh/gencode.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/sim/sh/gencode.c b/sim/sh/gencode.c
index 42009fc..9c882d2 100644
--- a/sim/sh/gencode.c
+++ b/sim/sh/gencode.c
@@ -644,18 +644,22 @@ static op tab[] =
/* sh2e */
{ "", "", "fldi0 <FREG_N>", "1111nnnn10001101",
{
- "SET_FR (n, (float) 0.0);",
- "/* FIXME: check for DP and (n & 1) == 0? */",
+ "if (FPSCR_PR)",
+ " RAISE_EXCEPTION (SIGILL);",
+ "else",
+ " SET_FR (n, (float) 0.0);",
},
},
/* sh2e */
{ "", "", "fldi1 <FREG_N>", "1111nnnn10011101",
{
- "SET_FR (n, (float) 1.0);",
- "/* FIXME: check for DP and (n & 1) == 0? */",
+ "if (FPSCR_PR)",
+ " RAISE_EXCEPTION (SIGILL);",
+ "else",
+ " SET_FR (n, (float) 1.0);",
},
},
/* sh2e */
--
libgit2 1.9.1
next reply other threads:[~2026-03-11 3:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-11 3:02 Oleg Endo [this message]
2026-03-11 4:27 ` Simon Marchi
2026-03-11 6:20 ` Oleg Endo
2026-03-11 14:39 ` Simon Marchi
2026-03-17 1:18 ` Oleg Endo
2026-03-17 1:19 ` Simon Marchi
2026-03-17 4:50 ` Oleg Endo
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=016918b6653a40835d2272c3c37d05b0d7e470b6.camel@gmail.com \
--to=olegendo1024@gmail.com \
--cc=gdb-patches@sourceware.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