This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

PATCH: Update default arch for x86


On Fri, Feb 26, 2010 at 10:45 AM, Jack Howarth <howarth@bromo.med.uc.edu> wrote:
> On Fri, Feb 26, 2010 at 10:22:39AM -0800, H.J. Lu wrote:
>> On Fri, Feb 26, 2010 at 9:27 AM, Jason Merrill <jason@redhat.com> wrote:
>> > On 02/26/2010 09:00 AM, H.J. Lu wrote:
>> >>
>> >> On Fri, Feb 26, 2010 at 5:45 AM, Jason Merrill<jason@redhat.com> ?wrote:
>> >>>
>> >>> On 02/25/2010 09:56 PM, H.J. Lu wrote:
>> >>>>
>> >>>> 1. in i386/darwin.h, there are
>> >>>>
>> >>>> /* For darwin we want to target specific processor features as a
>> >>>> minimum,
>> >>>> ? ?but these unfortunately don't correspond to a specific processor. ?*/
>> >>>> #undef TARGET_SUBTARGET32_ISA_DEFAULT
>> >>>> #define TARGET_SUBTARGET32_ISA_DEFAULT (OPTION_MASK_ISA_MMX
>> >>>> \
>> >>>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? | OPTION_MASK_ISA_SSE
>> >>>> \
>> >>>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? | OPTION_MASK_ISA_SSE2)
>> >>>
>> >>> Is this still needed? ?Users configuring for Darwin should get that
>> >>> minimum
>> >>> functionality now because of your patch.
>> >>
>> >> ".../configure i686-darwin" will pass -march=pentiumpro to cc1 and
>> >> ix86_arch_specified will be set to 1.
>> >
>> > Ah, yes, PPro doesn't have all those; that's pentium4 level. ?So how about
>> > defaulting to arch=pentium4 on darwin? ?Then ssemath.h can just adjust
>> > TARGET_FPMATH_DEFAULT.
>> >
>> >> + ? ?i[34567]86-*-darwin*)
>> >> + ? ? ?# Don't set default arch for Darwin since it will set the default
>> >> + ? ? ?# ISA to SSE2.
>> >> + ? ? ?;;
>> >> + ? ?i[34567]86-*-*)
>> >> + ? ? ?# Don't set default arch if --with-fpmath is used since it will set
>> >> + ? ? ?# the default ISA to SSE2.
>> >> + ? ? ?if test x$with_fpmath = x; then
>> >> + ? ? ? ?with_arch=$arch
>> >> + ? ? ?fi
>> >> + ? ? ?;;
>> >
>> > Rather than just disable the default arch setting, these could check that
>> > the default would be pentium4 or higher, and use pentium4 if not. That way
>> > configuring for core2-pc-linux-gnu will get you SSE3 and SSSE3 as well.
>> >
>>
>> How about this patch?
>>
>>
>> --
>> H.J.
>
>> 2010-02-26 ?H.J. Lu ?<hongjiu.lu@intel.com>
>>
>> ? ? ? * config.gcc: Set the default arch at least to Pentium 4 for
>> ? ? ? i[34567]86-*-* targets if SSE math is enabled.
>>
>> diff --git a/gcc/config.gcc b/gcc/config.gcc
>> index df84f50..bc57eaa 100644
>> --- a/gcc/config.gcc
>> +++ b/gcc/config.gcc
>> @@ -2625,16 +2625,22 @@ esac
>> ?# to generic if there is no processor scheduler model for the target.
>> ?arch=
>> ?cpu=
>> +# --with-fpmath=sse will enable SSE2, which is the same ISA supported
>> +# by Pentium 4.
>> +arch_fpmath_pentium4=no
>> ?case ${target} in
>> ? ?i386-*-*)
>> ? ? ?arch=i386
>> ? ? ?cpu=i386
>> + ? ?arch_fpmath_pentium4=yes
>> ? ? ?;;
>> ? ?i486-*-*)
>> ? ? ?arch=i486
>> ? ? ?cpu=i486
>> + ? ?arch_fpmath_pentium4=yes
>> ? ? ?;;
>> ? ?i586-*-*)
>> + ? ?arch_fpmath_pentium4=yes
>> ? ? ?case ${target_noncanonical} in
>> ? ? ? ?k6_2-*)
>> ? ? ? arch=k6-2
>> @@ -2675,22 +2681,27 @@ case ${target} in
>> ? ? ? ?athlon_xp-*|athlon_mp-*|athlon_4-*)
>> ? ? ? arch=athlon-4
>> ? ? ? cpu=athlon-4
>> + ? ? arch_fpmath_pentium4=yes
>> ? ? ? ;;
>> ? ? ? ?athlon_tbird-*|athlon-*)
>> ? ? ? arch=athlon
>> ? ? ? cpu=athlon
>> + ? ? arch_fpmath_pentium4=yes
>> ? ? ? ;;
>> ? ? ? ?geode-*)
>> ? ? ? arch=geode
>> ? ? ? cpu=geode
>> + ? ? arch_fpmath_pentium4=yes
>> ? ? ? ;;
>> ? ? ? ?pentium2-*)
>> ? ? ? arch=pentium2
>> ? ? ? cpu=pentium2
>> + ? ? arch_fpmath_pentium4=yes
>> ? ? ? ;;
>> ? ? ? ?pentium3-*|pentium3m-*)
>> ? ? ? arch=pentium3
>> ? ? ? cpu=pentium3
>> + ? ? arch_fpmath_pentium4=yes
>> ? ? ? ;;
>> ? ? ? ?pentium4-*|pentium4m-*)
>> ? ? ? arch=pentium4
>> @@ -2719,10 +2730,12 @@ case ${target} in
>> ? ? ? ?pentiumpro-*)
>> ? ? ? arch=pentiumpro
>> ? ? ? cpu=pentiumpro
>> + ? ? arch_fpmath_pentium4=yes
>> ? ? ? ;;
>> ? ? ? ?*)
>> ? ? ? arch=pentiumpro
>> ? ? ? cpu=generic
>> + ? ? arch_fpmath_pentium4=yes
>> ? ? ? ;;
>> ? ? ?esac
>> ? ? ?;;
>> @@ -2836,14 +2849,20 @@ esac
>> ?if test x$with_arch = x ; then
>> ? ?case ${target} in
>> ? ? ?i[34567]86-*-darwin*)
>> - ? ? ?# Don't set default arch for Darwin since it will set the default
>> - ? ? ?# ISA to SSE2.
>> + ? ? ?# SSE math is enabled for Darwin, which sets the default ISA to
>> + ? ? ?# SSE2.
>> + ? ? ?if test $arch_fpmath_pentium4 = no; then
>> + ? ? with_arch=$arch
>> + ? ? ?else
>> + ? ? with_arch=pentium4
>> + ? ? ?fi
>> ? ? ? ?;;
>> ? ? ?i[34567]86-*-*)
>> - ? ? ?# Don't set default arch if --with-fpmath is used since it will set
>> - ? ? ?# the default ISA to SSE2.
>> - ? ? ?if test x$with_fpmath = x; then
>> - ? ? ? ?with_arch=$arch
>> + ? ? ?# --with-fpmath sets the default ISA to SSE2.
>> + ? ? ?if test x$with_fpmath = x || test $arch_fpmath_pentium4 = no; then
>> + ? ? with_arch=$arch
>> + ? ? ?else
>> + ? ? with_arch=pentium4
>> ? ? ? ?fi
>> ? ? ? ?;;
>> ? ? ?x86_64-*-*)
>
>
> ? Shouldn't Darwin default to something a little higher than a pentium4 since
> all of the machines are either Core Solo/Duo, Core2 Solo/Duo or Xeon? I noticed
> this comment circa gcc-4.2...
>
> http://psykil.livejournal.com/300856.html
>
> Also, back when Mike Stump was still posting testresults, on i686-apple-darwin*,
> I believe he always used --with-arch=nocona --with-tune=generic (which is what
> we have been using for the FSF gcc i386 fink builds).
> ? ? ? ? ? ? Jack
>

Good point. But Nocona supports Intel64 while Core Solo/Duo don't.
Prescott is better.  Here is the updated patch. OK to install?

-- 
H.J.

Attachment: gcc-arch-7.patch
Description: Text document


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