This is the mail archive of the gcc-patches@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]

Re: PATCH: Remove SLOW_BYTE_ACCESS from get_best_mode


On Thu, Sep 14, 2006 at 12:20:31AM +0100, Paul Brook wrote:
> > Here is the updated patch. I ran a micro benchmark with code difference
> > similar to twolf:
> >
> > -       movl    (%rdi), %eax
> > -       xorb    %ah, %ah
> > -       subl    $1, %eax
> > +       movq    (%rdi), %rax
> > +       andl    $4294902015, %eax
> > +       subq    $1, %rax
> >         jne     .L8
> >
> > There is no speed difference on Nocona. I checked my SPEC results.
> > twolf isn't very stable on my Nocona.
> 
> The former is significantly smaller though (7 bytes vs. 12 bytes).
> 

The code is

#define  ARRAY_LENGTH  16
typedef struct {
    char swYorN;
    short int key;
    short int nkey;
    long bot;
} program;

int
foo (program* prog)
{
  int i;
  for (i = 0 ; i < ARRAY_LENGTH; i++)
    {
      if (prog[i].swYorN == 1 && prog[i].key == 0)
        break;
    }

  return i;
}

get_best_mode is called with

Breakpoint 1, get_best_mode (bitsize=32, bitpos=0, align=64,
    largest_mode=DImode, volatilep=0)
    at /net/gnu-13/export/gnu/src/gcc/gcc/gcc/stor-layout.c:2129

Since it is aligned at 64, DImode is used. I think SImode should be
used here.


H.J.


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