Define HAS_CPUID/HAS_I586/HAS_I686 from -march=
Commit Message
On Tue, Aug 18, 2015 at 8:10 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> On 18 Aug 2015 09:08, H.J. Lu wrote:
>> On Tue, Aug 18, 2015 at 9:02 AM, Mike Frysinger wrote:
>> > On 18 Aug 2015 07:56, H.J. Lu wrote:
>> >> On Tue, Aug 18, 2015 at 7:32 AM, Mike Frysinger wrote:
>> >> > On 17 Aug 2015 16:10, H.J. Lu wrote:
>> >> >> +#ifdef __x86_64__
>> >> >> +# define HAS_CPUID 1
>> >> >> +#elif defined __pentium__
>> >> >> +# define HAS_CPUID 1
>> >> >> +# define HAS_I586 1
>> >> >> +# define HAS_I686 0
>> >> >> +#elif (defined __pentiumpro__ || defined __pentium4__ \
>> >> >> + || defined __nocona__ || defined __atom__ \
>> >> >> + || defined __core2__ || defined __corei7__ \
>> >> >> + || defined __corei7_avx__ || defined __core_avx2__ \
>> >> >> + || defined __nehalem__ || defined __sandybridge__ \
>> >> >> + || defined __haswell__ || defined __knl__ \
>> >> >> + || defined __bonnell__ || defined __silvermont__ \
>> >> >> + || defined __k6__ || defined __k8__ \
>> >> >> + || defined __athlon__ || defined __amdfam10__ \
>> >> >> + || defined __bdver1__ || defined __bdver2__ \
>> >> >> + || defined __bdver3__ || defined __bdver4__ \
>> >> >> + || defined __btver1__ || defined __btver2__)
>> >> >> +# define HAS_CPUID 1
>> >> >> +# define HAS_I586 1
>> >> >> +# define HAS_I686 1
>> >> >> +#else
>> >> >> +# define HAS_CPUID 0
>> >> >> +# define HAS_I586 0
>> >> >> +# define HAS_I686 0
>> >> >> +#endif
>> >> >
>> >> > why is testing for __i686__ & __i586__ unacceptable ?
>> >>
>> >> -march=haswell doesn't define __i686__ since __i686__ is
>> >> mapped to -mach=i686.
>> >
>> > that's not entirely accurate. i did check before posting, but it looks like
>> > the first two entries do set up i586 and i686 correctly (and i stopped after
>> > spot checking the first two). so i guess change __pentium__ to __i586__ and
>> > __pentiumpro__ to __i686__ ?
>>
>> My change is based on sysdeps/x86/bits/string.h and
>> sysdeps/x86/bits/byteswap.h. None of them check
>> __i586__ nor __i686__.
>
> i'm aware of the provenance. that's not a reason to not improve things :).
> -mike
This is what I checked in.
Comments
On 19 Aug 2015 04:21, H.J. Lu wrote:
> +#elif defined __i586__ || defined __pentium__
> +#elif (defined __i686__ || defined __pentiumpro__ \
as i mentioned, -march=pentiumpro will include __i686__, and -march=pentium
will include __i586__, so can't those two be deleted ?
-mike
On Wed, Aug 19, 2015 at 6:05 AM, Mike Frysinger <vapier@gentoo.org> wrote:
> On 19 Aug 2015 04:21, H.J. Lu wrote:
>> +#elif defined __i586__ || defined __pentium__
>> +#elif (defined __i686__ || defined __pentiumpro__ \
>
> as i mentioned, -march=pentiumpro will include __i686__, and -march=pentium
> will include __i586__, so can't those two be deleted ?
> -mike
I assume that there is a reason for __pentium__ and __pentiumpro__.
I won't second guess it.
@@ -1,3 +1,9 @@
+2015-08-10 H.J. Lu <hongjiu.lu@intel.com>
+
+ * sysdeps/x86/cpu-features.h (HAS_I586): Defined to 1 if
+ __i586__ is defined.
+ (HAS_I686): Defined to 1 if __i686__ is defined.
+
2015-08-19 Joseph Myers <joseph@codesourcery.com>
* elf/Makefile [$(have-z-execstack) = yes]
@@ -239,17 +239,18 @@ extern const struct cpu_features
*__get_cpu_features (void)
#ifdef __x86_64__
# define HAS_CPUID 1
-#elif defined __pentium__
+#elif defined __i586__ || defined __pentium__
# define HAS_CPUID 1
# define HAS_I586 1
# define HAS_I686 0
-#elif (defined __pentiumpro__ || defined __pentium4__ \
- || defined __nocona__ || defined __atom__ \
- || defined __core2__ || defined __corei7__ \
- || defined __corei7_avx__ || defined __core_avx2__ \
- || defined __nehalem__ || defined __sandybridge__ \
- || defined __haswell__ || defined __knl__ \
- || defined __bonnell__ || defined __silvermont__ \
+#elif (defined __i686__ || defined __pentiumpro__ \
+ || defined __pentium4__ || defined __nocona__ \
+ || defined __atom__ || defined __core2__ \
+ || defined __corei7__ || defined __corei7_avx__ \
+ || defined __core_avx2__ || defined __nehalem__ \
+ || defined __sandybridge__ || defined __haswell__ \
+ || defined __knl__ || defined __bonnell__ \
+ || defined __silvermont__ \
|| defined __k6__ || defined __k8__ \
|| defined __athlon__ || defined __amdfam10__ \