summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/builtins-20.c
diff options
context:
space:
mode:
authorghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>2006-11-11 04:05:14 +0000
committerghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>2006-11-11 04:05:14 +0000
commite6ab33d8ca6b2fa17f5b7d633f19b8570e9c945c (patch)
treed6296e3b6e9ca4e372d936e1dd953fec297ffde3 /gcc/testsuite/gcc.dg/builtins-20.c
parent582d745ace98966f98be71826296bcba4491c3cd (diff)
downloadgcc-e6ab33d8ca6b2fa17f5b7d633f19b8570e9c945c.tar.gz
* builtins.c (fold_builtin_cos): Use fold_strip_sign_ops().
(fold_builtin_hypot): Likewise. * fold-const.c (fold_strip_sign_ops): Handle "odd" builtins. testsuite: * gcc.dg/builtins-20.c: Add more cases for stripping sign ops. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@118683 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/builtins-20.c')
-rw-r--r--gcc/testsuite/gcc.dg/builtins-20.c81
1 files changed, 81 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/builtins-20.c b/gcc/testsuite/gcc.dg/builtins-20.c
index 0c6736cdecf..e9f27a0014b 100644
--- a/gcc/testsuite/gcc.dg/builtins-20.c
+++ b/gcc/testsuite/gcc.dg/builtins-20.c
@@ -38,6 +38,15 @@ void test1(double x)
if (cos(x) != cos(-x))
link_error ();
+ if (cos(x) != cos(fabs(x)))
+ link_error ();
+
+ if (cos(x) != cos(-fabs(x)))
+ link_error ();
+
+ if (cos(tan(x)) != cos(tan(-fabs(x))))
+ link_error ();
+
if (sin(x)/cos(x) != tan(x))
link_error ();
@@ -65,6 +74,21 @@ void test2(double x, double y)
if (-sin(x-y) != sin(y-x))
link_error ();
+ if (cos(-x*y) != cos(x*y))
+ link_error ();
+
+ if (cos(x*-y) != cos(x*y))
+ link_error ();
+
+ if (cos(-x/y) != cos(x/y))
+ link_error ();
+
+ if (cos(x/-y) != cos(x/y))
+ link_error ();
+
+ if (cos(-fabs(tan(x/-y))) != cos(tan(x/y)))
+ link_error ();
+
if (hypot (x, 0) != fabs(x))
link_error ();
@@ -103,6 +127,9 @@ void test2(double x, double y)
if (hypot (pure(x), -pure(x)) != fabs(pure(x)) * __builtin_sqrt(2))
link_error ();
+
+ if (hypot (tan(-x), tan(-fabs(y))) != hypot (tan(x), tan(y)))
+ link_error ();
}
void test1f(float x)
@@ -110,6 +137,15 @@ void test1f(float x)
if (cosf(x) != cosf(-x))
link_error ();
+ if (cosf(x) != cosf(fabsf(x)))
+ link_error ();
+
+ if (cosf(x) != cosf(-fabsf(x)))
+ link_error ();
+
+ if (cosf(tanf(x)) != cosf(tanf(-fabsf(x))))
+ link_error ();
+
#ifdef HAVE_C99_RUNTIME
if (sinf(x)/cosf(x) != tanf(x))
link_error ();
@@ -139,6 +175,21 @@ void test2f(float x, float y)
if (-sinf(x-y) != sinf(y-x))
link_error ();
+ if (cosf(-x*y) != cosf(x*y))
+ link_error ();
+
+ if (cosf(x*-y) != cosf(x*y))
+ link_error ();
+
+ if (cosf(-x/y) != cosf(x/y))
+ link_error ();
+
+ if (cosf(x/-y) != cosf(x/y))
+ link_error ();
+
+ if (cosf(-fabsf(tanf(x/-y))) != cosf(tanf(x/y)))
+ link_error ();
+
if (hypotf (x, 0) != fabsf(x))
link_error ();
@@ -177,6 +228,9 @@ void test2f(float x, float y)
if (hypotf (puref(x), -puref(x)) != fabsf(puref(x)) * __builtin_sqrtf(2))
link_error ();
+
+ if (hypotf (tanf(-x), tanf(-fabsf(y))) != hypotf (tanf(x), tanf(y)))
+ link_error ();
}
@@ -185,6 +239,15 @@ void test1l(long double x)
if (cosl(x) != cosl(-x))
link_error ();
+ if (cosl(x) != cosl(fabsl(x)))
+ link_error ();
+
+ if (cosl(x) != cosl(-fabsl(x)))
+ link_error ();
+
+ if (cosl(tanl(x)) != cosl(tanl(-fabsl(x))))
+ link_error ();
+
#ifdef HAVE_C99_RUNTIME
if (sinl(x)/cosl(x) != tanl(x))
link_error ();
@@ -214,6 +277,21 @@ void test2l(long double x, long double y)
if (-sinl(x-y) != sinl(y-x))
link_error ();
+ if (cosl(-x*y) != cosl(x*y))
+ link_error ();
+
+ if (cosl(x*-y) != cosl(x*y))
+ link_error ();
+
+ if (cosl(-x/y) != cosl(x/y))
+ link_error ();
+
+ if (cosl(x/-y) != cosl(x/y))
+ link_error ();
+
+ if (cosl(-fabsl(tanl(x/-y))) != cosl(tanl(x/y)))
+ link_error ();
+
if (hypotl (x, 0) != fabsl(x))
link_error ();
@@ -252,6 +330,9 @@ void test2l(long double x, long double y)
if (hypotl (purel(x), -purel(x)) != fabsl(purel(x)) * __builtin_sqrtl(2))
link_error ();
+
+ if (hypotl (tanl(-x), tanl(-fabsl(y))) != hypotl (tanl(x), tanl(y)))
+ link_error ();
}
int main()