This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] add softfp to sparc-*-linux*
- From: Austin Foxley <austinf at cetoncorp dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 14 Apr 2009 12:08:52 -0700
- Subject: [patch] add softfp to sparc-*-linux*
I'm using a sparc leon processor, which is synthesizable without an fpu. I've
been using this patch which adds the ability to use the softfp soft-float
implementation on sparc. The sfp-machine header is based on the rs6000 version.
I tested that -msoft-float will emit calls to the softfp functions and
actually works. Also tested that -mhard-float still emits actual floating point
instructions.
Anyone interested in taking a look and committing this?
2009-04-14 Austin Foxley <austinf@cetoncorp.com>
* config.gcc (sparc-*-linux*) : Add softfp rules to sparc linux target
* config/sparc/sfp-machine.h : softfp machine header, based on rs6000
* config/sparc/t-fprules-softfp : softfp config rules for sparc
Index: gcc/config.gcc
===================================================================
--- gcc/config.gcc (revision 146056)
+++ gcc/config.gcc (working copy)
@@ -2175,7 +2175,7 @@
else
tm_file="${tm_file} sparc/linux.h"
fi
- tmake_file="${tmake_file} sparc/t-crtfm"
+ tmake_file="${tmake_file} sparc/t-crtfm sparc/t-fprules-softfp soft-fp/t-softfp"
;;
sparc-*-rtems*)
tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h sparc/sp-elf.h sparc/rtemself.h rtems.h newlib-stdint.h"
Index: gcc/config/sparc/sfp-machine.h
===================================================================
--- gcc/config/sparc/sfp-machine.h (revision 0)
+++ gcc/config/sparc/sfp-machine.h (revision 0)
@@ -0,0 +1,48 @@
+#define _FP_W_TYPE_SIZE 32
+#define _FP_W_TYPE unsigned long
+#define _FP_WS_TYPE signed long
+#define _FP_I_TYPE long
+
+#define _FP_MUL_MEAT_S(R,X,Y) \
+ _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm)
+#define _FP_MUL_MEAT_D(R,X,Y) \
+ _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm)
+#define _FP_MUL_MEAT_Q(R,X,Y) \
+ _FP_MUL_MEAT_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
+
+#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_loop(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)
+
+#define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1)
+#define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1), -1
+#define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1
+#define _FP_NANSIGN_S 0
+#define _FP_NANSIGN_D 0
+#define _FP_NANSIGN_Q 0
+
+#define _FP_KEEPNANFRACP 1
+
+#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \
+ do { \
+ if ((_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs) \
+ && !(_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs)) \
+ { \
+ R##_s = Y##_s; \
+ _FP_FRAC_COPY_##wc(R,Y); \
+ } \
+ else \
+ { \
+ R##_s = X##_s; \
+ _FP_FRAC_COPY_##wc(R,X); \
+ } \
+ R##_c = FP_CLS_NAN; \
+ } while (0)
+
+#define __BYTE_ORDER __BIG_ENDIAN
+
+
+/* Define ALIASNAME as a strong alias for NAME. */
+# define strong_alias(name, aliasname) _strong_alias(name, aliasname)
+# define _strong_alias(name, aliasname) \
+ extern __typeof (name) aliasname __attribute__ ((alias (#name)));
Index: gcc/config/sparc/t-fprules-softfp
===================================================================
--- gcc/config/sparc/t-fprules-softfp (revision 0)
+++ gcc/config/sparc/t-fprules-softfp (revision 0)
@@ -0,0 +1,6 @@
+softfp_float_modes := sf df
+softfp_int_modes := si di
+softfp_extensions := sfdf
+softfp_truncations := dfsf
+softfp_machine_header := sparc/sfp-machine.h
+softfp_exclude_libgcc2 := y