Boost logo

Boost :

Subject: Re: [boost] [context review]
From: Thomas Klimpel (Thomas.Klimpel_at_[hidden])
Date: 2011-03-25 09:04:56


Giovanni Piero Deretta wrote:
> >> Bot the i386 and amd64 asm implementation save and restore the fpu
> >> control word (the amd64 both x87 and SSE2 control words).
> >
> > The SYSV AMD64 ABI requires that the SSE2 control and status word
> > and the x87 control word have to preserved across function calls.
> >
>
> You are right. For correctness you need to preserve them. It would be
> nice to have an option to remove these save/restore when the user does
> not manipulate the control word or it manipulates it program wise.
>
> >
> >> BTW, the current code is already inconsistent because it is saving
> the
> >> SSE2 control world on amd64 but not on i386.
> >
> > I didn't read in the SYSV I386 ABI document about the fact that it
> requires to preserve SSE2 stuff.
> >
>
> I think this is still the official SYSV i386 abi document:
>
> http://www.sco.com/developers/devspecs/abi386-4.pdf
>
> but it doesn't mention SSE at all, so it can be complete. Do you have
> any other reference?

What do you mean by "official SYSV i386 abi document"? I would think that the compiler vendors are more or less free to use whatever abi they deem appropriate. Of course they will try to be reasonable abi compatible with other compilers and between different releases of the same compiler. Perhaps compiler vendors in 1997 (the date from the linked document) tried to follow the linked document more or less, but I can't believe that this should be still true today, more than ten years later.

So I fail to see the relevance of the linked paper and I think that referring to it is even slightly dangerous, because it seems to imply that there actually exists such a thing as an official SYSV i386 abi document.

(Background: I regularly test the numeric_bindings library on different target platforms. It's pretty safe to use the fortran compiler from the same vendor and release as the c++ compiler, but there can occasionally be issues when mixing compilers from different versions or vendors. This is the reason why I don't believe that there should really exist an official i386 abi document.)

Regards,
Thomas


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk