public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/11601] New: if-conversion2 gets rid of branch and return when used with builtins
@ 2003-07-20 12:07 pinskia at physics dot uc dot edu
  2003-08-03 12:49 ` [Bug optimization/11601] " falk at debian dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-07-20 12:07 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: if-conversion2 gets rid of branch and return when used
                    with builtins
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: critical
          Priority: P1
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at physics dot uc dot edu
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: powerpc-*-*

Compile the following code with -O and -maltivec:
void prefetch (void *p, int s)
{
  if (s)
    __builtin_prefetch (p, 1, 1);
}

void t(void *p, int s)
{
  if (s)
    __builtin_altivec_dst (p, 0, 0);
}
resulting asm:
_prefetch:
        dcbtst 0,r3
        blr
_t:
        li r0,0
        dst r3,r0,0
        blr
But compiling:
void g(int *p, int s)
{
  if (s)
    *p=0;
}
results in correct code:
_g:
        cmpwi cr7,r4,0
        beqlr- cr7             <--- branch on equal (cr7eq set) to link reg (aka return).
        li r0,0
        stw r0,0(r3)
        blr


^ permalink raw reply	[flat|nested] 9+ messages in thread
[parent not found: <20030720120718.11601.pinskia@gcc.gnu.org>]

end of thread, other threads:[~2003-10-20 13:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-20 12:07 [Bug optimization/11601] New: if-conversion2 gets rid of branch and return when used with builtins pinskia at physics dot uc dot edu
2003-08-03 12:49 ` [Bug optimization/11601] " falk at debian dot org
2003-08-03 16:43 ` pinskia at physics dot uc dot edu
2003-08-05 18:57 ` pinskia at physics dot uc dot edu
2003-08-06  0:49 ` pinskia at physics dot uc dot edu
     [not found] <20030720120718.11601.pinskia@gcc.gnu.org>
2003-08-22 23:59 ` dhazeghi at yahoo dot com
2003-10-20 13:15 ` segher at kernel dot crashing dot org
2003-10-20 13:54 ` falk at debian dot org
2003-10-20 14:13 ` 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).