public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/14473] New: Failure to use count register
@ 2004-03-08  2:13 anton at samba dot org
  2004-03-08  2:21 ` [Bug optimization/14473] " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: anton at samba dot org @ 2004-03-08  2:13 UTC (permalink / raw)
  To: gcc-bugs

I found this in ppc32 3.3.3 (Debian), it also appears in 3.4.0 20040215.

If the loop count is large enough, it wont use the count register in the second
loop. eg:

#if 1
#define LOOPS 100000
#else
#define LOOPS 10
#endif
                                                                                
int main()
{
        unsigned long i;
                                                                                
        i = LOOPS;
        while (i--) {
                asm volatile("":::"memory");
        }
                                                                                
        i = LOOPS;
        while (i--) {
                asm volatile("":::"memory");
        }
}

produces the following code:

        lis 0,0x1
        ori 0,0,34464
        mtctr 0
.L13:
        bdnz .L13
        lis 0,0x1
        ori 0,0,34464
.L12:
        addic. 0,0,-1
        bne+ 0,.L12
        blr

If you reduce COUNT it will use the count register for both loops as expected

-- 
           Summary: Failure to use count register
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: anton at samba dot org
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: powerpc-unknown-linux-gnu


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


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

* [Bug optimization/14473] Failure to use count register
  2004-03-08  2:13 [Bug c/14473] New: Failure to use count register anton at samba dot org
@ 2004-03-08  2:21 ` pinskia at gcc dot gnu dot org
  2004-03-08  5:52 ` amodra at bigpond dot net dot au
  2004-06-04  5:52 ` [Bug rtl-optimization/14473] " pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-08  2:21 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-03-08 02:21 -------
I can confirm this on the mainline and the tree-ssa, I have not looked to see if the doloop rewrite fixes 
it as I do not have the lno branch on the computer which I have access to right now.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|c                           |optimization
     Ever Confirmed|                            |1
           Keywords|                            |pessimizes-code
      Known to fail|                            |3.4.0 3.3.3 3.5.0 tree-ssa
   Last reconfirmed|0000-00-00 00:00:00         |2004-03-08 02:21:31
               date|                            |


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


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

* [Bug optimization/14473] Failure to use count register
  2004-03-08  2:13 [Bug c/14473] New: Failure to use count register anton at samba dot org
  2004-03-08  2:21 ` [Bug optimization/14473] " pinskia at gcc dot gnu dot org
@ 2004-03-08  5:52 ` amodra at bigpond dot net dot au
  2004-06-04  5:52 ` [Bug rtl-optimization/14473] " pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: amodra at bigpond dot net dot au @ 2004-03-08  5:52 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From amodra at bigpond dot net dot au  2004-03-08 05:52 -------
I thought this looked familiar.  There's an old patch of mine at
http://gcc.gnu.org/ml/gcc-patches/2002-09/msg01194.html


-- 


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


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

* [Bug rtl-optimization/14473] Failure to use count register
  2004-03-08  2:13 [Bug c/14473] New: Failure to use count register anton at samba dot org
  2004-03-08  2:21 ` [Bug optimization/14473] " pinskia at gcc dot gnu dot org
  2004-03-08  5:52 ` amodra at bigpond dot net dot au
@ 2004-06-04  5:52 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-04  5:52 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-06-04 05:52 -------
Fixed on the mainline, most likely by the rewrite of doloop optimization.

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


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


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

end of thread, other threads:[~2004-06-04  5:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-08  2:13 [Bug c/14473] New: Failure to use count register anton at samba dot org
2004-03-08  2:21 ` [Bug optimization/14473] " pinskia at gcc dot gnu dot org
2004-03-08  5:52 ` amodra at bigpond dot net dot au
2004-06-04  5:52 ` [Bug rtl-optimization/14473] " 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).