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]

Re: c/859: sparc-specific pessimal code for simple loop


In article <20001121230119.A19367@redhat.com> you write:
>This is a STRICT_ALIGNMENT machine, therefore DFmode and DImode
>operands must be 8-byte aligned, thus the EXTRA_CONSTRAINT check
>ought to be redundant, no?

No.  The old 32-bit ABI only guarantees a max of 4-byte alignment.  GCC
will always give you 8 byte alignment for DFmode/DImode values, but if you
are linking with code compiled by some other compiler, then you may get
passed in pointers to 4-byte aligned values.

Here is an example.  If I compile this with cc on a SunOS4 machine, then I
hit the abort because I have a 4-byte aligned pointer to DFmode data.
I do not hit the abort if I compile with gcc, because gcc aligns the data
before taking its address.

void
sub2 (dptr)
     double *dptr;
{
  if ((long)dptr & 0x7)
    abort ();
}

void
sub1 (a, b, c, d, e, f, g)
     int a, b, c, d, e, f;
     double g;
{
  sub2 (&g);
}

int
main()
{
  sub1 (0, 1, 2, 3, 4, 5, 7.0);
}

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