public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/32684] Missed tail call with sin/cos and sincos pass
       [not found] <bug-32684-4@http.gcc.gnu.org/bugzilla/>
@ 2011-01-14 13:34 ` rguenth at gcc dot gnu.org
  2011-01-14 13:35 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-01-14 13:34 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32684

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |46926

--- Comment #8 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-01-14 13:32:51 UTC ---
See also PR46926.  The flags controlling whether we can emit a call to
sincos need some work (but it's not exactly clear how it should work).


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug tree-optimization/32684] Missed tail call with sin/cos and sincos pass
       [not found] <bug-32684-4@http.gcc.gnu.org/bugzilla/>
  2011-01-14 13:34 ` [Bug tree-optimization/32684] Missed tail call with sin/cos and sincos pass rguenth at gcc dot gnu.org
@ 2011-01-14 13:35 ` rguenth at gcc dot gnu.org
  2011-01-14 14:08 ` rguenth at gcc dot gnu.org
  2014-12-01  5:18 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-01-14 13:35 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32684

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|46926                       |

--- Comment #9 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-01-14 13:33:52 UTC ---
(In reply to comment #8)
> See also PR46926.  The flags controlling whether we can emit a call to
> sincos need some work (but it's not exactly clear how it should work).

Err - wrong bug.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug tree-optimization/32684] Missed tail call with sin/cos and sincos pass
       [not found] <bug-32684-4@http.gcc.gnu.org/bugzilla/>
  2011-01-14 13:34 ` [Bug tree-optimization/32684] Missed tail call with sin/cos and sincos pass rguenth at gcc dot gnu.org
  2011-01-14 13:35 ` rguenth at gcc dot gnu.org
@ 2011-01-14 14:08 ` rguenth at gcc dot gnu.org
  2014-12-01  5:18 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-01-14 14:08 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32684

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |rguenth at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #10 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-01-14 13:51:31 UTC ---
Looking here again I can't see what tailcall you would expect.  Mainline
generates

complex double
quantum_cexp (double phi)
{
  complex double sincostmp.1;
  double D.2685;
  double D.2684;
  complex double D.2683;

<bb 2>:
  sincostmp.1_5 = __builtin_cexpi (phi_1(D));
  D.2684_2 = REALPART_EXPR <sincostmp.1_5>;
  D.2685_3 = IMAGPART_EXPR <sincostmp.1_5>;
  D.2683_4 = COMPLEX_EXPR <D.2684_2, D.2685_3>;
  return D.2683_4;

which we indeed do not optimize to just

  return __builtin_cexp1 (phi_1(D));

but in the end sincos doesn't have an ABI that allows for tailcalling
or sibcalling to it.

There is a missing folding of COMPLEX_EXPR <REALPART_EXPR <x>, IMAGPART_EXPR
<x>> to x and SCCVN does not go the full way of combining binary expressions.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug tree-optimization/32684] Missed tail call with sin/cos and sincos pass
       [not found] <bug-32684-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2011-01-14 14:08 ` rguenth at gcc dot gnu.org
@ 2014-12-01  5:18 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-12-01  5:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32684

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #11 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed.  Pre gets rid of the REALPART_EXPR/COMPLEX_EXPR now.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug tree-optimization/32684] Missed tail call with sin/cos and sincos pass
  2007-07-09  3:21 [Bug tree-optimization/32684] New: " pinskia at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2007-10-09 13:15 ` chrbr at gcc dot gnu dot org
@ 2007-10-09 17:59 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-10-09 17:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pinskia at gcc dot gnu dot org  2007-10-09 17:59 -------
I get:
  sincostmp.5 = __builtin_cexpi (phi);
  REALPART_EXPR <<retval>> = REALPART_EXPR <sincostmp.5>;
  IMAGPART_EXPR <<retval>> = IMAGPART_EXPR <sincostmp.5>;
  return <retval>;

Which is created after the sincos pass as:
  sincostmp.5_7 = __builtin_cexpi (phi_1(D));
  D.1522_2 = REALPART_EXPR <sincostmp.5_7>;
  D.1524_4 = IMAGPART_EXPR <sincostmp.5_7>;
  REALPART_EXPR <<retval>> = D.1522_2;
  IMAGPART_EXPR <<retval>> = D.1524_4;

Which we don't recombine the real/img parts into just one assignment.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32684


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug tree-optimization/32684] Missed tail call with sin/cos and sincos pass
  2007-07-09  3:21 [Bug tree-optimization/32684] New: " pinskia at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2007-10-09 13:12 ` chrbr at gcc dot gnu dot org
@ 2007-10-09 13:15 ` chrbr at gcc dot gnu dot org
  2007-10-09 17:59 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 11+ messages in thread
From: chrbr at gcc dot gnu dot org @ 2007-10-09 13:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from chrbr at gcc dot gnu dot org  2007-10-09 13:15 -------
> you are right, it's not a sibcall, my mistake. 

typo, I meant "libcall" not "sibcall"


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32684


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug tree-optimization/32684] Missed tail call with sin/cos and sincos pass
  2007-07-09  3:21 [Bug tree-optimization/32684] New: " pinskia at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2007-10-09 10:34 ` pinskia at gcc dot gnu dot org
@ 2007-10-09 13:12 ` chrbr at gcc dot gnu dot org
  2007-10-09 13:15 ` chrbr at gcc dot gnu dot org
  2007-10-09 17:59 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 11+ messages in thread
From: chrbr at gcc dot gnu dot org @ 2007-10-09 13:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from chrbr at gcc dot gnu dot org  2007-10-09 13:12 -------
you are right, it's not a sibcall, my mistake. 
But even at the tree level I still don't see the builtin marked as tailcall. On
a reduced case when entering find_tail_calls I have

D.1177_2 = __builtin_cos (phi_1(D));
D.1176_3 = COMPLEX_EXPR <D.1177_2, 0.0>;
return D.1176_3;

and this is not recognized as a tailcall a candidate because the
GIMPLE_MODIFY_STMT operand 1 is a complex_expr, not a call.

note that in the absence of complex_expr, such as a builtin_memset. all is fine


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32684


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug tree-optimization/32684] Missed tail call with sin/cos and sincos pass
  2007-07-09  3:21 [Bug tree-optimization/32684] New: " pinskia at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-10-09 10:33 ` pinskia at gcc dot gnu dot org
@ 2007-10-09 10:34 ` pinskia at gcc dot gnu dot org
  2007-10-09 13:12 ` chrbr at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-10-09 10:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2007-10-09 10:34 -------
Which is unlike the other case where we don't have a call at the tree level
that gets marked as tail called.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |NEW


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32684


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug tree-optimization/32684] Missed tail call with sin/cos and sincos pass
  2007-07-09  3:21 [Bug tree-optimization/32684] New: " pinskia at gcc dot gnu dot org
  2007-07-09  9:34 ` [Bug tree-optimization/32684] " rguenth at gcc dot gnu dot org
  2007-10-09  8:36 ` chrbr at gcc dot gnu dot org
@ 2007-10-09 10:33 ` pinskia at gcc dot gnu dot org
  2007-10-09 10:34 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-10-09 10:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2007-10-09 10:33 -------
It is not since this is not a libcall.  At the tree level, we have a __builtin
function which has been marked for tailcall.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|DUPLICATE                   |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32684


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug tree-optimization/32684] Missed tail call with sin/cos and sincos pass
  2007-07-09  3:21 [Bug tree-optimization/32684] New: " pinskia at gcc dot gnu dot org
  2007-07-09  9:34 ` [Bug tree-optimization/32684] " rguenth at gcc dot gnu dot org
@ 2007-10-09  8:36 ` chrbr at gcc dot gnu dot org
  2007-10-09 10:33 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: chrbr at gcc dot gnu dot org @ 2007-10-09  8:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from chrbr at gcc dot gnu dot org  2007-10-09 08:36 -------
I think this is a duplicate of #15473 (Sibcall optimization for libcalls).

*** This bug has been marked as a duplicate of 15473 ***


-- 

chrbr at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32684


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug tree-optimization/32684] Missed tail call with sin/cos and sincos pass
  2007-07-09  3:21 [Bug tree-optimization/32684] New: " pinskia at gcc dot gnu dot org
@ 2007-07-09  9:34 ` rguenth at gcc dot gnu dot org
  2007-10-09  8:36 ` chrbr at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-07-09  9:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2007-07-09 09:34 -------
Confirmed.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-07-09 09:34:08
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32684


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-12-01  5:18 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-32684-4@http.gcc.gnu.org/bugzilla/>
2011-01-14 13:34 ` [Bug tree-optimization/32684] Missed tail call with sin/cos and sincos pass rguenth at gcc dot gnu.org
2011-01-14 13:35 ` rguenth at gcc dot gnu.org
2011-01-14 14:08 ` rguenth at gcc dot gnu.org
2014-12-01  5:18 ` pinskia at gcc dot gnu.org
2007-07-09  3:21 [Bug tree-optimization/32684] New: " pinskia at gcc dot gnu dot org
2007-07-09  9:34 ` [Bug tree-optimization/32684] " rguenth at gcc dot gnu dot org
2007-10-09  8:36 ` chrbr at gcc dot gnu dot org
2007-10-09 10:33 ` pinskia at gcc dot gnu dot org
2007-10-09 10:34 ` pinskia at gcc dot gnu dot org
2007-10-09 13:12 ` chrbr at gcc dot gnu dot org
2007-10-09 13:15 ` chrbr at gcc dot gnu dot org
2007-10-09 17:59 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).