[PATCH] x86/APX: convert runtime special case to build-time one

Jiang, Haochen haochen.jiang@intel.com
Fri Jan 17 07:32:01 GMT 2025


> From: Jan Beulich <jbeulich@suse.com>
> Sent: Friday, January 17, 2025 3:27 PM
> 
> On 17.01.2025 03:51, Jiang, Haochen wrote:
> >> From: Jan Beulich <jbeulich@suse.com>
> >> Sent: Thursday, January 16, 2025 6:26 PM
> >>
> >> --- a/opcodes/i386-gen.c
> >> +++ b/opcodes/i386-gen.c
> >> @@ -1039,6 +1039,20 @@ process_i386_cpu_flag (FILE *table, char
> >>  	  all[Cpu64].value = 1;
> >>
> >>        output_cpu_flags(table, all, ARRAY_SIZE (all), -1, comma, indent,
> lineno);
> >> +
> >> +      /* For APX_F extension of multiple cpuid enabled insns, we cannot use
> >> +	 APX_F(cpuid_A&cpuid_B) in the opcode table, as the result would fail
> >> +	 to be parsed.  Furthermore, the result also wouldn't be quite valid.
> >> +	 However, the assembler's cpu_flags_match() will simply propagate
> >> "any"
> >> +	 to "all", zapping "any" afterwards altogether.  IOW in this situation
> >> +	 both masks have "&&" meaning.  Set the missing flag here.  */
> >> +      if (all[CpuAMX_TRANSPOSE].value && all[CpuAMX_MOVRS].value)
> >> +	{
> >> +	  if (!any[CpuAPX_F].value || !any[CpuAMX_MOVRS].value)
> >> +	    fail ("%s: %d: internal error: APX_F=%d AMX_MOVRS=%d\n",
> >> +		  filename, lineno, any[CpuAPX_F].value,
> >> any[CpuAMX_MOVRS].value);
> >
> > I am not sure if this error is too strict and will cause issue in the future. But
> > LGTM for now since I don't see problem in the foreseeable future.
> 
> It's intentionally as strict as it can be right now. If and when there are
> problems with it, it can and should be refined / relaxed. But we want to
> be sure to at least be aware of the situation, to properly evaluate what
> our options are (without waiting for a bug report by a user).
> 

I see. That is a fair and reasonable point.

Thx,
Haochen


More information about the Binutils mailing list