Hi DJ,
Please find below an updated patch which also adds the texi part.
My earlier patch which addressed your comments is below,
https://gcc.gnu.org/ml/gcc-patches/2014-05/msg01076.html

The newlib and binutils part of this patch have been reviewed and committed:
https://sourceware.org/ml/newlib/2014/msg00151.html
https://sourceware.org/ml/binutils/2014-05/msg00140.html

Let me know if below patch is ok to commit (also attached).

Thanks,
Kaushik

2014-05-26  Kaushik Phatak  <kaushik.pha...@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.
        * gcc/config/rl78/rl78.opt (m64bit-doubles): New option.
        (m32bit-doubles) Likewise.
        * gcc/config/rl78/t-rl78: Add 64-bit-double multilib.
        * doc/invoke.texi: Document -m32bit-doubles and -m64bit-doubles
        option for RL78.

Index: gcc/config/rl78/rl78.h
===================================================================
--- gcc/config/rl78/rl78.h      (revision 210920)
+++ 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,7 +101,7 @@
 #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
Index: gcc/config/rl78/rl78.opt
===================================================================
--- gcc/config/rl78/rl78.opt    (revision 210920)
+++ 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 210920)
+++ 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
Index: gcc/doc/invoke.texi
===================================================================
--- gcc/doc/invoke.texi (revision 210920)
+++ gcc/doc/invoke.texi (working copy)
@@ -873,7 +873,7 @@
 See RS/6000 and PowerPC Options.
 
 @emph{RL78 Options}
-@gccoptlist{-msim -mmul=none -mmul=g13 -mmul=rl78}
+@gccoptlist{-msim -mmul=none -mmul=g13 -mmul=rl78 -m64bit-doubles 
-m32bit-doubles}
 
 @emph{RS/6000 and PowerPC Options}
 @gccoptlist{-mcpu=@var{cpu-type} @gol
@@ -18917,6 +18917,14 @@
 only on the RL78/G13 targets.  The @code{rl78} option is for the
 standard hardware multiplication defined in the RL78 software manual.
 
+@item -m64bit-doubles
+@itemx -m32bit-doubles
+@opindex m64bit-doubles
+@opindex m32bit-doubles
+Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
+or 32 bits (@option{-m32bit-doubles}) in size.  The default is
+@option{-m32bit-doubles}.
+
 @end table
 
 @node RS/6000 and PowerPC Options 
 @node RS/6000 and PowerPC Options

Attachment: rl78_64bit.diff
Description: rl78_64bit.diff

Reply via email to