[Liboil] alignment problems with sse2

David Schleef ds at schleef.org
Thu Aug 31 15:52:09 PDT 2006


On Fri, Sep 01, 2006 at 12:28:51AM +0200, Matthias Drochner wrote:
> 
> ds at schleef.org said:
> > This is a known problem, see  http://bugs.debian.org/cgi-bin/
> > bugreport.cgi?bug=368991 
> 
> Thanks, this at least gives me an idea what to expect
> from gcc and what not. I don't think it is a good idea
> to expect a stack alignment which is stricter than what
> the official ABI requires. As it appears, this won't change
> anytime soon, so we have to live with it.
> So the wrapper enforcing 16-byte alignment is basically OK
> as I see it. Not nice, but reasonable in that situation.
> 
> > The best solution at this point (not yet implemented) is to fix
> > all the liboil functions to not use local variables for SSE.
> 
> I wouldn't call that a fix but a workaround.
> 
> In the process, I've stumbled over some related facets of the
> problem which, while not of immediate help, you might find
> interesting:

I think the easiest way to bash this bug into submission is to
write a test for the testsuite which tests all the implementations
under adverse stack alignment conditions.  I've already written
the necessary code, just haven't checked it in, nor tested it
on an SSE2 machine.

Yes, not using local SSE2 variables is a workaround.  But a
surprising amount of liboil code involves clever workarounds in
order to get gcc to produce decent code.  Another possibility
is to write some macros that will trick gcc into finding an
aligned area on the stack.

IMO, gcc should be allocating extra stack space in functions that
might require additional alignment, and adjust the frame pointer
to an aligned value.  I'm not a gcc hacker, and it's likely that
it involves some serious gcc hacking.



dave...

-- 
David Schleef
Big Kitten LLC (http://www.bigkitten.com/) -- data acquisition on Linux


More information about the Liboil mailing list