summaryrefslogtreecommitdiffstats
path: root/gcc
diff options
context:
space:
mode:
authorghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>2007-02-06 02:50:39 +0000
committerghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>2007-02-06 02:50:39 +0000
commit6da8bb4f936061ba84ed53f363fd9c3c00a1e04a (patch)
treecee770a0428b5a0aa4b52b29a79ff52ec15c355c /gcc
parent37f26c2d8427efa0b0b36a0ee705f8c15ccb5926 (diff)
downloadppe42-gcc-6da8bb4f936061ba84ed53f363fd9c3c00a1e04a.tar.gz
ppe42-gcc-6da8bb4f936061ba84ed53f363fd9c3c00a1e04a.zip
* fold-const.c (negate_expr_p): Handle CONJ_EXPR.
(fold_negate_expr): Likewise. testsuite: * gcc.dg/builtins-20.c: Add more cases. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@121639 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/fold-const.c9
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/builtins-20.c36
4 files changed, 54 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 01aa9dc59c1..947df6f73c3 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2007-02-05 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * fold-const.c (negate_expr_p): Handle CONJ_EXPR.
+ (fold_negate_expr): Likewise.
+
2007-02-05 Alexandre Oliva <aoliva@redhat.com>
PR debug/30189
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index c147efafb68..0b37a0f9437 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -1015,6 +1015,9 @@ negate_expr_p (tree t)
return negate_expr_p (TREE_OPERAND (t, 0))
&& negate_expr_p (TREE_OPERAND (t, 1));
+ case CONJ_EXPR:
+ return negate_expr_p (TREE_OPERAND (t, 0));
+
case PLUS_EXPR:
if (HONOR_SIGN_DEPENDENT_ROUNDING (TYPE_MODE (type))
|| HONOR_SIGNED_ZEROS (TYPE_MODE (type)))
@@ -1145,6 +1148,12 @@ fold_negate_expr (tree t)
fold_negate_expr (TREE_OPERAND (t, 1)));
break;
+ case CONJ_EXPR:
+ if (negate_expr_p (t))
+ return fold_build1 (CONJ_EXPR, type,
+ fold_negate_expr (TREE_OPERAND (t, 0)));
+ break;
+
case NEGATE_EXPR:
return TREE_OPERAND (t, 0);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index abfefcc631f..f22064aaf6e 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2007-02-05 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * gcc.dg/builtins-20.c: Add more cases.
+
2007-02-05 Alexandre Oliva <aoliva@redhat.com>
PR debug/30189
diff --git a/gcc/testsuite/gcc.dg/builtins-20.c b/gcc/testsuite/gcc.dg/builtins-20.c
index 3f36ae4fa7e..7088075511c 100644
--- a/gcc/testsuite/gcc.dg/builtins-20.c
+++ b/gcc/testsuite/gcc.dg/builtins-20.c
@@ -260,6 +260,18 @@ void test3(__complex__ double x, __complex__ double y, int i)
if (ccos(i ? x : ctan(y/x)) != ccos(i ? -x : -ctan(-y/x)))
link_error();
+
+ if (~x != -~-x)
+ link_error();
+
+ if (ccos(~x) != ccos(-~-x))
+ link_error();
+
+ if (ctan(~(x-y)) != -ctan(~(y-x)))
+ link_error();
+
+ if (ctan(~(x/y)) != -ctan(~(x/-y)))
+ link_error();
}
void test1f(float x)
@@ -467,6 +479,18 @@ void test3f(__complex__ float x, __complex__ float y, int i)
if (ccosf(i ? x : ctanf(y/x)) != ccosf(i ? -x : -ctanf(-y/x)))
link_error();
+
+ if (~x != -~-x)
+ link_error();
+
+ if (ccosf(~x) != ccosf(-~-x))
+ link_error();
+
+ if (ctanf(~(x-y)) != -ctanf(~(y-x)))
+ link_error();
+
+ if (ctanf(~(x/y)) != -ctanf(~(x/-y)))
+ link_error();
}
void test1l(long double x)
@@ -674,6 +698,18 @@ void test3l(__complex__ long double x, __complex__ long double y, int i)
if (ccosl(i ? x : ctanl(y/x)) != ccosl(i ? -x : -ctanl(-y/x)))
link_error();
+
+ if (~x != -~-x)
+ link_error();
+
+ if (ccosl(~x) != ccosl(-~-x))
+ link_error();
+
+ if (ctanl(~(x-y)) != -ctanl(~(y-x)))
+ link_error();
+
+ if (ctanl(~(x/y)) != -ctanl(~(x/-y)))
+ link_error();
}
int main()
OpenPOWER on IntegriCloud