This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug optimization/11601] New: if-conversion2 gets rid of branch and return when used with builtins
- From: "pinskia at physics dot uc dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 20 Jul 2003 12:07:19 -0000
- Subject: [Bug optimization/11601] New: if-conversion2 gets rid of branch and return when used with builtins
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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