[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 Mon, 21 Jul 2025 08:49:08 +0000
with message-id <E1udmCq-0057P2-2x@fasolo.debian.org>
and subject line Bug#1109115: fixed in gcc-15 15.1.0-10
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-10
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 16:56:42 +0200
Source: gcc-15
Architecture: source
Version: 15.1.0-10
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-10) 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:
 ae06d069e7263f837a2f2e91e3cb414faaaf2c59 52176 gcc-15_15.1.0-10.dsc
 a9b14857ce90ecb66687844723e61e3c719881a4 2637380 gcc-15_15.1.0-10.debian.tar.xz
 4b80d1d5e9ea84b482f2fcaa05e4f442c17d61cd 10138 gcc-15_15.1.0-10_source.buildinfo
Checksums-Sha256:
 ebc719a2dd242f6323165eca436cb9edfdb7ddbd15c47c460828a0d04c5f5e5e 52176 gcc-15_15.1.0-10.dsc
 b8cdf880b668065867fef6e972c171053a318d62b66a754921c40e33828f1310 2637380 gcc-15_15.1.0-10.debian.tar.xz
 29a362ccbff08025fef23abc7b0645c862e52e0386dfbf76d8e4f49767f408a2 10138 gcc-15_15.1.0-10_source.buildinfo
Files:
 ea816acc35f05dbca240f44181442496 52176 devel optional gcc-15_15.1.0-10.dsc
 356ac62cc0a31c3acef65dab1ae9929d 2637380 devel optional gcc-15_15.1.0-10.debian.tar.xz
 3808ae5df3a0bf7d63bc166a7b643b84 10138 devel optional gcc-15_15.1.0-10_source.buildinfo

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

iQJEBAEBCgAuFiEE1WVxuIqLuvFAv2PWvX6qYHePpvUFAmh9+BAQHGRva29AZGVi
aWFuLm9yZwAKCRC9fqpgd4+m9WCHEACACCs5T2xXVyj2v8/lqvbeULFhR5u8RR+z
gFO8WcWkGLBj20RUYn2hjClylTWnqSiF3Kparz0ki3zJW8WSuVAFpkfCxFc2mfyO
BwV/yyrbVat4N682v6fmVYSxEYfQc19cNOGJ8A1kQz8NeFNIhbAH7Xega+nK540m
utrdyfhXQJR/aN/cTrSXTjOAnsUmqRUrztM6MJXbRypEmQ8K9Vld6RUWi4xKEW1j
06ZRvcxfQEJQbATq9kPhiH41ad73rWF84/a/6F5IAvVVCU44kiTCBQRArJS7uPZU
iNvVRMyNQ86Ur686SWJoWoRu2cnCJR8caPmmJqbSnwyFfT1lYrerrh11lM9QKviA
AjgO0XU+wp1VIcWmsuNfglKPXXkT7v3pk8rq+I1skP92h//6sg2XId/lk/kz2ZKe
+KRHywK9psMbwyUHrd1bt14oDIJrKmj2lkOMFpTHbHohvdRGEU3DM2Mk4+qjDEsL
0H/aeT4XMPf/Ux9g23nXnec0kxU3dru4PzzVLJDbgv2yU6Vmc3ZtMaQ/NSrSz33K
JZz/Wl5gIRbSsXmpktq6GZ/JLqRIL4Y/voD65KtVwyL3TzuuPNzb4LXR5/TcdTsX
vsWLcTlUrQe+vSO4OFVnuapRU86dzE1s3U19wERug/QZdwm4xPVsrHVey9VWHHQQ
2niG3YDKbA==
=uC/q
-----END PGP SIGNATURE-----

Attachment: pgpMemhSMhWFP.pgp
Description: PGP signature


--- End Message ---

Reply to: