This is the mail archive of the gcc@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: x86 double alignment (was egcs-1.1 release schedule)


On Thu, Jun 25, 1998 at 12:15:17PM -0400, Craig Burley wrote:
> >The original patch turned on -mstack-align-double, which I thought is safe,
> >but it isn't. I got a report from a windows user that it breaks most windows
> >function semantics, as these functions deallocate the stack themselves. In
> >this case, -mstack-align-double will break the program.
> 
> Wait, how can these functions deallocate the stack themselves when
> the *caller* also is deallocating the stack, as is normally the

it isn't: __attribute__((stdcall)).

> case for x86-ABI code?  Aren't these functions essentially violating
> the ABI in a way the compiler producing code that calls them *must*
> know about?

the problem is we can't change the windows kernel. its a third-party
product I'd really like to recompile ;)

> >- document that -mno-stack-align-double should be used when linking against third-party-libs
> >- not making it on by default.
> 
> If it's not on by default, it's of only limited benefit, though that'd
> still take care of lots of Fortran users who are willing to learn about
> and use an option like -mstack-align-double.

I had this on by default for half a year in pgcc (until I was told about
windows having problems). It isn't beneficial for integer programs, and
there are a great many of them around. I'm not happy with the idea
of punishing a whole class of functions.

If all third-party libraries (e.g. libc) were compiled with this switch (we
only need to have this on for functions using callbacks), we could leave the
choice up to the individual program.

> My feeling is that if -mstack-align-double doesn't break the ABI, then
> make it the default.  Any bugs resulting from this are thus likely to be
> because *other* code breaks the ABI.  Our compiler should be "told" about
> those codes explicitly anyway, via attributes or something.

these codes are already available, and already used (in windows, at least,
which means nothing too important to me, since code for that platform won't
be distrivuted in binary to other systems I believe).

The problem is mostly speed loss.

> But, the problem is that if we don't make -mstack-align-double the
> default, lots of code that uses `double' will not get proper
> alignment and will continue have *big* performance degradation.

Educate your users. I thought that way for a great long time, maybe I'm
used to tweaking switches, but thats _already_ the case with loop unrolling
or "-O3 vs. -O2". Why isn't loop unrolling on by default? Why Do most
programs use -O2 when -O3 is faster?

      -----==-                                              |
      ----==-- _                                            |
      ---==---(_)__  __ ____  __       Marc Lehmann       +--
      --==---/ / _ \/ // /\ \/ /       pcg@goof.com       |e|
      -=====/_/_//_/\_,_/ /_/\_\                          --+
    The choice of a GNU generation                        |
                                                          |


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