[committed] i386: Fix up recent cpuinfo.h change for FEATURE_AVX10V2AUX

Jakub Jelinek <[email protected]> Thu, 6 Aug 2026 10:48:38 +0200
Newsgroups gmane.comp.gcc.patches
Message-ID <anRKZoYKdrDDDKFk@tucnak>
On Thu, Jul 30, 2026 at 01:52:33PM +0530, Dipesh Sharma wrote:
> --- a/gcc/common/config/i386/cpuinfo.h
> +++ b/gcc/common/config/i386/cpuinfo.h
> @@ -1124,6 +1124,7 @@ get_available_features (struct __processor_model *cpu_model,
>    if (avx10_set && max_cpuid_level >= 0x24)
>      {
>        __cpuid_count (0x24, 0, eax, ebx, ecx, edx);
> +      unsigned int max_subleaf_level = eax;
>        version = ebx & 0xff;
>        switch (version)
>  	{
> @@ -1137,6 +1138,12 @@ get_available_features (struct __processor_model *cpu_model,
>  	  set_feature (FEATURE_AVX10_1);
>  	  break;
>  	}
> +	if (max_subleaf_level>=1)
> +	{
> +	  __cpuid_count (0x24, 1, eax, ebx, ecx, edx);
> +	  if (ecx & bit_AVX10V2AUX)
> +	    set_feature (FEATURE_AVX10V2AUX);
> +	}
>      }
> 
>    /* Check cpuid level of extended features.  */

The r17-2973 change broke
+FAIL: gcc.target/i386/builtin_target.c (test for excess errors)
+UNRESOLVED: gcc.target/i386/builtin_target.c compilation failed to produce executable
Excess errors:
.../common/config/i386/cpuinfo.h:1127:7: error: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]

The following patch makes it valid C89 and cleans it up a little bit.

Tested on x86_64-linux, committed to trunk as obvious.

2026-08-06  Jakub Jelinek  <[email protected]>

	* common/config/i386/cpuinfo.h (get_available_features): Make
	last change valid C89.  Formatting fix.

--- gcc/common/config/i386/cpuinfo.h.jj	2026-08-05 13:17:17.203314351 +0200
+++ gcc/common/config/i386/cpuinfo.h	2026-08-06 10:41:26.270556689 +0200
@@ -1123,8 +1123,9 @@ get_available_features (struct __process
   /* Get Advanced Features at level 0x24 (eax = 0x24, ecx = 0).  */
   if (avx10_set && max_cpuid_level >= 0x24)
     {
-      __cpuid_count (0x24, 0, eax, ebx, ecx, edx);
-      unsigned int max_subleaf_level = eax;
+      unsigned int max_subleaf_level;
+
+      __cpuid_count (0x24, 0, max_subleaf_level, ebx, ecx, edx);
       version = ebx & 0xff;
       switch (version)
 	{
@@ -1138,7 +1139,7 @@ get_available_features (struct __process
 	  set_feature (FEATURE_AVX10_1);
 	  break;
 	}
-	if (max_subleaf_level>=1)
+      if (max_subleaf_level >= 1)
 	{
 	  __cpuid_count (0x24, 1, eax, ebx, ecx, edx);
 	  if (ecx & bit_AVX10V2AUX)


	Jakub