aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/config/darwin-ppc-ldouble-patch.def95
-rw-r--r--gcc/config/darwin-protos.h1
-rw-r--r--gcc/config/darwin.c48
-rw-r--r--gcc/config/rs6000/darwin.h3
-rw-r--r--gcc/config/rs6000/rs6000.c4
-rw-r--r--gcc/fortran/ChangeLog9
-rw-r--r--gcc/fortran/f95-lang.c6
-rw-r--r--gcc/fortran/trans-decl.c27
-rw-r--r--gcc/fortran/trans-expr.c8
-rw-r--r--gcc/fortran/trans.h4
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gfortran.dg/large_real_kind_2.F902
-rw-r--r--gcc/testsuite/gfortran.dg/large_real_kind_3.F9024
14 files changed, 210 insertions, 38 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9bf9a9d..e4af96d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,14 @@
+2008-02-23 Francois-Xavier Coudert <coudert@clipper.ens.fr>
+
+ PR target/25477
+ * config/darwin-protos.h: Add darwin_patch_builtins prototype.
+ * config/darwin-ppc-ldouble-patch.def: New file.
+ * config/rs6000/darwin.h (SUBTARGET_INIT_BUILTINS): New macro.
+ * config/rs6000/rs6000.c (rs6000_init_builtins): Call
+ SUBTARGET_INIT_BUILTINS if defined.
+ * config/darwin.c (darwin_patch_builtin,
+ darwin_patch_builtins): New functions.
+
2008-02-23 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR rtl-opt/33512
diff --git a/gcc/config/darwin-ppc-ldouble-patch.def b/gcc/config/darwin-ppc-ldouble-patch.def
new file mode 100644
index 0000000..0d09221
--- /dev/null
+++ b/gcc/config/darwin-ppc-ldouble-patch.def
@@ -0,0 +1,95 @@
+PATCH_BUILTIN (BUILT_IN_ACOSHL)
+PATCH_BUILTIN (BUILT_IN_ACOSL)
+PATCH_BUILTIN (BUILT_IN_ASINHL)
+PATCH_BUILTIN (BUILT_IN_ASINL)
+PATCH_BUILTIN (BUILT_IN_ATAN2L)
+PATCH_BUILTIN (BUILT_IN_ATANHL)
+PATCH_BUILTIN (BUILT_IN_ATANL)
+PATCH_BUILTIN (BUILT_IN_CABSL)
+PATCH_BUILTIN (BUILT_IN_CACOSHL)
+PATCH_BUILTIN (BUILT_IN_CACOSL)
+PATCH_BUILTIN (BUILT_IN_CARGL)
+PATCH_BUILTIN (BUILT_IN_CASINHL)
+PATCH_BUILTIN (BUILT_IN_CASINL)
+PATCH_BUILTIN (BUILT_IN_CATANHL)
+PATCH_BUILTIN (BUILT_IN_CATANL)
+PATCH_BUILTIN (BUILT_IN_CBRTL)
+PATCH_BUILTIN (BUILT_IN_CCOSHL)
+PATCH_BUILTIN (BUILT_IN_CCOSL)
+PATCH_BUILTIN (BUILT_IN_CEILL)
+PATCH_BUILTIN (BUILT_IN_CEXPL)
+PATCH_BUILTIN (BUILT_IN_CIMAGL)
+PATCH_BUILTIN (BUILT_IN_CLOGL)
+PATCH_BUILTIN (BUILT_IN_CONJL)
+PATCH_BUILTIN (BUILT_IN_COPYSIGNL)
+PATCH_BUILTIN (BUILT_IN_COSHL)
+PATCH_BUILTIN (BUILT_IN_COSL)
+PATCH_BUILTIN (BUILT_IN_CPOWL)
+PATCH_BUILTIN (BUILT_IN_CPROJL)
+PATCH_BUILTIN (BUILT_IN_CREALL)
+PATCH_BUILTIN (BUILT_IN_CSINHL)
+PATCH_BUILTIN (BUILT_IN_CSINL)
+PATCH_BUILTIN (BUILT_IN_CSQRTL)
+PATCH_BUILTIN (BUILT_IN_CTANHL)
+PATCH_BUILTIN (BUILT_IN_CTANL)
+PATCH_BUILTIN (BUILT_IN_ERFCL)
+PATCH_BUILTIN (BUILT_IN_ERFL)
+PATCH_BUILTIN (BUILT_IN_EXP2L)
+PATCH_BUILTIN (BUILT_IN_EXPL)
+PATCH_BUILTIN (BUILT_IN_EXPM1L)
+PATCH_BUILTIN (BUILT_IN_FABSL)
+PATCH_BUILTIN (BUILT_IN_FDIML)
+PATCH_BUILTIN (BUILT_IN_FLOORL)
+PATCH_BUILTIN (BUILT_IN_FMAL)
+PATCH_BUILTIN (BUILT_IN_FMAXL)
+PATCH_BUILTIN (BUILT_IN_FMINL)
+PATCH_BUILTIN (BUILT_IN_FMODL)
+PATCH_BUILTIN (BUILT_IN_FREXPL)
+PATCH_BUILTIN (BUILT_IN_HYPOTL)
+PATCH_BUILTIN (BUILT_IN_ILOGBL)
+PATCH_BUILTIN (BUILT_IN_LDEXPL)
+PATCH_BUILTIN (BUILT_IN_LGAMMAL)
+PATCH_BUILTIN (BUILT_IN_LLRINTL)
+PATCH_BUILTIN (BUILT_IN_LLROUNDL)
+PATCH_BUILTIN (BUILT_IN_LOG10L)
+PATCH_BUILTIN (BUILT_IN_LOG1PL)
+PATCH_BUILTIN (BUILT_IN_LOG2L)
+PATCH_BUILTIN (BUILT_IN_LOGBL)
+PATCH_BUILTIN (BUILT_IN_LOGL)
+PATCH_BUILTIN (BUILT_IN_LRINTL)
+PATCH_BUILTIN (BUILT_IN_LROUNDL)
+PATCH_BUILTIN (BUILT_IN_MODFL)
+PATCH_BUILTIN (BUILT_IN_NEARBYINTL)
+PATCH_BUILTIN (BUILT_IN_NEXTAFTERL)
+PATCH_BUILTIN (BUILT_IN_NEXTTOWARD)
+PATCH_BUILTIN (BUILT_IN_NEXTTOWARDF)
+PATCH_BUILTIN (BUILT_IN_NEXTTOWARDL)
+PATCH_BUILTIN (BUILT_IN_POWL)
+PATCH_BUILTIN (BUILT_IN_REMAINDERL)
+PATCH_BUILTIN (BUILT_IN_REMQUOL)
+PATCH_BUILTIN (BUILT_IN_RINTL)
+PATCH_BUILTIN (BUILT_IN_ROUNDL)
+PATCH_BUILTIN (BUILT_IN_SCALBLNL)
+PATCH_BUILTIN (BUILT_IN_SCALBNL)
+PATCH_BUILTIN (BUILT_IN_SINHL)
+PATCH_BUILTIN (BUILT_IN_SINL)
+PATCH_BUILTIN (BUILT_IN_SQRTL)
+PATCH_BUILTIN (BUILT_IN_TANHL)
+PATCH_BUILTIN (BUILT_IN_TANL)
+PATCH_BUILTIN (BUILT_IN_TGAMMAL)
+PATCH_BUILTIN (BUILT_IN_TRUNCL)
+PATCH_BUILTIN_NO64 (BUILT_IN_VFPRINTF)
+PATCH_BUILTIN_NO64 (BUILT_IN_VFSCANF)
+PATCH_BUILTIN_NO64 (BUILT_IN_VPRINTF)
+PATCH_BUILTIN_NO64 (BUILT_IN_VSCANF)
+PATCH_BUILTIN_NO64 (BUILT_IN_VSNPRINTF)
+PATCH_BUILTIN_NO64 (BUILT_IN_VSPRINTF)
+PATCH_BUILTIN_NO64 (BUILT_IN_VSSCANF)
+
+PATCH_BUILTIN_VARIADIC (BUILT_IN_FPRINTF)
+PATCH_BUILTIN_VARIADIC (BUILT_IN_FSCANF)
+PATCH_BUILTIN_VARIADIC (BUILT_IN_PRINTF)
+PATCH_BUILTIN_VARIADIC (BUILT_IN_SCANF)
+PATCH_BUILTIN_VARIADIC (BUILT_IN_SNPRINTF)
+PATCH_BUILTIN_VARIADIC (BUILT_IN_SPRINTF)
+PATCH_BUILTIN_VARIADIC (BUILT_IN_SSCANF)
diff --git a/gcc/config/darwin-protos.h b/gcc/config/darwin-protos.h
index a8ce17c..c894bf0 100644
--- a/gcc/config/darwin-protos.h
+++ b/gcc/config/darwin-protos.h
@@ -89,3 +89,4 @@ extern void darwin_cpp_builtins (struct cpp_reader *);
extern void darwin_asm_output_anchor (rtx symbol);
extern bool darwin_kextabi_p (void);
extern void darwin_override_options (void);
+extern void darwin_patch_builtins (void);
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index 307698d..13aa021 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -1735,4 +1735,52 @@ darwin_override_options (void)
flag_var_tracking_uninit = 1;
}
+/* Add $LDBL128 suffix to long double builtins. */
+
+static void
+darwin_patch_builtin (int fncode)
+{
+ tree fn = built_in_decls[fncode];
+ tree sym;
+ char *newname;
+
+ if (!fn)
+ return;
+
+ sym = DECL_ASSEMBLER_NAME (fn);
+ newname = alloca (IDENTIFIER_LENGTH (sym) + 10);
+ strcpy (newname, "_");
+ strcat (newname, IDENTIFIER_POINTER (sym));
+ strcat (newname, "$LDBL128");
+ set_user_assembler_name (fn, newname);
+ /*sym = get_identifier (newname);
+ SET_DECL_ASSEMBLER_NAME (fn, sym);*/
+
+ fn = implicit_built_in_decls[fncode];
+ if (fn)
+ set_user_assembler_name (fn, newname);
+ /*SET_DECL_ASSEMBLER_NAME (fn, sym);*/
+}
+
+void
+darwin_patch_builtins (void)
+{
+ if (LONG_DOUBLE_TYPE_SIZE != 128)
+ return;
+
+#define PATCH_BUILTIN(fncode) darwin_patch_builtin (fncode);
+#define PATCH_BUILTIN_NO64(fncode) \
+ if (!TARGET_64BIT) \
+ darwin_patch_builtin (fncode);
+#define PATCH_BUILTIN_VARIADIC(fncode) \
+ if (!TARGET_64BIT \
+ && (strverscmp (darwin_macosx_version_min, "10.3.9") >= 0)) \
+ darwin_patch_builtin (fncode);
+#include "darwin-ppc-ldouble-patch.def"
+#undef PATCH_BUILTIN
+#undef PATCH_BUILTIN_NO64
+#undef PATCH_BUILTIN_VARIADIC
+}
+
+
#include "gt-darwin.h"
diff --git a/gcc/config/rs6000/darwin.h b/gcc/config/rs6000/darwin.h
index 6c88757..f6c9ee3 100644
--- a/gcc/config/rs6000/darwin.h
+++ b/gcc/config/rs6000/darwin.h
@@ -432,3 +432,6 @@
/* When generating kernel code or kexts, we don't use Altivec by
default, as kernel code doesn't save/restore those registers. */
#define OS_MISSING_ALTIVEC (flag_mkernel || flag_apple_kext)
+
+/* Darwin has to rename some of the long double builtins. */
+#define SUBTARGET_INIT_BUILTINS darwin_patch_builtins ()
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index fb6aa19..00a7bc5 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -9187,6 +9187,10 @@ rs6000_init_builtins (void)
if (built_in_decls [BUILT_IN_CLOG])
set_user_assembler_name (built_in_decls [BUILT_IN_CLOG], "__clog");
#endif
+
+#ifdef SUBTARGET_INIT_BUILTINS
+ SUBTARGET_INIT_BUILTINS;
+#endif
}
/* Search through a set of builtins and enable the mask bits.
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 0273000..89766c6 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,12 @@
+2008-02-23 Francois-Xavier Coudert <coudert@clipper.ens.fr>
+
+ PR target/25477
+ * trans-expr.c (gfc_conv_power_op): Use BUILT_IN_CPOW{F,,L}.
+ * f95-lang.c (gfc_init_builtin_functions): Define BUILT_IN_CPOW{F,,L}.
+ * trans.h (gfor_fndecl_math_cpow, gfor_fndecl_math_cpowf,
+ gfor_fndecl_math_cpowl10, gfor_fndecl_math_cpowl16): Remove.
+ * trans-decl.c: Likewise.
+
2008-02-20 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/34907
diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c
index dcc64b9..3056fdb 100644
--- a/gcc/fortran/f95-lang.c
+++ b/gcc/fortran/f95-lang.c
@@ -942,6 +942,12 @@ gfc_init_builtin_functions (void)
BUILT_IN_POW, "pow", true);
gfc_define_builtin ("__builtin_powf", mfunc_float[1],
BUILT_IN_POWF, "powf", true);
+ gfc_define_builtin ("__builtin_cpowl", mfunc_clongdouble[1],
+ BUILT_IN_CPOWL, "cpowl", true);
+ gfc_define_builtin ("__builtin_cpow", mfunc_cdouble[1],
+ BUILT_IN_CPOW, "cpow", true);
+ gfc_define_builtin ("__builtin_cpowf", mfunc_cfloat[1],
+ BUILT_IN_CPOWF, "cpowf", true);
gfc_define_builtin ("__builtin_powil", mfunc_longdouble[2],
BUILT_IN_POWIL, "powil", true);
gfc_define_builtin ("__builtin_powi", mfunc_double[2],
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 79a3e8b..8ca4d43 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -99,10 +99,6 @@ tree gfor_fndecl_associated;
trans-intrinsic.c. */
gfc_powdecl_list gfor_fndecl_math_powi[4][3];
-tree gfor_fndecl_math_cpowf;
-tree gfor_fndecl_math_cpow;
-tree gfor_fndecl_math_cpowl10;
-tree gfor_fndecl_math_cpowl16;
tree gfor_fndecl_math_ishftc4;
tree gfor_fndecl_math_ishftc8;
tree gfor_fndecl_math_ishftc16;
@@ -2024,10 +2020,6 @@ gfc_build_intrinsic_function_decls (void)
tree gfc_real8_type_node = gfc_get_real_type (8);
tree gfc_real10_type_node = gfc_get_real_type (10);
tree gfc_real16_type_node = gfc_get_real_type (16);
- tree gfc_complex4_type_node = gfc_get_complex_type (4);
- tree gfc_complex8_type_node = gfc_get_complex_type (8);
- tree gfc_complex10_type_node = gfc_get_complex_type (10);
- tree gfc_complex16_type_node = gfc_get_complex_type (16);
/* String functions. */
gfor_fndecl_compare_string =
@@ -2195,25 +2187,6 @@ gfc_build_intrinsic_function_decls (void)
#undef NRKINDS
}
- gfor_fndecl_math_cpowf =
- gfc_build_library_function_decl (get_identifier ("cpowf"),
- gfc_complex4_type_node,
- 1, gfc_complex4_type_node);
- gfor_fndecl_math_cpow =
- gfc_build_library_function_decl (get_identifier ("cpow"),
- gfc_complex8_type_node,
- 1, gfc_complex8_type_node);
- if (gfc_complex10_type_node)
- gfor_fndecl_math_cpowl10 =
- gfc_build_library_function_decl (get_identifier ("cpowl"),
- gfc_complex10_type_node, 1,
- gfc_complex10_type_node);
- if (gfc_complex16_type_node)
- gfor_fndecl_math_cpowl16 =
- gfc_build_library_function_decl (get_identifier ("cpowl"),
- gfc_complex16_type_node, 1,
- gfc_complex16_type_node);
-
gfor_fndecl_math_ishftc4 =
gfc_build_library_function_decl (get_identifier (PREFIX("ishftc4")),
gfc_int4_type_node,
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 8d0392f..37fc728 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -935,16 +935,14 @@ gfc_conv_power_op (gfc_se * se, gfc_expr * expr)
switch (kind)
{
case 4:
- fndecl = gfor_fndecl_math_cpowf;
+ fndecl = built_in_decls[BUILT_IN_CPOWF];
break;
case 8:
- fndecl = gfor_fndecl_math_cpow;
+ fndecl = built_in_decls[BUILT_IN_CPOW];
break;
case 10:
- fndecl = gfor_fndecl_math_cpowl10;
- break;
case 16:
- fndecl = gfor_fndecl_math_cpowl16;
+ fndecl = built_in_decls[BUILT_IN_CPOWL];
break;
default:
gcc_unreachable ();
diff --git a/gcc/fortran/trans.h b/gcc/fortran/trans.h
index 9ccf571..7247688 100644
--- a/gcc/fortran/trans.h
+++ b/gcc/fortran/trans.h
@@ -526,10 +526,6 @@ typedef struct gfc_powdecl_list GTY(())
gfc_powdecl_list;
extern GTY(()) gfc_powdecl_list gfor_fndecl_math_powi[4][3];
-extern GTY(()) tree gfor_fndecl_math_cpowf;
-extern GTY(()) tree gfor_fndecl_math_cpow;
-extern GTY(()) tree gfor_fndecl_math_cpowl10;
-extern GTY(()) tree gfor_fndecl_math_cpowl16;
extern GTY(()) tree gfor_fndecl_math_ishftc4;
extern GTY(()) tree gfor_fndecl_math_ishftc8;
extern GTY(()) tree gfor_fndecl_math_ishftc16;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index e53852b..3453873 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2008-02-23 Francois-Xavier Coudert <coudert@clipper.ens.fr>
+
+ * gfortran.dg/large_real_kind_2.F90: Split testing of ERF and
+ ERFC into gfortran.dg/large_real_kind_3.F90.
+ * gfortran.dg/large_real_kind_3.F90: New test.
+
2008-02-23 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR rtl-opt/33512
diff --git a/gcc/testsuite/gfortran.dg/large_real_kind_2.F90 b/gcc/testsuite/gfortran.dg/large_real_kind_2.F90
index 7719caf..2e3891b 100644
--- a/gcc/testsuite/gfortran.dg/large_real_kind_2.F90
+++ b/gcc/testsuite/gfortran.dg/large_real_kind_2.F90
@@ -43,8 +43,6 @@
TEST_FUNCTION(log,0.00178914)
TEST_FUNCTION(log10,123789.123)
TEST_FUNCTION(sqrt,789.1356)
- TEST_FUNCTION(erf,1.45123231)
- TEST_FUNCTION(erfc,-0.123789)
CTEST_FUNCTION(cos,(17.456,-1.123))
CTEST_FUNCTION(sin,(17.456,-7.6))
diff --git a/gcc/testsuite/gfortran.dg/large_real_kind_3.F90 b/gcc/testsuite/gfortran.dg/large_real_kind_3.F90
new file mode 100644
index 0000000..0660b497
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/large_real_kind_3.F90
@@ -0,0 +1,24 @@
+! { dg-do run }
+! { dg-require-effective-target fortran_large_real }
+! { dg-xfail-if "" { "*-*-freebsd*" } { "*" } { "" } }
+
+! Testing erf and erfc library calls on large real kinds (larger than kind=8)
+ implicit none
+
+ integer,parameter :: k = selected_real_kind (precision (0.0_8) + 1)
+ real(8),parameter :: eps = 1e-8
+
+ real(kind=k) :: x
+ real(8) :: y
+
+#define TEST_FUNCTION(func,val) \
+ x = val ;\
+ y = x ;\
+ x = func (x) ;\
+ y = func (y) ;\
+ if (abs((y - x) / y) > eps) call abort
+
+ TEST_FUNCTION(erf,1.45123231)
+ TEST_FUNCTION(erfc,-0.123789)
+
+end