This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH, take-2, soft-fp]: Allow gcc to override soft-fp compare return type
- From: Uros Bizjak <ubizjak at gmail dot com>
- To: libc-alpha at sourceware dot org
- Cc: Jakub Jelinek <jakub at redhat dot com>
- Date: Thu, 14 Jun 2007 21:02:18 +0200
- Subject: [PATCH, take-2, soft-fp]: Allow gcc to override soft-fp compare return type
Hello!
This patch is an update of my previous patch that uses mode(word) for
compare return type. In this patch, CMPtype is defined to int if
undefined, maintaining compatibility with older libc soft-fp and also
allowing gcc to override it with its own type.
Patch was tested by running gcc testsuite on x86_64 soft-fp target.
2007-06-14 Uros Bizjak <ubizjak@gmail.com>
* soft-fp/soft-fp.h (CMPtype): Define to "int" if undefined.
* soft-fp/eqdf2.c (__eqdf2): Use CMPtype instead of int
as the return type. Change type of "r" variable to CMPtype.
* soft-fp/eqsf2.c (__eqsf2): Ditto.
* soft-fp/eqtf2.c (__eqtf2): Ditto.
* soft-fp/gedf2.c (__gedf2): Ditto.
* soft-fp/gesf2.c (__gesf2): Ditto.
* soft-fp/getf2.c (__getf2): Ditto.
* soft-fp/ledf2.c (__ledf2): Ditto.
* soft-fp/lesf2.c (__lesf2): Ditto.
* soft-fp/letf2.c (__letf2): Ditto.
* soft-fp/unorddf2 (__unorddf2): Ditto.
* soft-fp/unordsf2 (__unordsf2): Ditto.
* soft-fp/unordtf2 (__unordtf2): Ditto.
Thanks,
Uros.
Index: unordsf2.c
===================================================================
--- unordsf2.c (revision 125716)
+++ unordsf2.c (working copy)
@@ -1,6 +1,6 @@
/* Software floating-point emulation.
Return 1 iff a or b is a NaN, 0 otherwise.
- Copyright (C) 2006 Free Software Foundation, Inc.
+ Copyright (C) 2006,2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Joseph Myers (joseph@codesourcery.com).
@@ -31,12 +31,11 @@
#include "soft-fp.h"
#include "single.h"
-int
-__unordsf2(SFtype a, SFtype b)
+CMPtype __unordsf2(SFtype a, SFtype b)
{
FP_DECL_S(A);
FP_DECL_S(B);
- int r;
+ CMPtype r;
FP_UNPACK_RAW_S(A, a);
FP_UNPACK_RAW_S(B, b);
Index: unordtf2.c
===================================================================
--- unordtf2.c (revision 125716)
+++ unordtf2.c (working copy)
@@ -1,6 +1,6 @@
/* Software floating-point emulation.
Return 1 iff a or b is a NaN, 0 otherwise.
- Copyright (C) 2006 Free Software Foundation, Inc.
+ Copyright (C) 2006,2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Joseph Myers (joseph@codesourcery.com).
@@ -31,12 +31,11 @@
#include "soft-fp.h"
#include "quad.h"
-int
-__unordtf2(TFtype a, TFtype b)
+CMPtype __unordtf2(TFtype a, TFtype b)
{
FP_DECL_Q(A);
FP_DECL_Q(B);
- int r;
+ CMPtype r;
FP_UNPACK_RAW_Q(A, a);
FP_UNPACK_RAW_Q(B, b);
Index: lesf2.c
===================================================================
--- lesf2.c (revision 125716)
+++ lesf2.c (working copy)
@@ -1,6 +1,6 @@
/* Software floating-point emulation.
Return 0 iff a == b, 1 iff a > b, 2 iff a ? b, -1 iff a < b
- Copyright (C) 1997,1999,2006 Free Software Foundation, Inc.
+ Copyright (C) 1997,1999,2006,2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (rth@cygnus.com) and
Jakub Jelinek (jj@ultra.linux.cz).
@@ -32,11 +32,11 @@
#include "soft-fp.h"
#include "single.h"
-int __lesf2(SFtype a, SFtype b)
+CMPtype __lesf2(SFtype a, SFtype b)
{
FP_DECL_EX;
FP_DECL_S(A); FP_DECL_S(B);
- int r;
+ CMPtype r;
FP_UNPACK_RAW_S(A, a);
FP_UNPACK_RAW_S(B, b);
Index: letf2.c
===================================================================
--- letf2.c (revision 125716)
+++ letf2.c (working copy)
@@ -32,11 +32,11 @@
#include "soft-fp.h"
#include "quad.h"
-int __letf2(TFtype a, TFtype b)
+CMPtype __letf2(TFtype a, TFtype b)
{
FP_DECL_EX;
FP_DECL_Q(A); FP_DECL_Q(B);
- int r;
+ CMPtype r;
FP_UNPACK_RAW_Q(A, a);
FP_UNPACK_RAW_Q(B, b);
Index: gedf2.c
===================================================================
--- gedf2.c (revision 125716)
+++ gedf2.c (working copy)
@@ -1,6 +1,6 @@
/* Software floating-point emulation.
Return 0 iff a == b, 1 iff a > b, -2 iff a ? b, -1 iff a < b
- Copyright (C) 1997,1999,2006 Free Software Foundation, Inc.
+ Copyright (C) 1997,1999,2006,2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (rth@cygnus.com) and
Jakub Jelinek (jj@ultra.linux.cz).
@@ -32,11 +32,11 @@
#include "soft-fp.h"
#include "double.h"
-int __gedf2(DFtype a, DFtype b)
+CMPtype __gedf2(DFtype a, DFtype b)
{
FP_DECL_EX;
FP_DECL_D(A); FP_DECL_D(B);
- int r;
+ CMPtype r;
FP_UNPACK_RAW_D(A, a);
FP_UNPACK_RAW_D(B, b);
Index: eqdf2.c
===================================================================
--- eqdf2.c (revision 125716)
+++ eqdf2.c (working copy)
@@ -1,6 +1,6 @@
/* Software floating-point emulation.
Return 0 iff a == b, 1 otherwise
- Copyright (C) 1997,1999,2006 Free Software Foundation, Inc.
+ Copyright (C) 1997,1999,2006,2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (rth@cygnus.com) and
Jakub Jelinek (jj@ultra.linux.cz).
@@ -32,11 +32,11 @@
#include "soft-fp.h"
#include "double.h"
-int __eqdf2(DFtype a, DFtype b)
+CMPtype __eqdf2(DFtype a, DFtype b)
{
FP_DECL_EX;
FP_DECL_D(A); FP_DECL_D(B);
- int r;
+ CMPtype r;
FP_UNPACK_RAW_D(A, a);
FP_UNPACK_RAW_D(B, b);
Index: gesf2.c
===================================================================
--- gesf2.c (revision 125716)
+++ gesf2.c (working copy)
@@ -1,6 +1,6 @@
/* Software floating-point emulation.
Return 0 iff a == b, 1 iff a > b, -2 iff a ? b, -1 iff a < b
- Copyright (C) 1997,1999,2006 Free Software Foundation, Inc.
+ Copyright (C) 1997,1999,2006,2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (rth@cygnus.com) and
Jakub Jelinek (jj@ultra.linux.cz).
@@ -32,11 +32,11 @@
#include "soft-fp.h"
#include "single.h"
-int __gesf2(SFtype a, SFtype b)
+CMPtype __gesf2(SFtype a, SFtype b)
{
FP_DECL_EX;
FP_DECL_S(A); FP_DECL_S(B);
- int r;
+ CMPtype r;
FP_UNPACK_RAW_S(A, a);
FP_UNPACK_RAW_S(B, b);
Index: getf2.c
===================================================================
--- getf2.c (revision 125716)
+++ getf2.c (working copy)
@@ -1,6 +1,6 @@
/* Software floating-point emulation.
Return 0 iff a == b, 1 iff a > b, -2 iff a ? b, -1 iff a < b
- Copyright (C) 1997,1999,2006 Free Software Foundation, Inc.
+ Copyright (C) 1997,1999,2006,2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (rth@cygnus.com) and
Jakub Jelinek (jj@ultra.linux.cz).
@@ -32,11 +32,11 @@
#include "soft-fp.h"
#include "quad.h"
-int __getf2(TFtype a, TFtype b)
+CMPtype __getf2(TFtype a, TFtype b)
{
FP_DECL_EX;
FP_DECL_Q(A); FP_DECL_Q(B);
- int r;
+ CMPtype r;
FP_UNPACK_RAW_Q(A, a);
FP_UNPACK_RAW_Q(B, b);
Index: eqsf2.c
===================================================================
--- eqsf2.c (revision 125716)
+++ eqsf2.c (working copy)
@@ -1,6 +1,6 @@
/* Software floating-point emulation.
Return 0 iff a == b, 1 otherwise
- Copyright (C) 1997,1999,2006 Free Software Foundation, Inc.
+ Copyright (C) 1997,1999,2006,2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (rth@cygnus.com) and
Jakub Jelinek (jj@ultra.linux.cz).
@@ -32,11 +32,11 @@
#include "soft-fp.h"
#include "single.h"
-int __eqsf2(SFtype a, SFtype b)
+CMPtype __eqsf2(SFtype a, SFtype b)
{
FP_DECL_EX;
FP_DECL_S(A); FP_DECL_S(B);
- int r;
+ CMPtype r;
FP_UNPACK_RAW_S(A, a);
FP_UNPACK_RAW_S(B, b);
Index: eqtf2.c
===================================================================
--- eqtf2.c (revision 125716)
+++ eqtf2.c (working copy)
@@ -1,6 +1,6 @@
/* Software floating-point emulation.
Return 0 iff a == b, 1 otherwise
- Copyright (C) 1997,1999,2006 Free Software Foundation, Inc.
+ Copyright (C) 1997,1999,2006,2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (rth@cygnus.com) and
Jakub Jelinek (jj@ultra.linux.cz).
@@ -32,11 +32,11 @@
#include "soft-fp.h"
#include "quad.h"
-int __eqtf2(TFtype a, TFtype b)
+CMPtype __eqtf2(TFtype a, TFtype b)
{
FP_DECL_EX;
FP_DECL_Q(A); FP_DECL_Q(B);
- int r;
+ CMPtype r;
FP_UNPACK_RAW_Q(A, a);
FP_UNPACK_RAW_Q(B, b);
Index: soft-fp.h
===================================================================
--- soft-fp.h (revision 125716)
+++ soft-fp.h (working copy)
@@ -189,6 +189,10 @@
typedef USItype UHWtype;
#endif
+#ifndef CMPtype
+#define CMPtype int
+#endif
+
#define SI_BITS (__CHAR_BIT__ * (int)sizeof(SItype))
#define DI_BITS (__CHAR_BIT__ * (int)sizeof(DItype))
Index: unorddf2.c
===================================================================
--- unorddf2.c (revision 125716)
+++ unorddf2.c (working copy)
@@ -1,6 +1,6 @@
/* Software floating-point emulation.
Return 1 iff a or b is a NaN, 0 otherwise.
- Copyright (C) 2006 Free Software Foundation, Inc.
+ Copyright (C) 2006,2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Joseph Myers (joseph@codesourcery.com).
@@ -31,11 +31,10 @@
#include "soft-fp.h"
#include "double.h"
-int
-__unorddf2(DFtype a, DFtype b)
+CMPtype __unorddf2(DFtype a, DFtype b)
{
FP_DECL_D(A); FP_DECL_D(B);
- int r;
+ CMPtype r;
FP_UNPACK_RAW_D(A, a);
FP_UNPACK_RAW_D(B, b);
Index: ledf2.c
===================================================================
--- ledf2.c (revision 125716)
+++ ledf2.c (working copy)
@@ -1,6 +1,6 @@
/* Software floating-point emulation.
Return 0 iff a == b, 1 iff a > b, 2 iff a ? b, -1 iff a < b
- Copyright (C) 1997,1999,2006 Free Software Foundation, Inc.
+ Copyright (C) 1997,1999,2006,2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (rth@cygnus.com) and
Jakub Jelinek (jj@ultra.linux.cz).
@@ -32,11 +32,11 @@
#include "soft-fp.h"
#include "double.h"
-int __ledf2(DFtype a, DFtype b)
+CMPtype __ledf2(DFtype a, DFtype b)
{
FP_DECL_EX;
FP_DECL_D(A); FP_DECL_D(B);
- int r;
+ CMPtype r;
FP_UNPACK_RAW_D(A, a);
FP_UNPACK_RAW_D(B, b);