aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorSteve Ellcey <sje@cup.hp.com>2008-09-23 21:27:17 +0000
committerSteve Ellcey <sje@gcc.gnu.org>2008-09-23 21:27:17 +0000
commit8179c2f253c4bd249f7c474628b29b1d73e9cd9f (patch)
treece1628eeb4dabef0b184c01d3c37aa9c252b5303 /gcc
parentb41310e29d14fccd0e8eecf34bf636d7c02ef4c9 (diff)
downloadgcc-8179c2f253c4bd249f7c474628b29b1d73e9cd9f.zip
gcc-8179c2f253c4bd249f7c474628b29b1d73e9cd9f.tar.gz
gcc-8179c2f253c4bd249f7c474628b29b1d73e9cd9f.tar.bz2
target-supports.exp (check_effective_target_pow10): New.
* lib/target-supports.exp (check_effective_target_pow10): New. * g++.dg/cdce3.C: Set GNU_EXTENSION if pow10. From-SVN: r140618
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/cdce3.C73
-rw-r--r--gcc/testsuite/lib/target-supports.exp13
3 files changed, 55 insertions, 36 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c93187e..411cf0c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2008-09-23 Steve Ellcey <sje@cup.hp.com>
+
+ * lib/target-supports.exp (check_effective_target_pow10): New.
+ * g++.dg/cdce3.C: Set GNU_EXTENSION if pow10.
+
2008-09-23 Jakub Jelinek <jakub@redhat.com>
PR c++/37533
diff --git a/gcc/testsuite/g++.dg/cdce3.C b/gcc/testsuite/g++.dg/cdce3.C
index d70fa6d..b73ebf8 100644
--- a/gcc/testsuite/g++.dg/cdce3.C
+++ b/gcc/testsuite/g++.dg/cdce3.C
@@ -1,24 +1,25 @@
/* { dg-do run } */
/* { dg-require-effective-target c99_runtime } */
-/* { 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:90: note: function call is shrink-wrapped into error conditions\." "cdce" { target {! "*-*-darwin*" } } } }*/
-/* { dg-final { scan-tree-dump "cdce3.C:91: note: function call is shrink-wrapped into error conditions\." "cdce" { target {! "*-*-darwin*" } } } }*/
-/* { 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 { scan-tree-dump "cdce3.C:106: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/
+/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -DGNU_EXTENSION -DLARGE_LONG_DOUBLE -lm" { target { pow10 && large_long_double } } } */
+/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -DLARGE_LONG_DOUBLE -lm" { target { {! pow10 } && large_long_double } } } */
+/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -DGNU_EXTENSION -lm" { target {pow10 && {! large_long_double } } } } */
+/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -lm" { target { {! pow10 } && {! large_long_double } } } } */
+/* { dg-final { scan-tree-dump "cdce3.C:91: note: function call is shrink-wrapped into error conditions\." "cdce" { target { pow10 } } } } */
+/* { dg-final { scan-tree-dump "cdce3.C:92: note: function call is shrink-wrapped into error conditions\." "cdce" { target { pow10 } } } } */
+/* { 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 { scan-tree-dump "cdce3.C:106: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
+/* { dg-final { scan-tree-dump "cdce3.C:107: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
/* { dg-final { cleanup-tree-dump "cdce" } } */
#include <stdlib.h>
#include <math.h>
@@ -29,8 +30,9 @@
typedef void (*FP) (int xp);
#define NI __attribute__((noinline))
-#if defined(NO_LONG_DOUBLE)
-double result;
+#if defined(LARGE_LONG_DOUBLE)
+typedef long double ldouble;
+ldouble result;
#define DEF_MATH_FUNC(prefix, name) NI void prefix##name##f (int x) \
{ \
@@ -41,10 +43,14 @@ NI void prefix##name (int x) \
{ \
double yy = name ((double)x); \
STORE_RESULT; \
+} \
+NI void prefix##name##l (int x) \
+{ \
+ ldouble yy = name##l ((ldouble)x); \
+ STORE_RESULT; \
}
#else
-typedef long double ldouble;
-ldouble result;
+double result;
#define DEF_MATH_FUNC(prefix, name) NI void prefix##name##f (int x) \
{ \
@@ -55,17 +61,12 @@ NI void prefix##name (int x) \
{ \
double yy = name ((double)x); \
STORE_RESULT; \
-} \
-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)
+#if defined(GNU_EXTENSION)
DEF_MATH_FUNC (m,pow10)
DEF_MATH_FUNC (m,exp10)
#endif
@@ -86,7 +87,7 @@ DEF_MATH_FUNC (m,sqrt)
#undef STORE_RESULT
#define STORE_RESULT
-#if !defined(NO_GNU_EXTENSION)
+#if defined(GNU_EXTENSION)
DEF_MATH_FUNC (o,pow10)
DEF_MATH_FUNC (o,exp10)
#endif
@@ -105,13 +106,13 @@ 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
+#if defined(LARGE_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 }, \
{ prefix##name##l, #name "l" , 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 },
#endif
struct MathFuncInfo
@@ -123,7 +124,7 @@ struct MathFuncInfo
bool has_lb;
bool has_ub;
} math_func_arr[] = {
-#if !defined(NO_GNU_EXTENSION)
+#if defined(GNU_EXTENSION)
INIT_MATH_FUNC (m,pow10, false, true)
INIT_MATH_FUNC (m,exp10, false, true)
#endif
@@ -145,7 +146,7 @@ struct MathFuncInfo
MathFuncInfo opt_math_func_arr[] =
{
-#if !defined(NO_GNU_EXTENSION)
+#if defined(GNU_EXTENSION)
INIT_MATH_FUNC (o,pow10, false, true)
INIT_MATH_FUNC (o,exp10, false, true)
#endif
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 72117c6..a5e03bf 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -2612,3 +2612,16 @@ proc check_effective_target_wchar_t_char32_t_compatible { } {
char t[(((__CHAR32_TYPE__) -1) < 0 == ((__WCHAR_TYPE__) -1) < 0) ? 1 : -1];
}]
}
+
+# Return 1 if pow10 function exists.
+
+proc check_effective_target_pow10 { } {
+ return [check_runtime pow10 {
+ #include <math.h>
+ int main () {
+ double x;
+ x = pow10 (1);
+ return 0;
+ }
+ } "-lm" ]
+}