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

"Liu, Hongtao" <[email protected]> Fri, 7 Aug 2026 00:53:05 +0000
Newsgroups gmane.comp.gcc.patches
Message-ID <DS4PPF240F42FB731D917671330C4EE92B4E5D12@DS4PPF240F42FB7.namprd11.prod.outlook.com>

> -----Original Message-----
> From: Jakub Jelinek <[email protected]>
> Sent: Thursday, August 6, 2026 4:49 PM
> To: Dipesh Sharma <[email protected]>
> Cc: [email protected]; Liu, Hongtao <[email protected]>;
> [email protected]; [email protected]; Venkataramanan Kumar
> <[email protected]>; Jiang, Haochen
> <[email protected]>
> Subject: [committed] i386: Fix up recent cpuinfo.h change for
> FEATURE_AVX10V2AUX
> 
> 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.

Thanks for handling this.

> 
> 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