From 77f01ab5d1d2eead1bd4a9135d6a76ebd3fe21e5 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Tue, 2 Jul 2013 14:55:32 +0000 Subject: Implement fma in soft-fp. --- ports/ChangeLog.mips | 18 ++++++++++++++++++ ports/sysdeps/mips/ieee754/s_fma.c | 5 +++++ ports/sysdeps/mips/ieee754/s_fmaf.c | 5 +++++ ports/sysdeps/mips/ieee754/s_fmal.c | 7 +++++++ ports/sysdeps/mips/mips32/Implies | 1 + ports/sysdeps/mips/mips64/n32/s_fma.c | 6 ------ ports/sysdeps/mips/mips64/n64/s_fma.c | 6 ------ ports/sysdeps/mips/mips64/soft-fp/sfp-machine.h | 7 +++++++ ports/sysdeps/mips/soft-fp/sfp-machine.h | 7 +++++++ 9 files changed, 50 insertions(+), 12 deletions(-) create mode 100644 ports/sysdeps/mips/ieee754/s_fma.c create mode 100644 ports/sysdeps/mips/ieee754/s_fmaf.c create mode 100644 ports/sysdeps/mips/ieee754/s_fmal.c delete mode 100644 ports/sysdeps/mips/mips64/n32/s_fma.c delete mode 100644 ports/sysdeps/mips/mips64/n64/s_fma.c (limited to 'ports') diff --git a/ports/ChangeLog.mips b/ports/ChangeLog.mips index 1f69593a2d..e985de998e 100644 --- a/ports/ChangeLog.mips +++ b/ports/ChangeLog.mips @@ -1,3 +1,21 @@ +2013-07-02 Joseph Myers + + [BZ #13304] + * sysdeps/mips/ieee754/s_fma.c: New file. + * sysdeps/mips/ieee754/s_fmaf.c: Likewise. + * sysdeps/mips/ieee754/s_fmal.c: Likewise. + * sysdeps/mips/mips32/Implies: Add mips/soft-fp. + * sysdeps/mips/mips64/n32/s_fma.c: Remove file. + * sysdeps/mips/mips64/n64/s_fma.c: Likewise. + * sysdeps/mips/mips64/soft-fp/sfp-machine.h (_FP_MUL_MEAT_DW_S): + New macro. + (_FP_MUL_MEAT_DW_D): Likewise. + (_FP_MUL_MEAT_DW_Q): Likewise. + * sysdeps/mips/soft-fp/sfp-machine.h (_FP_MUL_MEAT_DW_S): New + macro. + (_FP_MUL_MEAT_DW_D): Likewise. + (_FP_MUL_MEAT_DW_Q): Likewise. + 2013-06-28 Ryan S. Arnold * sysdeps/mips/dl-procinfo.h (_dl_procinfo): Add TYPE parameter diff --git a/ports/sysdeps/mips/ieee754/s_fma.c b/ports/sysdeps/mips/ieee754/s_fma.c new file mode 100644 index 0000000000..574141416b --- /dev/null +++ b/ports/sysdeps/mips/ieee754/s_fma.c @@ -0,0 +1,5 @@ +#ifdef __mips_hard_float +# include +#else +# include +#endif diff --git a/ports/sysdeps/mips/ieee754/s_fmaf.c b/ports/sysdeps/mips/ieee754/s_fmaf.c new file mode 100644 index 0000000000..30bcdae620 --- /dev/null +++ b/ports/sysdeps/mips/ieee754/s_fmaf.c @@ -0,0 +1,5 @@ +#ifdef __mips_hard_float +# include +#else +# include +#endif diff --git a/ports/sysdeps/mips/ieee754/s_fmal.c b/ports/sysdeps/mips/ieee754/s_fmal.c new file mode 100644 index 0000000000..6b83e914fe --- /dev/null +++ b/ports/sysdeps/mips/ieee754/s_fmal.c @@ -0,0 +1,7 @@ +#include + +#if _MIPS_SIM == _ABIO32 +# error "long double fma being compiled for o32 ABI" +#endif + +#include diff --git a/ports/sysdeps/mips/mips32/Implies b/ports/sysdeps/mips/mips32/Implies index 6473f2517c..42df98f45e 100644 --- a/ports/sysdeps/mips/mips32/Implies +++ b/ports/sysdeps/mips/mips32/Implies @@ -1,3 +1,4 @@ mips/ieee754 +mips/soft-fp mips wordsize-32 diff --git a/ports/sysdeps/mips/mips64/n32/s_fma.c b/ports/sysdeps/mips/mips64/n32/s_fma.c deleted file mode 100644 index 74a1e01fc1..0000000000 --- a/ports/sysdeps/mips/mips64/n32/s_fma.c +++ /dev/null @@ -1,6 +0,0 @@ -/* MIPS long double is implemented in software by fp-bit (as of GCC - 4.7) without support for exceptions or rounding modes, so the fma - implementation in terms of long double is slow and will not produce - correctly rounding results. */ - -#include diff --git a/ports/sysdeps/mips/mips64/n64/s_fma.c b/ports/sysdeps/mips/mips64/n64/s_fma.c deleted file mode 100644 index 74a1e01fc1..0000000000 --- a/ports/sysdeps/mips/mips64/n64/s_fma.c +++ /dev/null @@ -1,6 +0,0 @@ -/* MIPS long double is implemented in software by fp-bit (as of GCC - 4.7) without support for exceptions or rounding modes, so the fma - implementation in terms of long double is slow and will not produce - correctly rounding results. */ - -#include diff --git a/ports/sysdeps/mips/mips64/soft-fp/sfp-machine.h b/ports/sysdeps/mips/mips64/soft-fp/sfp-machine.h index 1bdde5ace8..9cfd6fbb7b 100644 --- a/ports/sysdeps/mips/mips64/soft-fp/sfp-machine.h +++ b/ports/sysdeps/mips/mips64/soft-fp/sfp-machine.h @@ -13,6 +13,13 @@ #define _FP_MUL_MEAT_Q(R,X,Y) \ _FP_MUL_MEAT_2_wide_3mul(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm) +#define _FP_MUL_MEAT_DW_S(R,X,Y) \ + _FP_MUL_MEAT_DW_1_imm(_FP_WFRACBITS_S,R,X,Y) +#define _FP_MUL_MEAT_DW_D(R,X,Y) \ + _FP_MUL_MEAT_DW_1_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm) +#define _FP_MUL_MEAT_DW_Q(R,X,Y) \ + _FP_MUL_MEAT_DW_2_wide_3mul(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm) + #define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_imm(S,R,X,Y,_FP_DIV_HELP_imm) #define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_1_udiv_norm(D,R,X,Y) #define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_2_udiv(Q,R,X,Y) diff --git a/ports/sysdeps/mips/soft-fp/sfp-machine.h b/ports/sysdeps/mips/soft-fp/sfp-machine.h index 8ccfaa60fd..a60bef7665 100644 --- a/ports/sysdeps/mips/soft-fp/sfp-machine.h +++ b/ports/sysdeps/mips/soft-fp/sfp-machine.h @@ -10,6 +10,13 @@ #define _FP_MUL_MEAT_Q(R,X,Y) \ _FP_MUL_MEAT_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm) +#define _FP_MUL_MEAT_DW_S(R,X,Y) \ + _FP_MUL_MEAT_DW_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm) +#define _FP_MUL_MEAT_DW_D(R,X,Y) \ + _FP_MUL_MEAT_DW_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm) +#define _FP_MUL_MEAT_DW_Q(R,X,Y) \ + _FP_MUL_MEAT_DW_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm) + #define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_udiv_norm(S,R,X,Y) #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) -- cgit v1.2.3