public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/32684]  New: Missed tail call with sin/cos and sincos pass
@ 2007-07-09  3:21 pinskia at gcc dot gnu dot org
  2007-07-09  9:34 ` [Bug tree-optimization/32684] " rguenth at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-07-09  3:21 UTC (permalink / raw)
  To: gcc-bugs

Testcase:
double _Complex quantum_cexp(double phi)
{
  return __builtin_cos(phi) + 1i * __builtin_sin(phi);
}

----- Cut ----
This shows up in libquantum (but after fixing a different issue which I will
file seperately).


-- 
           Summary: Missed tail call with sin/cos and sincos pass
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 8+ 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: Missed tail call with sin/cos and sincos pass 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; 8+ 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] 8+ 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: Missed tail call with sin/cos and sincos pass 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; 8+ 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] 8+ 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: Missed tail call with sin/cos and sincos pass 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; 8+ 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] 8+ 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: Missed tail call with sin/cos and sincos pass 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; 8+ 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] 8+ 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: Missed tail call with sin/cos and sincos pass 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; 8+ 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] 8+ 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: Missed tail call with sin/cos and sincos pass 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; 8+ 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] 8+ 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: Missed tail call with sin/cos and sincos pass 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; 8+ 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] 8+ messages in thread

end of thread, other threads:[~2007-10-09 17:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-09  3:21 [Bug tree-optimization/32684] New: Missed tail call with sin/cos and sincos pass 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).