[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1109115: marked as done (gcc-15: Please add patch to fix NaN signalling bit and propagation rules on sh4)



Your message dated Sat, 19 Jul 2025 08:49:51 +0000
with message-id <E1ud3GR-00DDV8-03@fasolo.debian.org>
and subject line Bug#1109115: fixed in gcc-15 15.1.0-9
has caused the Debian Bug report #1109115,
regarding gcc-15: Please add patch to fix NaN signalling bit and propagation rules on sh4
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
1109115: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1109115
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Source: gcc-15
Version: 15.1.0-8
Severity: normal
Tags: patch
User: debian-superh@lists.debian.org
Usertags: sh4
X-Debbugs-Cc: debian-superh@lists.debian.org

Hi,

gcc upstream recently merged a patch which fixes a lot of math testsuite failures
in glibc [1][2][3]. The patch has not been backported to the gcc-15 branch yet, so
it would be nice if we could merge the patch in the gcc-15 Debian package in the
mean time.

I'm attaching it in any case. I have cherry-picked this patch while on the gcc-15
branch of the gcc git repository using "git cherry-pick".

Thanks,
Adrian

> [1] https://sourceware.org/bugzilla/show_bug.cgi?id=30973
> [2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111814
> [3] https://gcc.gnu.org/cgit/gcc/commit/?id=2a643f55f5acc05dcc7cee133647bf3193d5b563

--
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
>From f1496a2ebee717137ba0b3c96aa4cbf8c96f51ec Mon Sep 17 00:00:00 2001
From: Jiaxun Yang <jiaxun.yang@flygoat.com>
Date: Sat, 19 Apr 2025 08:07:58 -0600
Subject: [PATCH] [PATCH v2] sh: Correct NaN signalling bit and propagation
 rules [PR111814]

As per architecture, SuperH has a reversed NaN signalling bit
vs IEEE754-2008, it also has a NaN propgation rule similar to
MIPS style.

Use mips style float format and mode for all float types, and
correct sfp-machine header accordingly.

	PR target/111814

gcc/ChangeLog:

	* config/sh/sh-modes.def (RESET_FLOAT_FORMAT): Use mips format.
	(FLOAT_MODE): Use mips mode.

libgcc/ChangeLog:

	* config/sh/sfp-machine.h (_FP_NANFRAC_B): Reverse signaling bit.
	(_FP_NANFRAC_H): Likewise.
	(_FP_NANFRAC_S): Likewise.
	(_FP_NANFRAC_D): Likewise.
	(_FP_NANFRAC_Q): Likewise.
	(_FP_KEEPNANFRACP): Enable for target.
	(_FP_QNANNEGATEDP): Enable for target.
	(_FP_CHOOSENAN): Port from MIPS.

gcc/testsuite/ChangeLog:

	* gcc.target/sh/pr111814.c: New test.
---
 gcc/config/sh/sh-modes.def             |  6 +++++
 gcc/testsuite/gcc.target/sh/pr111814.c |  7 +++++
 libgcc/config/sh/sfp-machine.h         | 36 ++++++++++++++++----------
 3 files changed, 36 insertions(+), 13 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/sh/pr111814.c

diff --git a/src/gcc/config/sh/sh-modes.def b/src/gcc/config/sh/sh-modes.def
index 80650b429e4..e31ae694a48 100644
--- a/src/gcc/config/sh/sh-modes.def
+++ b/src/gcc/config/sh/sh-modes.def
@@ -17,6 +17,12 @@ You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+/* SH has the same reversed quiet bit as MIPS.  */
+RESET_FLOAT_FORMAT (SF, mips_single_format);
+RESET_FLOAT_FORMAT (DF, mips_double_format);
+/* TFmode: IEEE quad floating point (software).  */
+FLOAT_MODE (TF, 16, mips_quad_format);
+
 /* Vector modes.  */
 VECTOR_MODE  (INT, QI, 2);    /*                 V2QI */
 VECTOR_MODES (INT, 4);        /*            V4QI V2HI */
diff --git a/src/gcc/testsuite/gcc.target/sh/pr111814.c b/src/gcc/testsuite/gcc.target/sh/pr111814.c
new file mode 100644
index 00000000000..a88e5d786ba
--- /dev/null
+++ b/src/gcc/testsuite/gcc.target/sh/pr111814.c
@@ -0,0 +1,7 @@
+/* Verify that __builtin_nan("") produces a constant matches
+   architecture specification. */
+/* { dg-do compile } */
+
+double d = __builtin_nan ("");
+
+/* { dg-final { scan-assembler "\t.long\t-1\n\t.long\t2146959359\n" } } */
diff --git a/src/libgcc/config/sh/sfp-machine.h b/src/libgcc/config/sh/sfp-machine.h
index 66984d45755..67bc41516a3 100644
--- a/src/libgcc/config/sh/sfp-machine.h
+++ b/src/libgcc/config/sh/sfp-machine.h
@@ -39,11 +39,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #define _FP_DIV_MEAT_D(R,X,Y)	_FP_DIV_MEAT_2_udiv(D,R,X,Y)
 #define _FP_DIV_MEAT_Q(R,X,Y)	_FP_DIV_MEAT_4_udiv(Q,R,X,Y)
 
-#define _FP_NANFRAC_B	_FP_QNANBIT_B
-#define _FP_NANFRAC_H	_FP_QNANBIT_H
-#define _FP_NANFRAC_S	_FP_QNANBIT_S
-#define _FP_NANFRAC_D	_FP_QNANBIT_D, 0
-#define _FP_NANFRAC_Q	_FP_QNANBIT_Q, 0, 0, 0
+#define _FP_NANFRAC_B	(_FP_QNANBIT_B - 1)
+#define _FP_NANFRAC_H	(_FP_QNANBIT_H - 1)
+#define _FP_NANFRAC_S	(_FP_QNANBIT_S - 1)
+#define _FP_NANFRAC_D	(_FP_QNANBIT_D - 1), -1
+#define _FP_NANFRAC_Q	(_FP_QNANBIT_Q - 1), -1, -1, -1
 
 /* The type of the result of a floating point comparison.  This must
    match __libgcc_cmp_return__ in GCC for the target.  */
@@ -56,14 +56,24 @@ typedef int __gcc_CMPtype __attribute__ ((mode (__libgcc_cmp_return__)));
 #define _FP_NANSIGN_D	0
 #define _FP_NANSIGN_Q	0
 
-#define _FP_KEEPNANFRACP 0
-#define _FP_QNANNEGATEDP 0
-
-#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP)  \
-  do {                      \
-    R##_s = _FP_NANSIGN_##fs;           \
-    _FP_FRAC_SET_##wc(R,_FP_NANFRAC_##fs);  \
-    R##_c = FP_CLS_NAN;             \
+#define _FP_KEEPNANFRACP 1
+#define _FP_QNANNEGATEDP 1
+
+/* X is chosen unless one of the NaNs is sNaN.  */
+# define _FP_CHOOSENAN(fs, wc, R, X, Y, OP)			\
+  do {								\
+    if ((_FP_FRAC_HIGH_RAW_##fs(X) |				\
+	 _FP_FRAC_HIGH_RAW_##fs(Y)) & _FP_QNANBIT_##fs)		\
+      {								\
+	R##_s = _FP_NANSIGN_##fs;				\
+	_FP_FRAC_SET_##wc(R,_FP_NANFRAC_##fs);			\
+      }								\
+    else							\
+      {								\
+	R##_s = X##_s;						\
+	_FP_FRAC_COPY_##wc(R,X);				\
+      }								\
+    R##_c = FP_CLS_NAN;						\
   } while (0)
 
 #define _FP_TININESS_AFTER_ROUNDING 1
-- 
2.50.0


--- End Message ---
--- Begin Message ---
Source: gcc-15
Source-Version: 15.1.0-9
Done: Matthias Klose <doko@debian.org>

We believe that the bug you reported is fixed in the latest version of
gcc-15, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 1109115@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Matthias Klose <doko@debian.org> (supplier of updated gcc-15 package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Sat, 19 Jul 2025 10:32:20 +0200
Source: gcc-15
Architecture: source
Version: 15.1.0-9
Distribution: experimental
Urgency: medium
Maintainer: Debian GCC Maintainers <debian-gcc@lists.debian.org>
Changed-By: Matthias Klose <doko@debian.org>
Closes: 1108158 1108247 1108261 1109115
Changes:
 gcc-15 (15.1.0-9) experimental; urgency=medium
 .
   * Update to git 20250719 from the gcc-15 branch.
     - Fix PR target/120356 (RISCV), PR target/120995 (RISCV),
       PR ipa/121023, PR tree-optimization/120780, PR tree-optimization/120358,
       PR tree-optimization/118669, PR tree-optimization/120817,
       PR tree-optimization/120927, PR tree-optimization/120944,
       PR middle-end/120369, PR rtl-optimization/120795,
       PR rtl-optimization/120550, PR tree-optimization/120927,
       PR middle-end/120608, PR tree-optimization/120729,
       PR tree-optimization/120654, PR target/120624 (AArch64),
       PR rtl-optimization/120347, PR middle-end/120608, PR middle-end/120631,
       PR target/119971 (RISCV), PR tree-optimization/120677,
       PR rtl-optimization/120423, PR rtl-optimization/116389, PR c/120837,
       PR c++/120628, PR c++/120569, PR c++/120575, PR c++/116064,
       PR c++/120940, PR c++/120684, PR c++/118856, PR c++/120471,
       PR fortran/120843, PR fortran/120847, PR fortran/120843,
       PR fortran/120711, PR fortran/120784, PR fortran/120784,
       PR fortran/119948, PR fortran/51961, PR modula2/120253,
       PR libstdc++/119754, PR libstdc++/120997, PR libstdc++/118681,
       PR libstdc++/120934, PR libstdc++/120931, PR libstdc++/120648,
       PR libstdc++/120650, PR middle-end/120935, PR tree-optimization/120924,
       PR tree-optimization/121059, PR tree-optimization/121049,
       PR tree-optimization/121035, PR tree-optimization/121131,
       PR target/120807 (loongarch), PR middle-end/120709,
       PR target/120999 (AArch64), PR rtl-optimization/120242,
       PR rtl-optimization/120627, PR rtl-optimization/120736,
       PR rtl-optimization/120813, PR target/118241 (RISCV),
       PR target/118241 (RISCV), PR target/120908 (x86), PR target/120908 (x86),
       PR ada/121056, PR fortran/121060, PR fortran/104428, PR fortran/120637,
       PR modula2/121164, PR modula2/120912, PR modula2/117203,
       PR modula2/120731, PR modula2/120673, PR modula2/119650,
       PR modula2/120606, PR modula2/119650, PR modula2/120542,
       PR modula2/120474, PR modula2/120497, PR modula2/120389.
   * Enable LRA support on sh4 (Adrian Glaubitz). Closes: #1108158.
   * Fix NaN signalling bit and propagation rules on sh4 (Adrian Glaubitz).
     Closes: #1109115.
   * Drop obsolete ia64-disable-selective-scheduling patch (Adrian Glaubitz).
     Closes: #1108247.
   * Enable algol on sh4 (Adrian Glaubitz). Closes: #1108261.
   * RISC-V: Minimal support for ssnpm, smnpm and smmpm extensions (taken from
     the trunk, Heinrich Schuchardt). LP: #2116120.
   * RISC-V: Bump to the RVA23U64 extension profile for Ubuntu 25.10 and later
     (Heinrich Schuchardt). LP: #2116086.
   * Enable -fzero-init-padding-bits=all, -Wbidi-chars=any for Ubuntu 25.10
     and later. LP: #2108968.
   * Bump standards version.
Checksums-Sha1:
 972608803ed4dee1e6112351cced32cee68b1fa0 52172 gcc-15_15.1.0-9.dsc
 2955849248e32b7dfeab399626b9dd72585f456f 2637372 gcc-15_15.1.0-9.debian.tar.xz
 a289141ffdcd39f357c52c284917b44b67317ed6 8609 gcc-15_15.1.0-9_source.buildinfo
Checksums-Sha256:
 32803e523d96cb1ec4c026c1ecbf51baa5db350f20e73563d1597a376a0ccffd 52172 gcc-15_15.1.0-9.dsc
 d65b40e288112ec41e6893b828ac61bf0d86656ccba5d9f26c89243dcc57aff0 2637372 gcc-15_15.1.0-9.debian.tar.xz
 20483325b00d0be54ae57816a5f35e89f06ba77ee05788cb849f84387c496370 8609 gcc-15_15.1.0-9_source.buildinfo
Files:
 1b79c809cd5f1c8e3725b75352651516 52172 devel optional gcc-15_15.1.0-9.dsc
 5b2c01b602bfb8e55869928bc88191b8 2637372 devel optional gcc-15_15.1.0-9.debian.tar.xz
 e542e9c336bc4a8fe3e925da7e2273f5 8609 devel optional gcc-15_15.1.0-9_source.buildinfo

-----BEGIN PGP SIGNATURE-----

iQJEBAEBCgAuFiEE1WVxuIqLuvFAv2PWvX6qYHePpvUFAmh7WEcQHGRva29AZGVi
aWFuLm9yZwAKCRC9fqpgd4+m9XoVD/4041lHMSH+xPC4Olxy9ETRUcEGhU1bUZia
T5UyYNuM1yQ2OPxAeuxD3J6Wm/9bbkR6A22OR/UrYw3W23DfswPQssmk8maEitEY
BroTm7hsWhkxDfstmafOVFoChCcV2yjzBT1kmwF5VTkkyh/CwY7fn8Mgy4gGDdQt
QXEym7lfmvzVS/+USDKReGpQgL7toUHANI6SxPNktK4I3MLqJIpIoeFocFc96Xgy
D5Q5qVhItKdfe9USToE5tACqORauxBGHB1FJFw71Y3aHvkB8C5yD27LxpmQjJUgA
BZneI0+g2bemK/tBUQwS6h29Xr+k+lzjpHgl/pkdGHD4kYU7MQuI2/5+O3fx1Ewi
9KkAWjEagdF0aThchoZYxHJ8o0IEbsLPbqeJZPIYshCNMpSWqX8blsFSkPBtTW5y
GkZ+wFj+qUoaPvWIQw3kLvGnXK5o9Eq+UWjz6PPtDCLy9wV5NfSfaB6NiuvDY8AM
pD6okaHXXVP8hHtx5ckLsMXp7n/7rEvPTWmbA/hhmHJFfCHbXym+vemsKXiwlHyQ
K/D671r5T4aRLgYemWLJwNOhdgOJdq41SR/vMY8os+2Kk4RaDOMqUClX+6ZsOJb/
NG92u8qFMNIGXzNLUrZOMz5yJnxOCclCiSlhA4pxmjhqePlyX1iJRpuaW/cs7MLP
OtxB/psZHw==
=ee5U
-----END PGP SIGNATURE-----

Attachment: pgpNFQdcMJLvU.pgp
Description: PGP signature


--- End Message ---

Reply to: