[Bug middle-end/31249] pseudo-optimzation with sincos/cexpi

2007-03-18 Thread pinskia at gcc dot gnu dot org
--- Comment #1 from pinskia at gcc dot gnu dot org 2007-03-18 09:49 --- The only reason why cexp is slow on PPC darwin is because the ABI is stupid. Complex float arguments are passed via the GPR and returned also the same way instead of via the FPRs. So you will get a transfer of regi

[Bug middle-end/31249] pseudo-optimzation with sincos/cexpi

2007-03-18 Thread dominiq at lps dot ens dot fr
--- Comment #2 from dominiq at lps dot ens dot fr 2007-03-18 10:20 --- Andrew, Thanks for the answer. Additional timings for AMD Opteron(tm) Processor 250, 2.4Ghz: Target: x86_64-unknown-linux-gnu ... gcc version 4.3.0 20061231 (experimental) [tocata] test/fortran> gfc -O3 sincos.f90

[Bug middle-end/31249] pseudo-optimzation with sincos/cexpi

2007-03-19 Thread dominiq at lps dot ens dot fr
--- Comment #3 from dominiq at lps dot ens dot fr 2007-03-19 09:28 --- BTW, did I miss an option to turn this optimization off? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31249

[Bug middle-end/31249] pseudo-optimzation with sincos/cexpi

2007-03-19 Thread rguenth at gcc dot gnu dot org
--- Comment #4 from rguenth at gcc dot gnu dot org 2007-03-19 10:43 --- There is no option to turn it off. But for !TARGET_C99_FUNCTIONS and !TARGET_HAS_SINCOS targets it's off. Usually (in fact, for every libm I looked into), cexp is implemented as complex double cexp (complex double

[Bug middle-end/31249] pseudo-optimzation with sincos/cexpi

2007-03-19 Thread dominiq at lps dot ens dot fr
--- Comment #5 from dominiq at lps dot ens dot fr 2007-03-19 12:43 --- > There is no option to turn it off. But for !TARGET_C99_FUNCTIONS and > !TARGET_HAS_SINCOS targets it's off. >From my understanding of the thread http://gcc.gnu.org/ml/gcc/2007-03/msg00639.html if !TARGET_64BIT

[Bug middle-end/31249] pseudo-optimzation with sincos/cexpi

2007-03-19 Thread pinskia at gmail dot com
--- Comment #6 from pinskia at gmail dot com 2007-03-19 17:52 --- Subject: Re: pseudo-optimzation with sincos/cexpi On 19 Mar 2007 12:43:49 -, dominiq at lps dot ens dot fr <[EMAIL PROTECTED]> wrote: > > Since sin() and cos() are non trivial functions, I am very surprised > that a

[Bug middle-end/31249] pseudo-optimzation with sincos/cexpi

2007-03-20 Thread rguenth at gcc dot gnu dot org
--- Comment #7 from rguenth at gcc dot gnu dot org 2007-03-20 11:04 --- I agree it's surprising to get user-visible effects with the TARGET_C99_FUNCTIONS difference between the frontends, but they are (supposed to) providing C99 runtime completion by their runtime libraries. And they re

[Bug middle-end/31249] pseudo-optimzation with sincos/cexpi

2007-03-20 Thread dominiq at lps dot ens dot fr
--- Comment #8 from dominiq at lps dot ens dot fr 2007-03-20 13:57 --- > The only reason why cexp is slow on PPC darwin is because the ABI is stupid. > Complex float arguments are passed via the GPR and returned also the same way > instead of via the FPRs. So you will get a transfer of

[Bug middle-end/31249] pseudo-optimzation with sincos/cexpi

2007-03-20 Thread dominiq at lps dot ens dot fr
--- Comment #9 from dominiq at lps dot ens dot fr 2007-03-20 14:03 --- > I agree it's surprising to get user-visible effects with the > TARGET_C99_FUNCTIONS difference between the frontends, > but they are (supposed to) providing C99 runtime completion > by their runtime libraries. An

[Bug middle-end/31249] pseudo-optimzation with sincos/cexpi

2007-03-20 Thread rguenth at gcc dot gnu dot org
--- Comment #10 from rguenth at gcc dot gnu dot org 2007-03-20 14:26 --- That sin+cos is practically sincos (so you get one for free). Just not every library exports that sincos. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31249

[Bug middle-end/31249] pseudo-optimzation with sincos/cexpi

2007-03-20 Thread dominiq at lps dot ens dot fr
--- Comment #11 from dominiq at lps dot ens dot fr 2007-03-20 14:57 --- Subject: Re: pseudo-optimzation with sincos/cexpi > That sin+cos is practically sincos (so you get one for free). Just not every > library exports that sincos. Does not this assume that it exists a real sincos(x)

[Bug middle-end/31249] pseudo-optimzation with sincos/cexpi

2007-03-20 Thread rguenth at gcc dot gnu dot org
--- Comment #12 from rguenth at gcc dot gnu dot org 2007-03-20 15:06 --- Depends on how you name it ;) You can propose that we only enable sincos transformation if TARGET_HAS_SINCOS is set, I wouldn't necessarily object to that. (The targets I care for have a sincos) -- http://gcc

[Bug middle-end/31249] pseudo-optimzation with sincos/cexpi

2007-03-20 Thread dominiq at lps dot ens dot fr
--- Comment #13 from dominiq at lps dot ens dot fr 2007-03-20 16:08 --- > You can propose that we only enable sincos transformation > if TARGET_HAS_SINCOS is set, I wouldn't necessarily object to > that. (The targets I care for have a sincos) Sound reasonable: replacing: return (TAR

[Bug middle-end/31249] pseudo-optimzation with sincos/cexpi

2007-03-20 Thread rguenth at gcc dot gnu dot org
--- Comment #14 from rguenth at gcc dot gnu dot org 2007-03-20 16:12 --- The recommended way is to post a message to gcc@gcc.gnu.org or [EMAIL PROTECTED] -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31249

[Bug middle-end/31249] pseudo-optimzation with sincos/cexpi

2007-03-20 Thread pinskia at gcc dot gnu dot org
--- Comment #15 from pinskia at gcc dot gnu dot org 2007-03-20 16:14 --- > Is this also true for complex double on 32 bit architectures (i.e., 4 GPRs) > or do you mean the GPR is used to pass a pointer? 4 GPRS Yes this was a stupid decission on Apple's part for not looking at fixing G

[Bug middle-end/31249] pseudo-optimzation with sincos/cexpi

2007-03-21 Thread dominiq at lps dot ens dot fr
--- Comment #16 from dominiq at lps dot ens dot fr 2007-03-21 15:36 --- > The recommended way is to post a message to gcc@gcc.gnu.org or > [EMAIL PROTECTED] I'll follow your advice, but before I'ld like some feedback about what follows. I have applied the following patch --- gcc-4.3-2

[Bug middle-end/31249] pseudo-optimzation with sincos/cexpi

2007-03-21 Thread rguenth at gcc dot gnu dot org
--- Comment #17 from rguenth at gcc dot gnu dot org 2007-03-21 15:57 --- It would be nice to know whether darwin does not implement cexp in an optimal way (special casing zero real part and dispatching to a sincos equivalent for the imaginary part) or if the issue is only a bad ABI for

[Bug middle-end/31249] pseudo-optimzation with sincos/cexpi

2007-03-21 Thread dominiq at lps dot ens dot fr
--- Comment #18 from dominiq at lps dot ens dot fr 2007-03-21 16:09 --- > It would be nice to know whether darwin does not implement cexp in an optimal > way ... I have forgotten to mention that I did some (quick) profiling: cexp seens trivially implemented. It calls sin, cos and exp +

Re: [Bug middle-end/31249] pseudo-optimzation with sincos/cexpi

2007-03-19 Thread Andrew Pinski
On 19 Mar 2007 12:43:49 -, dominiq at lps dot ens dot fr <[EMAIL PROTECTED]> wrote: Since sin() and cos() are non trivial functions, I am very surprised that a wrong API makes a 50% difference. Well Here is how it can make a 50% difference (at least on the Cell, the 970 has less of a restr