diff mbox

[Patch:,RL78] Add support for 64-bit doubles

Message ID 79a8e187348345229618ee9d09d52fed@HKNPR03MB001.apcprd03.prod.outlook.com
State New
Headers show

Commit Message

Kaushik Phatak March 6, 2014, 11:40 a.m. UTC
Hi,
Please find below a patch which adds support for 64-bit doubles to the RL78 target.
This is largely based on the rx target port and uses similar option and multilibs.
I will be posting the binutils and newlib part of this patch shortly.

Kindly review the same and let me know if OK to commit.

Thanks & Best Regards,
Kaushik

2013-03-06  Kaushik Phatak  <kaushik.phatak@kpit.com>

        * config/rl78/rl78.h (TARGET_CPU_CPP_BUILTINS): Define
        __RL78_64BIT_DOUBLES__ or __RL78_32BIT_DOUBLES__.
        (ASM_SPEC): Pass -m64bit-doubles or -m32bit-doubles on
        to the assembler.
        (DOUBLE_TYPE_SIZE): Use 64 bit if TARGET_64BIT_DOUBLES
        is true.
        (LIBGCC2_HAS_DF_MODE): Define based on __RL78_32BIT_DOUBLES__.
        (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Use 64 bit is
        __RL78_64BIT_DOUBLES__ is defined.
        * gcc/config/rl78/rl78.opt (m64bit-doubles): New option.
        (m32bit-doubles) Likewise.
        * gcc/config/rl78/t-rl78: Add 64-bit-double multilib.

Comments

DJ Delorie March 26, 2014, 8:38 p.m. UTC | #1
Sorry about the delay on this.  As GCC is in pre-release and it would
be bad for 4.9 to pass options that a released binutils doesn't
support, I hesitate to approve this at this time.  It looks OK, it's
just the timing is bad.  Please remind us after GCC is back in stage1.

I would also like to see an explicit initialization for the variable
to guarantee that the default is 32-bit-doubles, or some other
notation that guarantees the default.

Also, please note in the reminder that you've tested both options and
don't see any differences in the testsuite results between them that
reflect bugs in DFmode double support.  Just because you've enabled
the type doesn't mean it will work properly.
diff mbox

Patch

Index: gcc/config/rl78/rl78.h
===================================================================
--- gcc/config/rl78/rl78.h	(revision 208379)
+++ gcc/config/rl78/rl78.h	(working copy)
@@ -23,18 +23,22 @@ 
 #define RL78_MUL_RL78	(rl78_mul_type == MUL_RL78)
 #define RL78_MUL_G13	(rl78_mul_type == MUL_G13)
 
-#define TARGET_CPU_CPP_BUILTINS()               \
-  do                                            \
-    {                                           \
-      builtin_define ("__RL78__"); 		\
-      builtin_assert ("cpu=RL78"); 		\
-      if (RL78_MUL_RL78)			\
-	builtin_define ("__RL78_MUL_RL78__"); 	\
-      if (RL78_MUL_G13)				\
-	builtin_define ("__RL78_MUL_G13__"); 	\
-      if (TARGET_G10)				\
-	builtin_define ("__RL78_G10__"); 	\
-    }                                           \
+#define TARGET_CPU_CPP_BUILTINS()		    \
+  do                                                \
+    {                                               \
+      builtin_define ("__RL78__"); 		    \
+      builtin_assert ("cpu=RL78"); 		    \
+      if (RL78_MUL_RL78)			    \
+	builtin_define ("__RL78_MUL_RL78__"); 	    \
+      if (RL78_MUL_G13)				    \
+	builtin_define ("__RL78_MUL_G13__");        \
+      if (TARGET_G10)			      	    \
+	builtin_define ("__RL78_G10__");	    \
+      if (TARGET_64BIT_DOUBLES)			    \
+        builtin_define ("__RL78_64BIT_DOUBLES__");  \
+      else					    \
+        builtin_define ("__RL78_32BIT_DOUBLES__");  \
+    }						    \
   while (0)
 
 #undef  STARTFILE_SPEC
@@ -47,6 +51,8 @@ 
 #define ASM_SPEC "\
 %{mrelax:-relax} \
 %{mg10} \
+%{m64bit-doubles:-m64bit-doubles} \
+%{!m64bit-doubles:-m32bit-doubles} \
 "
 
 #undef  LINK_SPEC
@@ -95,11 +101,16 @@ 
 #define LONG_LONG_TYPE_SIZE		64
 
 #define FLOAT_TYPE_SIZE 		32
-#define DOUBLE_TYPE_SIZE 		32 /*64*/
+#define DOUBLE_TYPE_SIZE                (TARGET_64BIT_DOUBLES ? 64 : 32)
 #define LONG_DOUBLE_TYPE_SIZE		64 /*DOUBLE_TYPE_SIZE*/
 
-#define LIBGCC2_HAS_DF_MODE		1
+#ifdef __RL78_32BIT_DOUBLES__
+#define LIBGCC2_HAS_DF_MODE             0
+#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE   32
+#else
+#define LIBGCC2_HAS_DF_MODE             1
 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE   64
+#endif
 
 #define DEFAULT_SIGNED_CHAR		0
 
Index: gcc/config/rl78/rl78.opt
===================================================================
--- gcc/config/rl78/rl78.opt	(revision 208379)
+++ gcc/config/rl78/rl78.opt	(working copy)
@@ -30,6 +30,14 @@ 
 Target RejectNegative Joined Var(rl78_mul_type) Report Tolower Enum(rl78_mul_types) Init(MUL_NONE)
 Select hardware or software multiplication support.
 
+m64bit-doubles
+Target RejectNegative Mask(64BIT_DOUBLES) Report
+Store doubles in 64 bits.
+
+m32bit-doubles
+Target RejectNegative InverseMask(64BIT_DOUBLES) Report
+Stores doubles in 32 bits.  This is the default
+
 Enum
 Name(rl78_mul_types) Type(enum rl78_mul_types)
 
Index: gcc/config/rl78/t-rl78
===================================================================
--- gcc/config/rl78/t-rl78	(revision 208379)
+++ gcc/config/rl78/t-rl78	(working copy)
@@ -23,5 +23,5 @@ 
 
 # Enable multilibs:
 
-MULTILIB_OPTIONS    = mg10
-MULTILIB_DIRNAMES   = g10
+MULTILIB_OPTIONS    = mg10 m64bit-doubles
+MULTILIB_DIRNAMES   = g10  64-bit-double