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

* [Bug optimization/11601] if-conversion2 gets rid of branch and return when used with builtins
  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 ` falk at debian dot org
  2003-08-03 16:43 ` pinskia at physics dot uc dot edu
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: falk at debian dot org @ 2003-08-03 12:49 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



------- Additional Comments From falk at debian dot org  2003-08-03 12:49 -------
I cannot reproduce this on Alpha with __builtin_prefetch or __builtin_rpcc, so it
is probably target specific.


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

* [Bug optimization/11601] if-conversion2 gets rid of branch and return when used with builtins
  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
  3 siblings, 0 replies; 9+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-08-03 16:43 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



------- Additional Comments From pinskia at physics dot uc dot edu  2003-08-03 16:43 -------
The reason why it is target spefic is because PPC has condition branch return.
The RTL that is removed is
(jump_insn 11 10 20 0 (set (pc)
        (if_then_else (eq (reg:CC 120)
                (const_int 0 [0x0]))
            (label_ref 18)
            (pc))) 494 {*rs6000.md:13671} (insn_list 10 (nil))
    (expr_list:REG_DEAD (reg:CC 120)
        (expr_list:REG_BR_PROB (const_int 5000 [0x1388])
            (nil))))


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

* [Bug optimization/11601] if-conversion2 gets rid of branch and return when used with builtins
  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
  3 siblings, 0 replies; 9+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-08-05 18:57 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


pinskia at physics dot uc dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2003-08-05 18:57:35
               date|                            |


------- Additional Comments From pinskia at physics dot uc dot edu  2003-08-05 18:57 -------
I copied the wrong rtl, the correct one is:
(jump_insn 11 10 20 0 (set (pc)
        (if_then_else (eq (reg:CC 75 cr7 [120])
                (const_int 0 [0x0]))
            (return)
            (pc))) 495 {*rs6000.md:13686} (insn_list 10 (nil))
    (expr_list:REG_DEAD (reg:CC 75 cr7 [120])
        (expr_list:REG_BR_PROB (const_int 5000 [0x1388])
            (nil))))

See the return some how if-conversion likes to remove this jump instruction.


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

* [Bug optimization/11601] if-conversion2 gets rid of branch and return when used with builtins
  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
                   ` (2 preceding siblings ...)
  2003-08-05 18:57 ` pinskia at physics dot uc dot edu
@ 2003-08-06  0:49 ` pinskia at physics dot uc dot edu
  3 siblings, 0 replies; 9+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-08-06  0:49 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


pinskia at physics dot uc dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |normal


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

* [Bug optimization/11601] if-conversion2 gets rid of branch and return when used with builtins
       [not found] <20030720120718.11601.pinskia@gcc.gnu.org>
                   ` (2 preceding siblings ...)
  2003-10-20 13:54 ` falk at debian dot org
@ 2003-10-20 14:13 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-10-20 14:13 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


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |3.4


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-10-20 13:54 -------
Closing as the dst is fixed which should help the 970 and the dcbst case is fine to able to execute 
and does not need to be fixed.


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

* [Bug optimization/11601] if-conversion2 gets rid of branch and return when used with builtins
       [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
  3 siblings, 0 replies; 9+ messages in thread
From: falk at debian dot org @ 2003-10-20 13:54 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



------- Additional Comments From falk at debian dot org  2003-10-20 13:25 -------
Since a prefetch has no side effect, it is acceptable to execute it 
unconditionally. So IMHO we should close this bug. I cannot reproduce it on
Alpha, BTW.


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

* [Bug optimization/11601] if-conversion2 gets rid of branch and return when used with builtins
       [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
  3 siblings, 0 replies; 9+ messages in thread
From: segher at kernel dot crashing dot org @ 2003-10-20 13:15 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



------- Additional Comments From segher at kernel dot crashing dot org  2003-10-20 13:15 -------
We now have

t:
        cmpwi 7,4,0
        beqlr- 7
        li 0,0
        dst 3,0,0
        blr

but the `prefetch' case is not solved yet.

Changing `prefetch' to take a memory_operand instead
of an address_operand would do the trick, I think.
This needs to be changed in generic code too, then.

This makes me think this also shows on other platforms?


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

* [Bug optimization/11601] if-conversion2 gets rid of branch and return when used with builtins
       [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
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: dhazeghi at yahoo dot com @ 2003-08-22 23:59 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


dhazeghi at yahoo dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.4                         |---


------- Additional Comments From dhazeghi at yahoo dot com  2003-08-22 23:59 -------
Not a regression.


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

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).