* [PATCH] x86: Correct index_cpu_LZCNT [BZ # 23456]
@ 2018-07-26 16:46 H.J. Lu
2018-07-26 18:05 ` Carlos O'Donell
0 siblings, 1 reply; 3+ messages in thread
From: H.J. Lu @ 2018-07-26 16:46 UTC (permalink / raw)
To: libc-alpha
cpu-features.h has
#define bit_cpu_LZCNT (1 << 5)
#define index_cpu_LZCNT COMMON_CPUID_INDEX_1
#define reg_LZCNT
But the LZCNT feature bit is in COMMON_CPUID_INDEX_80000001:
Initial EAX Value: 80000001H
ECX Extended Processor Signature and Feature Bits:
Bit 05: LZCNT available
index_cpu_LZCNT should be COMMON_CPUID_INDEX_80000001, not
COMMON_CPUID_INDEX_1. The VMX feature bit is in COMMON_CPUID_INDEX_1:
Initial EAX Value: 01H
Feature Information Returned in the ECX Register:
5 VMX
[BZ # 23456]
* sysdeps/x86/cpu-features.h (index_cpu_LZCNT): Set to
COMMON_CPUID_INDEX_80000001.
---
sysdeps/x86/cpu-features.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sysdeps/x86/cpu-features.h b/sysdeps/x86/cpu-features.h
index 624e681e96..3807a9d611 100644
--- a/sysdeps/x86/cpu-features.h
+++ b/sysdeps/x86/cpu-features.h
@@ -204,7 +204,7 @@ extern const struct cpu_features *__get_cpu_features (void)
# define index_cpu_HTT COMMON_CPUID_INDEX_1
# define index_cpu_BMI1 COMMON_CPUID_INDEX_7
# define index_cpu_BMI2 COMMON_CPUID_INDEX_7
-# define index_cpu_LZCNT COMMON_CPUID_INDEX_1
+# define index_cpu_LZCNT COMMON_CPUID_INDEX_80000001
# define index_cpu_MOVBE COMMON_CPUID_INDEX_1
# define index_cpu_POPCNT COMMON_CPUID_INDEX_1
# define index_cpu_IBT COMMON_CPUID_INDEX_7
--
2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] x86: Correct index_cpu_LZCNT [BZ # 23456]
2018-07-26 16:46 [PATCH] x86: Correct index_cpu_LZCNT [BZ # 23456] H.J. Lu
@ 2018-07-26 18:05 ` Carlos O'Donell
2018-07-26 18:13 ` H.J. Lu
0 siblings, 1 reply; 3+ messages in thread
From: Carlos O'Donell @ 2018-07-26 18:05 UTC (permalink / raw)
To: H.J. Lu, libc-alpha
On 07/26/2018 12:46 PM, H.J. Lu wrote:
> cpu-features.h has
>
> #define bit_cpu_LZCNT (1 << 5)
> #define index_cpu_LZCNT COMMON_CPUID_INDEX_1
> #define reg_LZCNT
>
> But the LZCNT feature bit is in COMMON_CPUID_INDEX_80000001:
>
> Initial EAX Value: 80000001H
> ECX Extended Processor Signature and Feature Bits:
> Bit 05: LZCNT available
>
> index_cpu_LZCNT should be COMMON_CPUID_INDEX_80000001, not
> COMMON_CPUID_INDEX_1. The VMX feature bit is in COMMON_CPUID_INDEX_1:
>
> Initial EAX Value: 01H
> Feature Information Returned in the ECX Register:
> 5 VMX
>
> [BZ # 23456]
> * sysdeps/x86/cpu-features.h (index_cpu_LZCNT): Set to
> COMMON_CPUID_INDEX_80000001.
OK for 2.28.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
> ---
> sysdeps/x86/cpu-features.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sysdeps/x86/cpu-features.h b/sysdeps/x86/cpu-features.h
> index 624e681e96..3807a9d611 100644
> --- a/sysdeps/x86/cpu-features.h
> +++ b/sysdeps/x86/cpu-features.h
> @@ -204,7 +204,7 @@ extern const struct cpu_features *__get_cpu_features (void)
> # define index_cpu_HTT COMMON_CPUID_INDEX_1
> # define index_cpu_BMI1 COMMON_CPUID_INDEX_7
> # define index_cpu_BMI2 COMMON_CPUID_INDEX_7
> -# define index_cpu_LZCNT COMMON_CPUID_INDEX_1
> +# define index_cpu_LZCNT COMMON_CPUID_INDEX_80000001
Confirmed.
CPUID.EAX=80000001H:ECX.LZCNT[bit 5]: if 1 indicates the processor supports the LZCNT instruction.
> # define index_cpu_MOVBE COMMON_CPUID_INDEX_1
> # define index_cpu_POPCNT COMMON_CPUID_INDEX_1
> # define index_cpu_IBT COMMON_CPUID_INDEX_7
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] x86: Correct index_cpu_LZCNT [BZ # 23456]
2018-07-26 18:05 ` Carlos O'Donell
@ 2018-07-26 18:13 ` H.J. Lu
0 siblings, 0 replies; 3+ messages in thread
From: H.J. Lu @ 2018-07-26 18:13 UTC (permalink / raw)
To: Carlos O'Donell; +Cc: GNU C Library
On Thu, Jul 26, 2018 at 11:05 AM, Carlos O'Donell <carlos@redhat.com> wrote:
> On 07/26/2018 12:46 PM, H.J. Lu wrote:
>> cpu-features.h has
>>
>> #define bit_cpu_LZCNT (1 << 5)
>> #define index_cpu_LZCNT COMMON_CPUID_INDEX_1
>> #define reg_LZCNT
>>
>> But the LZCNT feature bit is in COMMON_CPUID_INDEX_80000001:
>>
>> Initial EAX Value: 80000001H
>> ECX Extended Processor Signature and Feature Bits:
>> Bit 05: LZCNT available
>>
>> index_cpu_LZCNT should be COMMON_CPUID_INDEX_80000001, not
>> COMMON_CPUID_INDEX_1. The VMX feature bit is in COMMON_CPUID_INDEX_1:
>>
>> Initial EAX Value: 01H
>> Feature Information Returned in the ECX Register:
>> 5 VMX
>>
>> [BZ # 23456]
>> * sysdeps/x86/cpu-features.h (index_cpu_LZCNT): Set to
>> COMMON_CPUID_INDEX_80000001.
>
> OK for 2.28.
>
> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Done. We also need this for 2.28:
https://sourceware.org/ml/libc-alpha/2018-07/msg00914.html
Otherwise, we fail to detect LZCNT on Intel CPUs.
--
H.J.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-07-26 18:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-26 16:46 [PATCH] x86: Correct index_cpu_LZCNT [BZ # 23456] H.J. Lu
2018-07-26 18:05 ` Carlos O'Donell
2018-07-26 18:13 ` H.J. Lu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).