This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH]: Handle CONJ_EXPR in negate_expr_p and fold_negate_expr


On Mon, 5 Feb 2007, Kaveh R. GHAZI wrote:

> Right.  I just tried Paolo's testcase, (a,b) + -~(5,x) using GCC built
> before my CONJ patch.  It already folds this to (a,b) + (-5,x) exactly
> because of the fold_unary code quoted by Richard above which always
> changes the conj into a negate of the imaginary part.  This makes both
> parts of the COMPLEX_EXPR "negatable" and thus the outer negate gets
> folded as well.

And to ensure it keeps working, I've checked in the following cases.
Tested via "make check" on mainline and installed as obvious.

		--Kaveh



2007-02-07  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* gcc.dg/builtins-20.c: Add some -~ complex cases.

diff -rup orig/egcc-SVN20070206/gcc/testsuite/gcc.dg/builtins-20.c egcc-SVN20070206/gcc/testsuite/gcc.dg/builtins-20.c
--- orig/egcc-SVN20070206/gcc/testsuite/gcc.dg/builtins-20.c	2007-02-05 22:37:49.000000000 -0500
+++ egcc-SVN20070206/gcc/testsuite/gcc.dg/builtins-20.c	2007-02-07 21:57:40.034542825 -0500
@@ -215,6 +215,12 @@ void test2(double x, double y)

   if (ccos(tan(x)+sin(x-y)*1i) != ccos(-tan(-x)-sin(y-x)*1i))
     link_error ();
+
+  if (-5+x*1i != -~(5+x*1i))
+    link_error ();
+
+  if (tan(x)+tan(y)*1i != -~(tan(-x)+tan(y)*1i))
+    link_error ();
 }

 void test3(__complex__ double x, __complex__ double y, int i)
@@ -434,6 +440,12 @@ void test2f(float x, float y)

   if (ccosf(tanf(x)+sinf(x-y)*1i) != ccosf(-tanf(-x)-sinf(y-x)*1i))
     link_error ();
+
+  if (-5+x*1i != -~(5+x*1i))
+    link_error ();
+
+  if (tanf(x)+tanf(y)*1i != -~(tanf(-x)+tanf(y)*1i))
+    link_error ();
 }

 void test3f(__complex__ float x, __complex__ float y, int i)
@@ -653,6 +665,12 @@ void test2l(long double x, long double y

   if (ccosl(tanl(x)+sinl(x-y)*1i) != ccosl(-tanl(-x)-sinl(y-x)*1i))
     link_error ();
+
+  if (-5+x*1i != -~(5+x*1i))
+    link_error ();
+
+  if (tanl(x)+tanl(y)*1i != -~(tanl(-x)+tanl(y)*1i))
+    link_error ();
 }

 void test3l(__complex__ long double x, __complex__ long double y, int i)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]