This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug optimization/8681] Generates unneeded test


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-03-03 16:50 -------
This is semi fixed on the tree-ssa:

sum (p)
{
  int result;
  int i;

<bb 0>:
  result = 0;
  i = 0;
  goto <bb 4> (<L5>);

<L0>:;
  if (i < 0) goto <L1>; else goto <L2>;

<L1>:;
  result = 0;

<L2>:;

<L5>:;
  result = *((int *)((unsigned int)i * 4) + p) + result;
  i = i + 1;
  if (i <= 9999) goto <L0>; else goto <L4>;

<L4>:;
  return result;

}

There is still a comparision but no longer in the asm (meaning that the RTL optimizers 
optimize it away):
_sum:
        li r0,10001
        mr r11,r3
        li r9,0
        li r3,0
        mtctr r0
        slwi r5,r9,2
        lwzx r2,r5,r11
        addi r9,r9,1
        nor r4,r9,r9
        srawi r0,r4,31
        add r3,r3,r2
        bdz L12
L8:
        slwi r5,r9,2
        addi r9,r9,1
        lwzx r2,r5,r11
        and r3,r3,r0
        nor r4,r9,r9
        srawi r0,r4,31
        add r3,r3,r2
        bdnz L8
L12:
        blr

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2003-12-26 03:34:20         |2004-03-03 16:50:28
               date|                            |
   Target Milestone|---                         |tree-ssa


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]