i386: Correct AVX10 CPUID emulation

Message ID 20240709083828.1050569-1-haochen.jiang@intel.com
State New
Headers
Series i386: Correct AVX10 CPUID emulation |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 warning Patch is already merged
linaro-tcwg-bot/tcwg_gcc_check--master-arm warning Patch is already merged

Commit Message

Jiang, Haochen July 9, 2024, 8:38 a.m. UTC
  Hi all,

AVX10 Documentaion has specified ecx value as 0 for AVX10 version and
vector size under 0x24 subleaf. Although for ecx=1, the bits are all
reserved for now, we still need to specify ecx as 0 to avoid dirty
value in ecx.

Bootstrapped on x86-64-pc-linux-gnu. Ok for trunk and backport to GCC14?

Reference:

Intel Advanced Vector Extensions 10 (Intel AVX10) Architecture Specification

https://cdrdv2.intel.com/v1/dl/getContent/784267

It describes the Intel Advanced Vector Extensions 10 Instruction Set Architecture.

Thx,
Haochen

gcc/ChangeLog:

	* common/config/i386/cpuinfo.h (get_available_features): Correct
	AVX10 CPUID emulation to specify ecx value.
---
 gcc/common/config/i386/cpuinfo.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Uros Bizjak July 9, 2024, 8:40 a.m. UTC | #1
On Tue, Jul 9, 2024 at 10:38 AM Haochen Jiang <haochen.jiang@intel.com> wrote:
>
> Hi all,
>
> AVX10 Documentaion has specified ecx value as 0 for AVX10 version and
> vector size under 0x24 subleaf. Although for ecx=1, the bits are all
> reserved for now, we still need to specify ecx as 0 to avoid dirty
> value in ecx.
>
> Bootstrapped on x86-64-pc-linux-gnu. Ok for trunk and backport to GCC14?
>
> Reference:
>
> Intel Advanced Vector Extensions 10 (Intel AVX10) Architecture Specification
>
> https://cdrdv2.intel.com/v1/dl/getContent/784267
>
> It describes the Intel Advanced Vector Extensions 10 Instruction Set Architecture.
>
> Thx,
> Haochen
>
> gcc/ChangeLog:
>
>         * common/config/i386/cpuinfo.h (get_available_features): Correct
>         AVX10 CPUID emulation to specify ecx value.

OK.

Thanks,
Uros.

> ---
>  gcc/common/config/i386/cpuinfo.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/gcc/common/config/i386/cpuinfo.h b/gcc/common/config/i386/cpuinfo.h
> index 936039725ab..2ae77d335d2 100644
> --- a/gcc/common/config/i386/cpuinfo.h
> +++ b/gcc/common/config/i386/cpuinfo.h
> @@ -998,10 +998,10 @@ get_available_features (struct __processor_model *cpu_model,
>         }
>      }
>
> -  /* Get Advanced Features at level 0x24 (eax = 0x24).  */
> +  /* Get Advanced Features at level 0x24 (eax = 0x24, ecx = 0).  */
>    if (avx10_set && max_cpuid_level >= 0x24)
>      {
> -      __cpuid (0x24, eax, ebx, ecx, edx);
> +      __cpuid_count (0x24, 0, eax, ebx, ecx, edx);
>        version = ebx & 0xff;
>        if (ebx & bit_AVX10_256)
>         switch (version)
> --
> 2.31.1
>
  

Patch

diff --git a/gcc/common/config/i386/cpuinfo.h b/gcc/common/config/i386/cpuinfo.h
index 936039725ab..2ae77d335d2 100644
--- a/gcc/common/config/i386/cpuinfo.h
+++ b/gcc/common/config/i386/cpuinfo.h
@@ -998,10 +998,10 @@  get_available_features (struct __processor_model *cpu_model,
 	}
     }
 
-  /* Get Advanced Features at level 0x24 (eax = 0x24).  */
+  /* Get Advanced Features at level 0x24 (eax = 0x24, ecx = 0).  */
   if (avx10_set && max_cpuid_level >= 0x24)
     {
-      __cpuid (0x24, eax, ebx, ecx, edx);
+      __cpuid_count (0x24, 0, eax, ebx, ecx, edx);
       version = ebx & 0xff;
       if (ebx & bit_AVX10_256)
 	switch (version)