PATCH: Add --with-math=sse for x86

Richard Guenther richard.guenther@gmail.com
Sun Aug 10 20:08:00 GMT 2008


On Sun, Aug 10, 2008 at 9:28 PM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Sun, Aug 10, 2008 at 9:24 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Sun, Aug 10, 2008 at 11:07 AM, Richard Guenther
>> <richard.guenther@gmail.com> wrote:
>>> On Sun, Aug 10, 2008 at 6:27 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>> On Sat, Aug 09, 2008 at 04:52:49PM -0700, H.J. Lu wrote:
>>>>> This patch adds an option to configure gcc with SSE math by default.
>>>>> Tested on Linux/x86-64.  OK for trunk?
>>>>>
>>>>> Thanks.
>>>>>
>>>>>
>>>>> H.J.
>>>>> ---
>>>>> 2008-08-09  H.J. Lu  <hongjiu.lu@intel.com>
>>>>>
>>>>>       * config.gcc: Support --with-math=sse for x86.
>>>>>
>>>>>       * config/i386/ssemath.h: New.
>>>>>
>>>>
>>>> Here is the updated patch. It defines TARGET_SUBTARGET32_ISA_DEFAULT
>>>> instead of TARGET_SUBTARGET_ISA_DEFAULT so that -march= can override
>>>> it.  Tested on Linux/x86-64.  OK for trunk?
>>>
>>> Why is this useful and why should this be made possible?
>>>
>>
>> 1. SSE math on some processors is much faster than x87. -msse2 -mfpmath=sse can
>> improve SPEC CPU FP by 20% on certain processor.
>> 2. Most of modern x86 processors support at least SSE2.
>> 3. Configure gcc with --with-math=sse can improve gcc testing. Gcc
>> failed to bootstrap
>> with --with-math=sse on Linux/Intel64 due to
>>
>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37055
>>
>> The --with-math=sse option has following benefits:
>>
>> 1. Provide a way to configure gcc to generate faster 32bit FP code, which
>> can run on majority of today's processors.
>> 2. Provide a way to test SSE math in 32bit with existing gcc testsuite.

Oh, and 2. is possible with RUNTESTFLAGS="--target_board=unix/-mfpmath=sse".
Are you concerned about the SPEC rules limit for the number of compiler options
for base numbers??

> 3. With the current x86 ABI it pessimizes -Os due to extra moves between
> the x87 stack and SSE registers.  This also pessimizes interfacing to all
> system libraries.
>
> I think the user is better advised to choose -mfpmath=sse only for carefully
> selected cases.
>
> Richard.
>



More information about the Gcc-patches mailing list