diff mbox series

[17/19] <sys/platform/x86.h>: Add AVX-NE-CONVERT support

Message ID 20230405162144.984598-18-hjl.tools@gmail.com
State New
Headers show
Series <sys/platform/x86.h>: Update CPUID features | expand

Commit Message

H.J. Lu April 5, 2023, 4:21 p.m. UTC
Add AVX-NE-CONVERT support to <sys/platform/x86.h>.
---
 manual/platform.texi               | 3 +++
 sysdeps/x86/bits/platform/x86.h    | 1 +
 sysdeps/x86/cpu-features.c         | 2 ++
 sysdeps/x86/include/cpu-features.h | 3 +++
 sysdeps/x86/tst-get-cpu-features.c | 2 ++
 5 files changed, 11 insertions(+)

Comments

Noah Goldstein April 5, 2023, 9:05 p.m. UTC | #1
On Wed, Apr 5, 2023 at 11:27 AM H.J. Lu via Libc-alpha
<libc-alpha@sourceware.org> wrote:
>
> Add AVX-NE-CONVERT support to <sys/platform/x86.h>.
> ---
>  manual/platform.texi               | 3 +++
>  sysdeps/x86/bits/platform/x86.h    | 1 +
>  sysdeps/x86/cpu-features.c         | 2 ++
>  sysdeps/x86/include/cpu-features.h | 3 +++
>  sysdeps/x86/tst-get-cpu-features.c | 2 ++
>  5 files changed, 11 insertions(+)
>
> diff --git a/manual/platform.texi b/manual/platform.texi
> index 873ea0a84a..1e120993d7 100644
> --- a/manual/platform.texi
> +++ b/manual/platform.texi
> @@ -222,6 +222,9 @@ Leaf (EAX = 23H).
>  @item
>  @code{AVX_IFMA} -- The AVX-IFMA instruction extensions.
>
> +@item
> +@code{AVX_NE_CONVERT} -- The AVX-NE-CONVERT instruction extensions.
> +
>  @item
>  @code{AVX_VNNI} -- The AVX-VNNI instruction extensions.
>
> diff --git a/sysdeps/x86/bits/platform/x86.h b/sysdeps/x86/bits/platform/x86.h
> index 7b239ef188..d8ba33bd42 100644
> --- a/sysdeps/x86/bits/platform/x86.h
> +++ b/sysdeps/x86/bits/platform/x86.h
> @@ -309,6 +309,7 @@ enum
>         + cpuid_register_index_edx * 8 * sizeof (unsigned int)),
>
>    x86_cpu_AVX_VNNI_INT8                = x86_cpu_index_7_ecx_1_edx + 4,
> +  x86_cpu_AVX_NE_CONVERT       = x86_cpu_index_7_ecx_1_edx + 5,
>
>    x86_cpu_index_19_ebx
>      = (CPUID_INDEX_19 * 8 * 4 * sizeof (unsigned int)
> diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c
> index f34f4884eb..dfd1b85dce 100644
> --- a/sysdeps/x86/cpu-features.c
> +++ b/sysdeps/x86/cpu-features.c
> @@ -141,6 +141,8 @@ update_active (struct cpu_features *cpu_features)
>                 }
>               /* Determine if AVX-IFMA is usable.  */
>               CPU_FEATURE_SET_ACTIVE (cpu_features, AVX_IFMA);
> +             /* Determine if AVX-NE-CONVERT is usable.  */
> +             CPU_FEATURE_SET_ACTIVE (cpu_features, AVX_NE_CONVERT);
>               /* Determine if AVX-VNNI is usable.  */
>               CPU_FEATURE_SET_ACTIVE (cpu_features, AVX_VNNI);
>               /* Determine if AVX-VNNI-INT8 is usable.  */
> diff --git a/sysdeps/x86/include/cpu-features.h b/sysdeps/x86/include/cpu-features.h
> index 5e09c58d9c..673cf8ca92 100644
> --- a/sysdeps/x86/include/cpu-features.h
> +++ b/sysdeps/x86/include/cpu-features.h
> @@ -316,6 +316,7 @@ enum
>
>  /* EDX.  */
>  #define bit_cpu_AVX_VNNI_INT8  (1u << 4)
> +#define bit_cpu_AVX_NE_CONVERT (1u << 5)
>
>  /* CPUID_INDEX_19.  */
>
> @@ -556,6 +557,7 @@ enum
>  #define index_cpu_AVX_IFMA     CPUID_INDEX_7_ECX_1
>  #define index_cpu_LAM          CPUID_INDEX_7_ECX_1
>  #define index_cpu_AVX_VNNI_INT8        CPUID_INDEX_7_ECX_1
> +#define index_cpu_AVX_NE_CONVERT CPUID_INDEX_7_ECX_1
>
>  /* CPUID_INDEX_19.  */
>
> @@ -798,6 +800,7 @@ enum
>
>  /* EDX.  */
>  #define reg_AVX_VNNI_INT8      edx
> +#define reg_AVX_NE_CONVERT     edx
>
>  /* CPUID_INDEX_19.  */
>
> diff --git a/sysdeps/x86/tst-get-cpu-features.c b/sysdeps/x86/tst-get-cpu-features.c
> index f0585cf330..bb1b67fd1c 100644
> --- a/sysdeps/x86/tst-get-cpu-features.c
> +++ b/sysdeps/x86/tst-get-cpu-features.c
> @@ -216,6 +216,7 @@ do_test (void)
>    CHECK_CPU_FEATURE_PRESENT (LAM);
>    CHECK_CPU_FEATURE_PRESENT (MSRLIST);
>    CHECK_CPU_FEATURE_PRESENT (AVX_VNNI_INT8);
> +  CHECK_CPU_FEATURE_PRESENT (AVX_NE_CONVERT);
>    CHECK_CPU_FEATURE_PRESENT (AESKLE);
>    CHECK_CPU_FEATURE_PRESENT (WIDE_KL);
>    CHECK_CPU_FEATURE_PRESENT (PTWRITE);
> @@ -384,6 +385,7 @@ do_test (void)
>    CHECK_CPU_FEATURE_ACTIVE (AMX_FP16);
>    CHECK_CPU_FEATURE_ACTIVE (AVX_IFMA);
>    CHECK_CPU_FEATURE_ACTIVE (AVX_VNNI_INT8);
> +  CHECK_CPU_FEATURE_ACTIVE (AVX_NE_CONVERT);
>    CHECK_CPU_FEATURE_ACTIVE (AESKLE);
>    CHECK_CPU_FEATURE_ACTIVE (WIDE_KL);
>    CHECK_CPU_FEATURE_ACTIVE (PTWRITE);
> --
> 2.39.2
>

LGTM
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
diff mbox series

Patch

diff --git a/manual/platform.texi b/manual/platform.texi
index 873ea0a84a..1e120993d7 100644
--- a/manual/platform.texi
+++ b/manual/platform.texi
@@ -222,6 +222,9 @@  Leaf (EAX = 23H).
 @item
 @code{AVX_IFMA} -- The AVX-IFMA instruction extensions.
 
+@item
+@code{AVX_NE_CONVERT} -- The AVX-NE-CONVERT instruction extensions.
+
 @item
 @code{AVX_VNNI} -- The AVX-VNNI instruction extensions.
 
diff --git a/sysdeps/x86/bits/platform/x86.h b/sysdeps/x86/bits/platform/x86.h
index 7b239ef188..d8ba33bd42 100644
--- a/sysdeps/x86/bits/platform/x86.h
+++ b/sysdeps/x86/bits/platform/x86.h
@@ -309,6 +309,7 @@  enum
        + cpuid_register_index_edx * 8 * sizeof (unsigned int)),
 
   x86_cpu_AVX_VNNI_INT8		= x86_cpu_index_7_ecx_1_edx + 4,
+  x86_cpu_AVX_NE_CONVERT	= x86_cpu_index_7_ecx_1_edx + 5,
 
   x86_cpu_index_19_ebx
     = (CPUID_INDEX_19 * 8 * 4 * sizeof (unsigned int)
diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c
index f34f4884eb..dfd1b85dce 100644
--- a/sysdeps/x86/cpu-features.c
+++ b/sysdeps/x86/cpu-features.c
@@ -141,6 +141,8 @@  update_active (struct cpu_features *cpu_features)
 		}
 	      /* Determine if AVX-IFMA is usable.  */
 	      CPU_FEATURE_SET_ACTIVE (cpu_features, AVX_IFMA);
+	      /* Determine if AVX-NE-CONVERT is usable.  */
+	      CPU_FEATURE_SET_ACTIVE (cpu_features, AVX_NE_CONVERT);
 	      /* Determine if AVX-VNNI is usable.  */
 	      CPU_FEATURE_SET_ACTIVE (cpu_features, AVX_VNNI);
 	      /* Determine if AVX-VNNI-INT8 is usable.  */
diff --git a/sysdeps/x86/include/cpu-features.h b/sysdeps/x86/include/cpu-features.h
index 5e09c58d9c..673cf8ca92 100644
--- a/sysdeps/x86/include/cpu-features.h
+++ b/sysdeps/x86/include/cpu-features.h
@@ -316,6 +316,7 @@  enum
 
 /* EDX.  */
 #define bit_cpu_AVX_VNNI_INT8	(1u << 4)
+#define bit_cpu_AVX_NE_CONVERT	(1u << 5)
 
 /* CPUID_INDEX_19.  */
 
@@ -556,6 +557,7 @@  enum
 #define index_cpu_AVX_IFMA	CPUID_INDEX_7_ECX_1
 #define index_cpu_LAM		CPUID_INDEX_7_ECX_1
 #define index_cpu_AVX_VNNI_INT8	CPUID_INDEX_7_ECX_1
+#define index_cpu_AVX_NE_CONVERT CPUID_INDEX_7_ECX_1
 
 /* CPUID_INDEX_19.  */
 
@@ -798,6 +800,7 @@  enum
 
 /* EDX.  */
 #define reg_AVX_VNNI_INT8	edx
+#define reg_AVX_NE_CONVERT	edx
 
 /* CPUID_INDEX_19.  */
 
diff --git a/sysdeps/x86/tst-get-cpu-features.c b/sysdeps/x86/tst-get-cpu-features.c
index f0585cf330..bb1b67fd1c 100644
--- a/sysdeps/x86/tst-get-cpu-features.c
+++ b/sysdeps/x86/tst-get-cpu-features.c
@@ -216,6 +216,7 @@  do_test (void)
   CHECK_CPU_FEATURE_PRESENT (LAM);
   CHECK_CPU_FEATURE_PRESENT (MSRLIST);
   CHECK_CPU_FEATURE_PRESENT (AVX_VNNI_INT8);
+  CHECK_CPU_FEATURE_PRESENT (AVX_NE_CONVERT);
   CHECK_CPU_FEATURE_PRESENT (AESKLE);
   CHECK_CPU_FEATURE_PRESENT (WIDE_KL);
   CHECK_CPU_FEATURE_PRESENT (PTWRITE);
@@ -384,6 +385,7 @@  do_test (void)
   CHECK_CPU_FEATURE_ACTIVE (AMX_FP16);
   CHECK_CPU_FEATURE_ACTIVE (AVX_IFMA);
   CHECK_CPU_FEATURE_ACTIVE (AVX_VNNI_INT8);
+  CHECK_CPU_FEATURE_ACTIVE (AVX_NE_CONVERT);
   CHECK_CPU_FEATURE_ACTIVE (AESKLE);
   CHECK_CPU_FEATURE_ACTIVE (WIDE_KL);
   CHECK_CPU_FEATURE_ACTIVE (PTWRITE);