This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch RFC] Tweak g++.dg/cdce3.C
- From: Kaz Kojima <kkojima at rr dot iij4u dot or dot jp>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 26 Jun 2008 08:53:28 +0900 (JST)
- Subject: [patch RFC] Tweak g++.dg/cdce3.C
Hi,
>From the reports on gcc-testresults, cdce3.C fails on several
targets:
hppa-unknown-linux-gnu
http://gcc.gnu.org/ml/gcc-testresults/2008-06/msg01550.html
sparc-sun-solaris2.8
http://gcc.gnu.org/ml/gcc-testresults/2008-06/msg01700.html
powerpc-ibm-aix5.3.0.0
http://gcc.gnu.org/ml/gcc-testresults/2008-06/msg01815.html
powerpc64-unknown-linux-gnu
http://gcc.gnu.org/ml/gcc-testresults/2008-06/msg01844.html
arm-none-eabi
http://gcc.gnu.org/ml/gcc-testresults/2008-06/msg01854.html
i386-unknown-freebsd6.2
http://gcc.gnu.org/ml/gcc-testresults/2008-06/msg01907.html
sh4-unknown-linux-gnu
http://gcc.gnu.org/ml/gcc-testresults/2008-06/msg01923.html
For these *-linux* and *-elf targets, it seems that the lack
of 'l' suffixed math functions causes errors.
The attached patch tweaks the test so as to test long double
math functions only for the targets having true long double and
skip tests for pow10*/exp10* functions which are gnu extensions
on darwin.
It's tested on i686-pc-linux-gnu and powerpc-apple-darwin9.0.0
with no new failures and gets rid of the failures for sh-elf and
sh4-unknown-linux-gnu. Can this patch help other *-linux, AIX,
Solaris and FreeBSD cases?
Regards,
kaz
--
* g++.dg/cdce3.C: Test long double math functions for
large_long_double target only. Skip pow10 and exp10
functions for *-*-darwin*.
--- ORIG/trunk/gcc/testsuite/g++.dg/cdce3.C 2008-06-08 14:05:15.000000000 +0900
+++ LOCAL/trunk/gcc/testsuite/g++.dg/cdce3.C 2008-06-26 08:23:54.000000000 +0900
@@ -1,21 +1,23 @@
-/* { dg-do run { target { ! "*-*-darwin*" } } } */
-/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -lm" } */
-/* { dg-final { scan-tree-dump "cdce3.C:68: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/
-/* { dg-final { scan-tree-dump "cdce3.C:69: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/
-/* { dg-final { scan-tree-dump "cdce3.C:70: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/
-/* { dg-final { scan-tree-dump "cdce3.C:71: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/
-/* { dg-final { scan-tree-dump "cdce3.C:72: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/
-/* { dg-final { scan-tree-dump "cdce3.C:73: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/
-/* { dg-final { scan-tree-dump "cdce3.C:74: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/
-/* { dg-final { scan-tree-dump "cdce3.C:75: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/
-/* { dg-final { scan-tree-dump "cdce3.C:76: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/
-/* { dg-final { scan-tree-dump "cdce3.C:77: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/
-/* { dg-final { scan-tree-dump "cdce3.C:78: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/
-/* { dg-final { scan-tree-dump "cdce3.C:79: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/
-/* { dg-final { scan-tree-dump "cdce3.C:80: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/
-/* { dg-final { scan-tree-dump "cdce3.C:81: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/
-/* { dg-final { scan-tree-dump "cdce3.C:82: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/
-/* { dg-final { scan-tree-dump "cdce3.C:83: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/
+/* { dg-do run } */
+/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -DNO_GNU_EXTENSION -lm" { target "*-*-darwin*" } } */
+/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -lm" { target { {! "*-*-darwin*" } && large_long_double } } }*/
+/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -DNO_LONG_DOUBLE -lm" { target {! large_long_double } } } */
+/* { dg-final { scan-tree-dump "cdce3.C:89: note: function call is shrink-wrapped into error conditions\." "cdce" { target {! "*-*-darwin*" } } } }*/
+/* { dg-final { scan-tree-dump "cdce3.C:90: note: function call is shrink-wrapped into error conditions\." "cdce" { target {! "*-*-darwin*" } } } }*/
+/* { dg-final { scan-tree-dump "cdce3.C:92: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/
+/* { dg-final { scan-tree-dump "cdce3.C:93: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/
+/* { dg-final { scan-tree-dump "cdce3.C:94: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/
+/* { dg-final { scan-tree-dump "cdce3.C:95: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/
+/* { dg-final { scan-tree-dump "cdce3.C:96: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/
+/* { dg-final { scan-tree-dump "cdce3.C:97: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/
+/* { dg-final { scan-tree-dump "cdce3.C:98: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/
+/* { dg-final { scan-tree-dump "cdce3.C:99: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/
+/* { dg-final { scan-tree-dump "cdce3.C:100: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/
+/* { dg-final { scan-tree-dump "cdce3.C:101: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/
+/* { dg-final { scan-tree-dump "cdce3.C:102: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/
+/* { dg-final { scan-tree-dump "cdce3.C:103: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/
+/* { dg-final { scan-tree-dump "cdce3.C:104: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/
+/* { dg-final { scan-tree-dump "cdce3.C:105: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/
/* { dg-final { cleanup-tree-dump "cdce" } } */
#include <stdlib.h>
#include <math.h>
@@ -23,9 +25,24 @@
#include <stdio.h>
#endif
#include <errno.h>
-typedef long double ldouble;
typedef void (*FP) (int xp);
#define NI __attribute__((noinline))
+
+#if defined(NO_LONG_DOUBLE)
+double result;
+
+#define DEF_MATH_FUNC(prefix, name) NI void prefix##name##f (int x) \
+{ \
+ float yy = name##f ((float) x); \
+ STORE_RESULT; \
+} \
+NI void prefix##name (int x) \
+{ \
+ double yy = name ((double)x); \
+ STORE_RESULT; \
+}
+#else
+typedef long double ldouble;
ldouble result;
#define DEF_MATH_FUNC(prefix, name) NI void prefix##name##f (int x) \
@@ -42,12 +59,15 @@ NI void prefix##name##l (int x) \
{ \
ldouble yy = name##l ((ldouble)x); \
STORE_RESULT; \
-}
+}
+#endif
#undef STORE_RESULT
#define STORE_RESULT result = yy
+#if !defined(NO_GNU_EXTENSION)
DEF_MATH_FUNC (m,pow10)
DEF_MATH_FUNC (m,exp10)
+#endif
DEF_MATH_FUNC (m,exp2)
DEF_MATH_FUNC (m,exp)
DEF_MATH_FUNC (m,expm1)
@@ -65,8 +85,10 @@ DEF_MATH_FUNC (m,sqrt)
#undef STORE_RESULT
#define STORE_RESULT
+#if !defined(NO_GNU_EXTENSION)
DEF_MATH_FUNC (o,pow10)
DEF_MATH_FUNC (o,exp10)
+#endif
DEF_MATH_FUNC (o,exp2)
DEF_MATH_FUNC (o,exp)
DEF_MATH_FUNC (o,expm1)
@@ -82,9 +104,14 @@ DEF_MATH_FUNC (o,log10)
DEF_MATH_FUNC (o,log1p)
DEF_MATH_FUNC (o,sqrt)
+#if defined(NO_LONG_DOUBLE)
+#define INIT_MATH_FUNC(prefix, name, lb, ub) { prefix##name##f, #name "f", 0, 0, lb, ub }, \
+{ prefix##name, #name, 0, 0, lb, ub },
+#else
#define INIT_MATH_FUNC(prefix, name, lb, ub) { prefix##name##f, #name "f", 0, 0, lb, ub }, \
{ prefix##name, #name, 0, 0, lb, ub }, \
{ prefix##name##l, #name "l" , 0, 0, lb, ub },
+#endif
struct MathFuncInfo
{
@@ -95,8 +122,10 @@ struct MathFuncInfo
bool has_lb;
bool has_ub;
} math_func_arr[] = {
+#if !defined(NO_GNU_EXTENSION)
INIT_MATH_FUNC (m,pow10, false, true)
INIT_MATH_FUNC (m,exp10, false, true)
+#endif
INIT_MATH_FUNC (m,exp2, false, true)
INIT_MATH_FUNC (m,expm1, false, true)
INIT_MATH_FUNC (m,exp, false, true)
@@ -114,8 +143,11 @@ struct MathFuncInfo
{ 0, 0, 0, 0, 0, 0} };
MathFuncInfo opt_math_func_arr[] =
-{ INIT_MATH_FUNC (o,pow10, false, true)
+{
+#if !defined(NO_GNU_EXTENSION)
+ INIT_MATH_FUNC (o,pow10, false, true)
INIT_MATH_FUNC (o,exp10, false, true)
+#endif
INIT_MATH_FUNC (o,exp2, false, true)
INIT_MATH_FUNC (o,expm1, false, true)
INIT_MATH_FUNC (o,exp, false, true)