diff mbox

[libgcc] : Fix float128 soft-float for mingw targets

Message ID CAEwic4ZNw9bPW4abwHsWvMCG1ziMuLUATK0X-5mMGbu_EQt0GQ@mail.gmail.com
State New
Headers show

Commit Message

Kai Tietz March 1, 2012, 6:11 p.m. UTC
Hello,

Thanks and sorry for the troubles I caused.  Next time I will prepare
patches for it against glibc's developer repository.

As I understand the README file in soft-fp, just those files affected
by my patch need to be merged from glibc.

As the mingw targets are using by defaul ms-struct layout, the
following patch is
required to fix floating-point-software-emulation failures caused by
difference in
handling consecutive bitfields with different types.

ChangeLog

2012-03-01  Kai Tietz  <ktietz@redhat.com>

	* soft-fp/extended.h: Imported from glibc upstream.
	* soft-fp/float.h: Likewise.
	* soft-fp/single.h: Likewise
	* soft-fp/double.h: Likewise
	* soft-fp/soft-fp.h: Likewise.

Ok for apply ?

Regards,
Kai

Comments

Joseph Myers March 1, 2012, 6:35 p.m. UTC | #1
On Thu, 1 Mar 2012, Kai Tietz wrote:

> As I understand the README file in soft-fp, just those files affected
> by my patch need to be merged from glibc.

It's better to import the lot, rather than have mixed versions.  (But if 
there are non-comment changes to files not affected by your patch, it 
might be a good idea to wait until after the 4.7 branch to import those.)
Kai Tietz March 1, 2012, 6:43 p.m. UTC | #2
2012/3/1 Joseph S. Myers <joseph@codesourcery.com>:
> On Thu, 1 Mar 2012, Kai Tietz wrote:
>
>> As I understand the README file in soft-fp, just those files affected
>> by my patch need to be merged from glibc.
>
> It's better to import the lot, rather than have mixed versions.  (But if
> there are non-comment changes to files not affected by your patch, it
> might be a good idea to wait until after the 4.7 branch to import those.)
>
> --
> Joseph S. Myers
> joseph@codesourcery.com

Well, there are some new files, which aren't present in gcc's copy.
The rest of the changes are just related to the copyright-comment
section as far as I can see.

So for doing the full update Makefile in libgcc needs to be updated to have
sqrtdf2.c, sqrtsf2.c, and sqrttf2.c in build, too (if we want them).
The latter seems to me some material for 4.8.

So is the partial import for fixing the target issue ok?

Regards,
Kai
Joseph Myers March 1, 2012, 8:23 p.m. UTC | #3
On Thu, 1 Mar 2012, Kai Tietz wrote:

> Well, there are some new files, which aren't present in gcc's copy.

They are not new files.  They are files that were in soft-fp all along but 
weren't imported into GCC because they aren't relevant to GCC.

> The rest of the changes are just related to the copyright-comment
> section as far as I can see.

So you should import the current versions of all the files that exist in 
both places (without doing anything about files that only exist in one of 
the two places).
diff mbox

Patch

Index: soft-fp/extended.h
===================================================================
--- soft-fp/extended.h	(revision 184753)
+++ soft-fp/extended.h	(working copy)
@@ -1,6 +1,6 @@ 
 /* Software floating-point emulation.
    Definitions for IEEE Extended Precision.
-   Copyright (C) 1999,2006,2007 Free Software Foundation, Inc.
+   Copyright (C) 1999,2006,2007,2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek (jj@ultra.linux.cz).

@@ -24,9 +24,8 @@ 
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
-   MA 02110-1301, USA.  */
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */

 #if _FP_W_TYPE_SIZE < 32
 #error "Here's a nickel, kid. Go buy yourself a real computer."
@@ -64,7 +63,7 @@ 
 union _FP_UNION_E
 {
    XFtype flt;
-   struct
+   struct _FP_STRUCT_LAYOUT
    {
 #if __BYTE_ORDER == __BIG_ENDIAN
       unsigned long pad1 : _FP_W_TYPE_SIZE;
@@ -263,7 +262,7 @@ 
 union _FP_UNION_E
 {
   XFtype flt;
-  struct {
+  struct _FP_STRUCT_LAYOUT {
 #if __BYTE_ORDER == __BIG_ENDIAN
     _FP_W_TYPE pad  : (_FP_W_TYPE_SIZE - 1 - _FP_EXPBITS_E);
     unsigned sign   : 1;
Index: soft-fp/single.h
===================================================================
--- soft-fp/single.h	(revision 184753)
+++ soft-fp/single.h	(working copy)
@@ -1,6 +1,6 @@ 
 /* Software floating-point emulation.
    Definitions for IEEE Single Precision.
-   Copyright (C) 1997,1998,1999,2006 Free Software Foundation, Inc.
+   Copyright (C) 1997,1998,1999,2006,2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com),
 		  Jakub Jelinek (jj@ultra.linux.cz),
@@ -27,9 +27,8 @@ 
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
-   MA 02110-1301, USA.  */
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */

 #if _FP_W_TYPE_SIZE < 32
 #error "Here's a nickel kid.  Go buy yourself a real computer."
@@ -58,7 +57,7 @@ 
 union _FP_UNION_S
 {
   SFtype flt;
-  struct {
+  struct _FP_STRUCT_LAYOUT {
 #if __BYTE_ORDER == __BIG_ENDIAN
     unsigned sign : 1;
     unsigned exp  : _FP_EXPBITS_S;
Index: soft-fp/double.h
===================================================================
--- soft-fp/double.h	(revision 184753)
+++ soft-fp/double.h	(working copy)
@@ -1,6 +1,6 @@ 
 /* Software floating-point emulation.
    Definitions for IEEE Double Precision
-   Copyright (C) 1997, 1998, 1999, 2006, 2007, 2008, 2009
+   Copyright (C) 1997, 1998, 1999, 2006, 2007, 2008, 2009, 2012
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com),
@@ -28,9 +28,8 @@ 
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
-   MA 02110-1301, USA.  */
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */

 #if _FP_W_TYPE_SIZE < 32
 #error "Here's a nickel kid.  Go buy yourself a real computer."
@@ -68,7 +67,7 @@ 
 union _FP_UNION_D
 {
   DFtype flt;
-  struct {
+  struct _FP_STRUCT_LAYOUT {
 #if __BYTE_ORDER == __BIG_ENDIAN
     unsigned sign  : 1;
     unsigned exp   : _FP_EXPBITS_D;
@@ -167,7 +166,7 @@ 
 union _FP_UNION_D
 {
   DFtype flt;
-  struct {
+  struct _FP_STRUCT_LAYOUT {
 #if __BYTE_ORDER == __BIG_ENDIAN
     unsigned sign   : 1;
     unsigned exp    : _FP_EXPBITS_D;
Index: soft-fp/quad.h
===================================================================
--- soft-fp/quad.h	(revision 184753)
+++ soft-fp/quad.h	(working copy)
@@ -1,6 +1,6 @@ 
 /* Software floating-point emulation.
    Definitions for IEEE Quad Precision.
-   Copyright (C) 1997,1998,1999,2006,2007 Free Software Foundation, Inc.
+   Copyright (C) 1997,1998,1999,2006,2007,2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com),
 		  Jakub Jelinek (jj@ultra.linux.cz),
@@ -27,9 +27,8 @@ 
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
-   MA 02110-1301, USA.  */
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */

 #if _FP_W_TYPE_SIZE < 32
 #error "Here's a nickel, kid. Go buy yourself a real computer."
@@ -67,7 +66,7 @@ 
 union _FP_UNION_Q
 {
    TFtype flt;
-   struct
+   struct _FP_STRUCT_LAYOUT
    {
 #if __BYTE_ORDER == __BIG_ENDIAN
       unsigned sign : 1;
@@ -171,10 +170,10 @@ 
 union _FP_UNION_Q
 {
   TFtype flt /* __attribute__((mode(TF))) */ ;
-  struct {
+  struct _FP_STRUCT_LAYOUT {
     _FP_W_TYPE a, b;
   } longs;
-  struct {
+  struct _FP_STRUCT_LAYOUT {
 #if __BYTE_ORDER == __BIG_ENDIAN
     unsigned sign    : 1;
     unsigned exp     : _FP_EXPBITS_Q;
Index: soft-fp/soft-fp.h
===================================================================
--- soft-fp/soft-fp.h	(revision 184753)
+++ soft-fp/soft-fp.h	(working copy)
@@ -1,5 +1,5 @@ 
 /* Software floating-point emulation.
-   Copyright (C) 1997,1998,1999,2000,2002,2003,2005,2006
+   Copyright (C) 1997,1998,1999,2000,2002,2003,2005,2006,2007,2012
 	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com),
@@ -27,9 +27,8 @@ 
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
-   MA 02110-1301, USA.  */
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */

 #ifndef SOFT_FP_H
 #define SOFT_FP_H
@@ -85,6 +84,16 @@ 
 #define FP_EX_DENORM		0
 #endif

+/* _FP_STRUCT_LAYOUT may be defined as an attribute to determine the
+   struct layout variant used for structures where bit-fields are used
+   to access specific parts of binary floating-point numbers.  This is
+   required for systems where the default ABI uses struct layout with
+   differences in how consecutive bit-fields are laid out from the
+   default expected by soft-fp.  */
+#ifndef _FP_STRUCT_LAYOUT
+#define _FP_STRUCT_LAYOUT
+#endif
+
 #ifdef _FP_DECL_EX
 #define FP_DECL_EX					\
   int _fex = 0;						\