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 c/15431] New: inefficient register allocation


The attached code contains a function that computes 1 line of Conway's game of
life. The function comes in two versions :

- oneline: computes 8 cells (bits) per inner loop

- oneline_32: computes 32 cells (bits) per inner loop

Considering the number of operations, the 32-bit version should be much faster
than the 8-bit version. On x86's and Sparcs, it is about two times faster.

However, on the Apple-G4 it is much slower. The assemby code shows :

- for oneline: there are no more load/stores than needed,

- for oneline_32: there are load/stores for many variables.

The PPC architecture has 32 registers, and there are 15 variables (+ 5
constants, and a maximum expression depth of 5) used in the inner loop, so there
should be no need to use the stack at all. I don't understand why gcc does this.

Attached files: 

cellbug.i -- the problematic file

test_cellbug.c -- benchmark that shows the problem

Thank you in advance for your help

-- 
           Summary: inefficient register allocation
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: douze at enseeiht dot fr
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: apple-mac os x 10.3-G4
  GCC host triplet: apple-mac os x 10.3-G4
GCC target triplet: apple-mac os x 10.3-G4


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


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