aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/builtins-20.c
diff options
context:
space:
mode:
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>2007-02-02 17:09:55 +0000
committerKaveh Ghazi <ghazi@gcc.gnu.org>2007-02-02 17:09:55 +0000
commit1aeef526793e63252dd428d926809378d5f46795 (patch)
tree121f473987a109b31958eb1bdf6d5fa7f38c2121 /gcc/testsuite/gcc.dg/builtins-20.c
parentf6ec1d11632ab0a33dacb5043ac4819d5a91759e (diff)
downloadgcc-1aeef526793e63252dd428d926809378d5f46795.zip
gcc-1aeef526793e63252dd428d926809378d5f46795.tar.gz
gcc-1aeef526793e63252dd428d926809378d5f46795.tar.bz2
fold-const.c (negate_expr_p, [...]): Handle COMPLEX_EXPR.
* fold-const.c (negate_expr_p, fold_negate_expr): Handle COMPLEX_EXPR. testsuite: * gcc.dg/builtins-20.c: Add more cases. From-SVN: r121511
Diffstat (limited to 'gcc/testsuite/gcc.dg/builtins-20.c')
-rw-r--r--gcc/testsuite/gcc.dg/builtins-20.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/builtins-20.c b/gcc/testsuite/gcc.dg/builtins-20.c
index 3c8ac76..3f36ae4 100644
--- a/gcc/testsuite/gcc.dg/builtins-20.c
+++ b/gcc/testsuite/gcc.dg/builtins-20.c
@@ -197,6 +197,24 @@ void test2(double x, double y)
if (fmax (x,fmin(y,x)) != x)
link_error ();
+
+ if ((__complex__ double) x != -(__complex__ double) (-x))
+ link_error ();
+
+ if (x*1i != -(-x*1i))
+ link_error ();
+
+ if (x+(x-y)*1i != -(-x+(y-x)*1i))
+ link_error ();
+
+ if (x+(x-y)*1i != -(-x-(x-y)*1i))
+ link_error ();
+
+ if (ccos(tan(x)+sin(y)*1i) != ccos(-tan(-x)+-sin(-y)*1i))
+ link_error ();
+
+ if (ccos(tan(x)+sin(x-y)*1i) != ccos(-tan(-x)-sin(y-x)*1i))
+ link_error ();
}
void test3(__complex__ double x, __complex__ double y, int i)
@@ -389,6 +407,21 @@ void test2f(float x, float y)
if (fmaxf (x,fminf(y,x)) != x)
link_error ();
+
+ if ((__complex__ float) x != -(__complex__ float) (-x))
+ link_error ();
+
+ if (x+(x-y)*1i != -(-x+(y-x)*1i))
+ link_error ();
+
+ if (x+(x-y)*1i != -(-x-(x-y)*1i))
+ link_error ();
+
+ if (ccosf(tanf(x)+sinf(y)*1i) != ccosf(-tanf(-x)+-sinf(-y)*1i))
+ link_error ();
+
+ if (ccosf(tanf(x)+sinf(x-y)*1i) != ccosf(-tanf(-x)-sinf(y-x)*1i))
+ link_error ();
}
void test3f(__complex__ float x, __complex__ float y, int i)
@@ -581,6 +614,21 @@ void test2l(long double x, long double y)
if (fmaxl (x,fminl(y,x)) != x)
link_error ();
+
+ if ((__complex__ long double) x != -(__complex__ long double) (-x))
+ link_error ();
+
+ if (x+(x-y)*1i != -(-x+(y-x)*1i))
+ link_error ();
+
+ if (x+(x-y)*1i != -(-x-(x-y)*1i))
+ link_error ();
+
+ if (ccosl(tanl(x)+sinl(y)*1i) != ccosl(-tanl(-x)+-sinl(-y)*1i))
+ link_error ();
+
+ if (ccosl(tanl(x)+sinl(x-y)*1i) != ccosl(-tanl(-x)-sinl(y-x)*1i))
+ link_error ();
}
void test3l(__complex__ long double x, __complex__ long double y, int i)