This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC patch: Add libquadmath - and use it in gfortran (round two)


On 11/08/2010 06:36 PM, Jack Howarth wrote:
On Mon, Nov 08, 2010 at 06:20:41PM -0800, Jerry DeLisle wrote:
I am currently bootstrapping the patches.  I am curious what these tmp1
and tmp2 are about? Also see them on the real128 versions as well.

#if defined(GFC_REAL_16_IS_FLOAT128)
void
transfer_complex128 (st_parameter_dt *dtp, void *p, int kind)
{
   static void *tmp1 = quadmath_strtopQ;
   static void *tmp2 = quadmath_dtoaq;

   transfer_complex (dtp, p, kind);
}


void transfer_complex_write128 (st_parameter_dt *dtp, void *p, int kind) { static void *tmp1 = quadmath_strtopQ; static void *tmp2 = quadmath_dtoaq;

   transfer_complex (dtp, p, kind);
}
#endif


Jerry

Jerry, With the corrections to libgfortran/transfer.c that I mentioned in...

http://gcc.gnu.org/ml/gcc-patches/2010-11/msg00830.html

the example...

program test_qp
   implicit none
   integer, parameter :: QP = 16
   real(QP), parameter :: Z1 = 1,HALF_PI = asin(Z1),PI = HALF_PI+HALF_PI
   real(QP) :: x = 0.124_QP
   print *, x
   print *, PI
   print *, 16*atan(0.2_QP)-4*atan(Z1/239)
   print *, sin(PI)
   print *, cos(HALF_PI)
   print *, asinh(PI)
   print *, erfc(Z1)
   print *, epsilon(x)
   print *, precision(x)
   print *, digits(x)
end program test_qp

compiles without error and the resulting binary on x86_64-apple-darwin10
produces the output...

   0.12399999999999999999999999999999999
    3.1415926535897932384626433832795028
    3.1415926535897932384626433832795032
   8.67181013012378102479704402604335225E-0035
   4.33590506506189051239852201302167613E-0035
    1.8622957433108482198883613251826206
   0.15729920705028513065877936491739074
   1.92592994438723585305597794258492732E-0034
           33
          113

Jack


I get this as well:


$ gfc test-qp.f90
$ ./a.out
  0.12399999999999999999999999999999999
   3.1415926535897932384626433832795028
   3.1415926535897932384626433832795032
  8.67181013012378102479704402604335225E-0035
  4.33590506506189051239852201302167613E-0035
   1.8622957433108482198883613251826206
  0.15729920705028513065877936491739074
  1.92592994438723585305597794258492732E-0034
          33
         113

I ended up with the attached diff for transfer.c.

(diff against trunk) Tobias, revert your local transfer.c and apply this one. I also tested with some other programs I had done previously and all looks OK. Regression testing is on going.

Regards,

Jerry
Index: transfer.c
===================================================================
--- transfer.c	(revision 166460)
+++ transfer.c	(working copy)
@@ -56,6 +56,8 @@ see the files COPYING3 and COPYING.RUNTIME respect
       transfer_character_wide
       transfer_real
       transfer_complex
+      transfer_real128
+      transfer_complex128
 
     These subroutines do not return status.
 
@@ -76,6 +78,14 @@ export_proto(transfer_real);
 extern void transfer_real_write (st_parameter_dt *, void *, int);
 export_proto(transfer_real_write);
 
+#if defined(GFC_REAL_16_IS_FLOAT128)
+extern void transfer_real128 (st_parameter_dt *, void *, int);
+export_proto(transfer_real128);
+
+extern void transfer_real_write128 (st_parameter_dt *, void *, int);
+export_proto(transfer_real_write128);
+#endif
+
 extern void transfer_logical (st_parameter_dt *, void *, int);
 export_proto(transfer_logical);
 
@@ -98,6 +108,14 @@ export_proto(transfer_character_wide_write);
 extern void transfer_complex (st_parameter_dt *, void *, int);
 export_proto(transfer_complex);
 
+#if defined(GFC_REAL_16_IS_FLOAT128)
+extern void transfer_complex128 (st_parameter_dt *, void *, int);
+export_proto(transfer_complex128);
+
+extern void transfer_complex_write128 (st_parameter_dt *, void *, int);
+export_proto(transfer_complex_write128);
+#endif
+
 extern void transfer_complex_write (st_parameter_dt *, void *, int);
 export_proto(transfer_complex_write);
 
@@ -1892,7 +1910,25 @@ transfer_real_write (st_parameter_dt *dtp, void *p
   transfer_real (dtp, p, kind);
 }
 
+/* Make sure that libquadmath is pulled in.  */
+
+#if defined(GFC_REAL_16_IS_FLOAT128)
 void
+transfer_real128 (st_parameter_dt *dtp, void *p, int kind)
+{
+  transfer_real (dtp, p, kind);
+}
+
+
+void
+transfer_real_write128 (st_parameter_dt *dtp, void *p, int kind)
+{
+  transfer_real (dtp, p, kind);
+}
+#endif
+
+
+void
 transfer_logical (st_parameter_dt *dtp, void *p, int kind)
 {
   if ((dtp->common.flags & IOPARM_LIBRETURN_MASK) != IOPARM_LIBRETURN_OK)
@@ -1964,13 +2000,33 @@ transfer_complex (st_parameter_dt *dtp, void *p, i
   dtp->u.p.transfer (dtp, BT_COMPLEX, p, kind, size, 1);
 }
 
+
 void
 transfer_complex_write (st_parameter_dt *dtp, void *p, int kind)
 {
   transfer_complex (dtp, p, kind);
 }
 
+
+/* Make sure that libquadmath is pulled in.  */
+
+#if defined(GFC_REAL_16_IS_FLOAT128)
 void
+transfer_complex128 (st_parameter_dt *dtp, void *p, int kind)
+{
+  transfer_complex (dtp, p, kind);
+}
+
+
+void
+transfer_complex_write128 (st_parameter_dt *dtp, void *p, int kind)
+{
+  transfer_complex (dtp, p, kind);
+}
+#endif
+
+
+void
 transfer_array (st_parameter_dt *dtp, gfc_array_char *desc, int kind,
 		gfc_charlen_type charlen)
 {

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]