On Sun, Feb 21, 2010 at 6:15 PM, Geert Bosch <bo...@adacore.com> wrote:
>
> On Feb 21, 2010, at 09:58, Joseph S. Myers wrote:
>> On Sun, 21 Feb 2010, Richard Guenther wrote:
>>>> The biggest change we need to make for x86 is to enable SSE2,
>>>> so we can get proper rounding behavior for float and double,
>>>> as well as significant performance increases.
>>>
>>> I think Joseph fixed the rounding behavior for 4.5.  Also without an 
>>> adjusted
>>
>> Well, I provided the option for rounding that is predictable and in
>> accordance with C99 when using the default -mfpmath=387.  But that option
>> does carry the performance cost of storing to / loading from memory at
>> various points, as required to get the rounding on 387 (and there are
>> still cases where excess precision means double rounding).
>
> This clearly is worse in all areas than using SSE2: there STILL is
> double rounding, and performance goes down the drain. On any recent
> machine there is the SSE2 hardware to do the operations correctly
> without going through memory and without double rounding.
>
>>> ABI you'd introduce x87 <-> SSE register moves which are not helpful
>>> for performance.
>>
>> As I understand it, whether -mfpmath=387 (with excess precision) or
>> -mfpmath=sse is the default is also considered part of the platform API
>> (like whether char is signed or unsigned by default, for example), in
>> addition to the ABI issues that can slow things down when SSE is used.
>
> No, this is not a new ABI. The ABI stays exactly the same. The I of
> ABI stands for Interface. That is, the ABI has nothing to say about
> how a function will compute any results. That is the area of language
> standards. The only way we'd violate the ABI is the reliance on SSE2
> instructions being available and SSE2 registers being saved by the OS.
>
> However, since any other compiler uses SSE2 instructions by default,
> I don't see why GCC should be any different. If anything, since the
> GCC target audience is more focused on Free and open source software,
> we could be more aggressive in taking advantage of newer hardware.
> What about an autoconf test for availability of 486 atomic instructions,
> and SSE2 instructions in order, and choosing the default target based
> on the host? Not too crazy, is it?
>
>> If people really want a new 32-bit x86 ABI I'd suggest making it an ILP32
>> ABI for processors running in 64-bit mode, so 64-bit registers are
>> available without the additional memory cost of 64-bit pointers for code
>> not needing them - you could also assume a minimum of -march=x86-64, which
>> implies SSE2.  But if there were significant demand for such an ABI I
>> think we'd have seen it by now, and you probably run into the various
>> syscall interface problems that MIPS n32 has had.
>
> Let's keep that can of worms closed, has nothing to do with changing
> our -march defaults.
>
>  -Geert
>
> PS. If anyone has SPEC-like figures for performance difference between -msse2
>    -mfpmath=sse,x87  and default, I'd be interested in seeing those results.
http://gcc.opensuse.org/SPEC/CFP/sb-frescobaldi.suse.de-head-64-32o-32bit/recent.html
http://gcc.opensuse.org/SPEC/CINT/sb-frescobaldi.suse.de-head-64-32o-32bit/recent.html

note that SSE is still used by the vectorizer in both base/peak due to
-march=native.

Richard.

Reply via email to