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: [Fwd: [RFA, trunk] Complex OP Real - 3rd edition.]


I wrote:

> On Monday, I suggested the following patch.  In the mean time I proved
> that this patch doesn't lead to regressions in either the C, C++, Java,
> ObjC or Fortran test suites.  Tested on i686-pc-linux-gnu.
> 
> OK to apply to trunk ?

Well, no - it's a bunch of cr*p and shouldn't have appeared on this list
in the first place.  One wonders why it even passed the testsuite or
(God forbid) running LAPACK with it.

The reason I started this patch was because I wanted to get code
generation eliminate the if..then..else construct from optabs.c
(expand_cmplxdiv_wide).  What this routine does is essentially the
following:

	/* Divide (a+bi) by (c+di) giving (a+b(d/c))/(c+d(d/c) + 
           i(b-a(d/c))/(c+d(d/c)) if |c| >= |d| */
	Compare |c| and |d|
	if |c| >= |d|
		generate above sequence
	else /* |c| < |d|
		generate sequence with c/d

Now, obviously, in the above, if d = 0, |c| >= |d| by definition, and
the first part of the generated code fires.  However, if d is a constant
zero (perhaps because c+di actually is a real), the comparison can be
deleted wholesome and the one firing branch being the only code left.

This almost happens with the current optabs.c; compile the following
with -O2 -S vs. -O2 -ffast-math -S to see the difference:

        double complex function z2(z1, x)
        double precision x
        double complex z1
        z2 = z1/x
        end

Hope someone can explain why we can't get rid of the conditional code.

Thanks,

-- 
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
Join GNU Fortran 95: http://g95.sourceforge.net/ (under construction)


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