* soft-fp/Makefile (gcc-single-routines): Add unordsf2,

floatunsisf, floatundisf.
	(gcc-double-routines): Add unorddf2, floatunsidf, floatundidf.
	(gcc-quad-routines): Add unordtf2, floatunsitf, floatunditf.
	* soft-fp/op-common.h (_FP_CMP_UNORD): Define.
	* soft-fp/single.h (FP_CMP_UNORD_S): Define.
	* soft-fp/double.h (FP_CMP_UNORD_D): Define.
	* soft-fp/quad.h (FP_CMP_UNORD_Q): Define.
	* soft-fp/extended.h (FP_CMP_UNORD_E): Define.
	* soft-fp/unordsf2.c: New file.
	* soft-fp/unorddf2.c: New file.
	* soft-fp/unordtf2.c: New file.
	* soft-fp/floatunsisf.c: New file.
	* soft-fp/floatundisf.c: New file.
	* soft-fp/floatunsidf.c: New file.
	* soft-fp/floatundidf.c: New file.
	* soft-fp/floatunsitf.c: New file.
	* soft-fp/floatunditf.c: New file.
This commit is contained in:
Roland McGrath 2006-01-06 10:47:57 +00:00
parent 0d86378f95
commit e7b8c7bc73
16 changed files with 376 additions and 6 deletions

View file

@ -1,5 +1,24 @@
2005-12-04 Joseph S. Myers <joseph@codesourcery.com>
* soft-fp/Makefile (gcc-single-routines): Add unordsf2,
floatunsisf, floatundisf.
(gcc-double-routines): Add unorddf2, floatunsidf, floatundidf.
(gcc-quad-routines): Add unordtf2, floatunsitf, floatunditf.
* soft-fp/op-common.h (_FP_CMP_UNORD): Define.
* soft-fp/single.h (FP_CMP_UNORD_S): Define.
* soft-fp/double.h (FP_CMP_UNORD_D): Define.
* soft-fp/quad.h (FP_CMP_UNORD_Q): Define.
* soft-fp/extended.h (FP_CMP_UNORD_E): Define.
* soft-fp/unordsf2.c: New file.
* soft-fp/unorddf2.c: New file.
* soft-fp/unordtf2.c: New file.
* soft-fp/floatunsisf.c: New file.
* soft-fp/floatundisf.c: New file.
* soft-fp/floatunsidf.c: New file.
* soft-fp/floatundidf.c: New file.
* soft-fp/floatunsitf.c: New file.
* soft-fp/floatunditf.c: New file.
* soft-fp/op-common.h (__FP_CLZ): Define using __builtin_clz,
__builtin_clzl and __builtin_clzll.

View file

@ -23,17 +23,18 @@
subdir := soft-fp
gcc-single-routines := negsf2 addsf3 subsf3 mulsf3 divsf3 eqsf2 \
lesf2 gesf2 fixsfsi fixunssfsi floatsisf fixsfdi \
fixunssfdi floatdisf sqrtsf2
lesf2 gesf2 unordsf2 fixsfsi fixunssfsi floatsisf fixsfdi \
fixunssfdi floatdisf sqrtsf2 floatunsisf floatundisf
gcc-double-routines := negdf2 adddf3 subdf3 muldf3 divdf3 eqdf2 \
ledf2 gedf2 fixdfsi fixunsdfsi floatsidf fixdfdi \
fixunsdfdi floatdidf extendsfdf2 truncdfsf2 sqrtdf2
ledf2 gedf2 unorddf2 fixdfsi fixunsdfsi floatsidf fixdfdi \
fixunsdfdi floatdidf extendsfdf2 truncdfsf2 sqrtdf2 floatunsidf \
floatundidf
gcc-quad-routines := negtf2 addtf3 subtf3 multf3 divtf3 eqtf2 \
letf2 getf2 fixtfsi fixunstfsi floatsitf fixtfdi \
letf2 getf2 unordtf2 fixtfsi fixunstfsi floatsitf fixtfdi \
fixunstfdi floatditf extendsftf2 trunctfsf2 extenddftf2 \
trunctfdf2 sqrttf2
trunctfdf2 sqrttf2 floatunsitf floatunditf
distribute := double.h op-1.h op-2.h op-4.h op-common.h quad.h \
single.h soft-fp.h extended.h Banner op-8.h testit.c \

View file

@ -113,6 +113,7 @@ union _FP_UNION_D
#define FP_CMP_D(r,X,Y,un) _FP_CMP(D,2,r,X,Y,un)
#define FP_CMP_EQ_D(r,X,Y) _FP_CMP_EQ(D,2,r,X,Y)
#define FP_CMP_UNORD_D(r,X,Y) _FP_CMP_UNORD(D,2,r,X,Y)
#define FP_TO_INT_D(r,X,rsz,rsg) _FP_TO_INT(D,2,r,X,rsz,rsg)
#define FP_FROM_INT_D(X,r,rs,rt) _FP_FROM_INT(D,2,X,r,rs,rt)

View file

@ -224,6 +224,7 @@ union _FP_UNION_E
#define FP_CMP_E(r,X,Y,un) _FP_CMP(E,4,r,X,Y,un)
#define FP_CMP_EQ_E(r,X,Y) _FP_CMP_EQ(E,4,r,X,Y)
#define FP_CMP_UNORD_E(r,X,Y) _FP_CMP_UNORD(E,4,r,X,Y)
#define FP_TO_INT_E(r,X,rsz,rsg) _FP_TO_INT(E,4,r,X,rsz,rsg)
#define FP_FROM_INT_E(X,r,rs,rt) _FP_FROM_INT(E,4,X,r,rs,rt)

38
soft-fp/floatundidf.c Normal file
View file

@ -0,0 +1,38 @@
/* Software floating-point emulation.
Convert a 64bit unsigned integer to IEEE double
Copyright (C) 1997,1999, 2006 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).
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
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, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include "soft-fp.h"
#include "double.h"
double
__floatundidf(UDItype i)
{
FP_DECL_EX;
FP_DECL_D(A);
double a;
FP_FROM_INT_D(A, i, 64, long long);
FP_PACK_D(a, A);
FP_HANDLE_EXCEPTIONS;
return a;
}

38
soft-fp/floatundisf.c Normal file
View file

@ -0,0 +1,38 @@
/* Software floating-point emulation.
Convert a 64bit unsigned integer to IEEE single
Copyright (C) 1997,1999, 2006 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).
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
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, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include "soft-fp.h"
#include "single.h"
float
__floatundisf(UDItype i)
{
FP_DECL_EX;
FP_DECL_S(A);
float a;
FP_FROM_INT_S(A, i, 64, long long);
FP_PACK_S(a, A);
FP_HANDLE_EXCEPTIONS;
return a;
}

38
soft-fp/floatunditf.c Normal file
View file

@ -0,0 +1,38 @@
/* Software floating-point emulation.
Convert a 64bit unsigned integer to IEEE quad
Copyright (C) 1997,1999, 2006 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).
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
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, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include "soft-fp.h"
#include "quad.h"
long double
__floatunditf(UDItype i)
{
FP_DECL_EX;
FP_DECL_Q(A);
long double a;
FP_FROM_INT_Q(A, i, 64, long long);
FP_PACK_Q(a, A);
FP_HANDLE_EXCEPTIONS;
return a;
}

38
soft-fp/floatunsidf.c Normal file
View file

@ -0,0 +1,38 @@
/* Software floating-point emulation.
Convert a 32bit unsigned integer to IEEE double
Copyright (C) 1997,1999, 2006 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).
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
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, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include "soft-fp.h"
#include "double.h"
double
__floatunsidf(USItype i)
{
FP_DECL_EX;
FP_DECL_D(A);
double a;
FP_FROM_INT_D(A, i, 32, int);
FP_PACK_D(a, A);
FP_HANDLE_EXCEPTIONS;
return a;
}

38
soft-fp/floatunsisf.c Normal file
View file

@ -0,0 +1,38 @@
/* Software floating-point emulation.
Convert a 32bit unsigned integer to IEEE single
Copyright (C) 1997,1999, 2006 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).
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
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, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include "soft-fp.h"
#include "single.h"
float
__floatunsisf(USItype i)
{
FP_DECL_EX;
FP_DECL_S(A);
float a;
FP_FROM_INT_S(A, i, 32, int);
FP_PACK_S(a, A);
FP_HANDLE_EXCEPTIONS;
return a;
}

38
soft-fp/floatunsitf.c Normal file
View file

@ -0,0 +1,38 @@
/* Software floating-point emulation.
Convert a 32bit unsigned integer to IEEE quad
Copyright (C) 1997,1999, 2006 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).
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
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, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include "soft-fp.h"
#include "quad.h"
long double
__floatunsitf(USItype i)
{
FP_DECL_EX;
FP_DECL_Q(A);
long double a;
FP_FROM_INT_Q(A, i, 32, int);
FP_PACK_Q(a, A);
FP_HANDLE_EXCEPTIONS;
return a;
}

View file

@ -553,6 +553,14 @@ do { \
} \
} while (0)
/* Version to test unordered. */
#define _FP_CMP_UNORD(fs, wc, ret, X, Y) \
do { \
ret = ((X##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc(X)) \
|| (Y##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc(Y))); \
} while (0)
/*
* Main square root routine. The input value should be cooked.
*/

View file

@ -119,6 +119,7 @@ union _FP_UNION_Q
#define FP_CMP_Q(r,X,Y,un) _FP_CMP(Q,4,r,X,Y,un)
#define FP_CMP_EQ_Q(r,X,Y) _FP_CMP_EQ(Q,4,r,X,Y)
#define FP_CMP_UNORD_Q(r,X,Y) _FP_CMP_UNORD(Q,4,r,X,Y)
#define FP_TO_INT_Q(r,X,rsz,rsg) _FP_TO_INT(Q,4,r,X,rsz,rsg)
#define FP_FROM_INT_Q(X,r,rs,rt) _FP_FROM_INT(Q,4,X,r,rs,rt)

View file

@ -102,6 +102,7 @@ union _FP_UNION_S
#define FP_CMP_S(r,X,Y,un) _FP_CMP(S,1,r,X,Y,un)
#define FP_CMP_EQ_S(r,X,Y) _FP_CMP_EQ(S,1,r,X,Y)
#define FP_CMP_UNORD_S(r,X,Y) _FP_CMP_UNORD(S,1,r,X,Y)
#define FP_TO_INT_S(r,X,rsz,rsg) _FP_TO_INT(S,1,r,X,rsz,rsg)
#define FP_FROM_INT_S(X,r,rs,rt) _FP_FROM_INT(S,1,X,r,rs,rt)

36
soft-fp/unorddf2.c Normal file
View file

@ -0,0 +1,36 @@
/* Software floating-point emulation.
Return 1 iff a or b is a NaN, 0 otherwise.
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Joseph Myers (joseph@codesourcery.com).
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
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, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include "soft-fp.h"
#include "double.h"
int
__unorddf2(double a, double b)
{
FP_DECL_D(A); FP_DECL_D(B);
int r;
FP_UNPACK_RAW_D(A, a);
FP_UNPACK_RAW_D(B, b);
FP_CMP_UNORD_D(r, A, B);
return r;
}

37
soft-fp/unordsf2.c Normal file
View file

@ -0,0 +1,37 @@
/* Software floating-point emulation.
Return 1 iff a or b is a NaN, 0 otherwise.
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Joseph Myers (joseph@codesourcery.com).
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
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, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include "soft-fp.h"
#include "single.h"
int
__unordsf2(float a, float b)
{
FP_DECL_S(A);
FP_DECL_S(B);
int r;
FP_UNPACK_RAW_S(A, a);
FP_UNPACK_RAW_S(B, b);
FP_CMP_UNORD_S(r, A, B);
return r;
}

37
soft-fp/unordtf2.c Normal file
View file

@ -0,0 +1,37 @@
/* Software floating-point emulation.
Return 1 iff a or b is a NaN, 0 otherwise.
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Joseph Myers (joseph@codesourcery.com).
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
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, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include "soft-fp.h"
#include "quad.h"
int
__unordtf2(long double a, long double b)
{
FP_DECL_Q(A);
FP_DECL_Q(B);
int r;
FP_UNPACK_RAW_Q(A, a);
FP_UNPACK_RAW_Q(B, b);
FP_CMP_UNORD_Q(r, A, B);
return r;
}