[PATCH 2/2] Support x86 ACE_OP_FP16/32/64 instructions

Jan Beulich jbeulich@suse.com
Fri Nov 20 13:09:06 GMT 2026


On 16.11.2026 09:19, Haochen Jiang wrote:
> ACEOPFP16/32/64 are three discrete bits under ACE umbrella.
> 
> In assembler, TOP1PD from ACEOPFP64 uses a zmm register pair, it also
> has three registers just like Xeon Phi ISAs with RegSIMD last operand
> usage. Thus, the previous condition based on operand amount could not
> be used. Here we change it to check last operand type to distinguish
> Xeon Phi and AMX/ACE pair register usage. Also, the register pair
> usage added from now on will raise error instead of warning since
> HW will raise #UD for invalid usage for them.

Any reason for that? It's hard to see how those encodings could be used
for anything else. Which generally is the reason to surface #UD rather
than ignoring bits.

> @@ -11493,15 +11496,16 @@ process_operands (void)
>  	{
>  	case RegSIMD:
>  	  op = 1;
> -	  if (i.operands == 2)
> +	  if (!i.types[i.operands - 1].bitfield.tmmword)

Can this be inverted please, such that not only the (going forward) more
common case comes (remains) first, but also to avoid ...

>  	    {
> -	      /* AMX-TRANSPOSE operand 2: N must be a multiple of 2. */
> -	      extra = 1;
> +	      /* AVX512-{4FMAPS,4VNNIW} operand 2: N must be a multiple of 4. */
> +	      extra = 3;
>  	    }
>  	  else
>  	    {
> -	      /* AVX512-{4FMAPS,4VNNIW} operand 2: N must be a multiple of 4. */
> -	      extra = 3;

... this pair of lines needlessly moving around?

> +	      /* AMX-TRANSPOSE/ACE_OP_FP64 operand 2:
> +		 N must be a multiple of 2. */

Nit: This may want flowing a little differently, to make better use of
line length.

> @@ -11517,13 +11521,28 @@ process_operands (void)
>  
>        first = i.op[op].regs - (register_number (i.op[op].regs) & extra);
>        if (i.op[op].regs != first)
> -	as_warn (_("operand %u `%s%s' implicitly denotes"
> -		   " `%s%s' to `%s%s' group in `%s'"),
> -		 intel_syntax ? i.operands - op : op + 1,
> -		 register_prefix, i.op[op].regs->reg_name,
> -		 register_prefix, first[0].reg_name,
> -		 register_prefix, first[extra].reg_name,
> -		 insn_name (&i.tm));
> +	/* For register pairs under AVX512-{4FMAPS, 4VNNIW},
> +	   AVX512-VP2INTERSECT, AMX_TRANSPOSE, improper register
> +	   number will be implicitly handled by hardware to its
> +	   valid register number.  For all the other register
> +	   pairs, hardward will raise #UD.  */
> +	if (is_cpu (&i.tm, CpuAVX512_4FMAPS)
> +	    || is_cpu (&i.tm, CpuAVX512_4VNNIW)
> +	    || is_cpu (&i.tm, CpuAVX512_VP2INTERSECT)
> +	    || is_cpu (&i.tm, CpuAMX_TRANSPOSE))
> +	  as_warn (_("operand %u `%s%s' implicitly denotes"
> +		     " `%s%s' to `%s%s' group in `%s'"),
> +		   intel_syntax ? i.operands - op : op + 1,
> +		   register_prefix, i.op[op].regs->reg_name,
> +		   register_prefix, first[0].reg_name,
> +		   register_prefix, first[extra].reg_name,
> +		   insn_name (&i.tm));
> +	else
> +	  as_bad (_("operand %u `%s%s' is invalid in `%s',"
> +		    " use `%s%s' instead"),
> +		  intel_syntax ? i.operands - op : op + 1,
> +		  register_prefix, i.op[op].regs->reg_name,
> +		  insn_name (&i.tm), register_prefix, first[0].reg_name);

This inner if/else wants putting in braces, to visually separate better
from the surrounding if().

> --- a/gas/testsuite/gas/i386/x86-64.exp
> +++ b/gas/testsuite/gas/i386/x86-64.exp
> @@ -706,6 +706,14 @@ run_dump_test "x86-64-ace_v1"
>  run_dump_test "x86-64-ace_v1-intel"
>  run_dump_test "x86-64-ace_v2"
>  run_dump_test "x86-64-ace_v2-intel"
> +run_dump_test "x86-64-ace_op_fp16"
> +run_dump_test "x86-64-ace_op_fp16-intel"
> +run_dump_test "x86-64-ace_op_fp32"
> +run_dump_test "x86-64-ace_op_fp32-intel"
> +run_dump_test "x86-64-ace_op_fp64"
> +run_dump_test "x86-64-ace_op_fp64-intel"

I'm wondering: Do we really need 3 separate tiny test pairs for these?

> +run_list_test "x86-64-ace_op_fp64-inval"
> +run_dump_test "x86-64-ace_op_fp64-bad"

These of course want to remain separate.

> --- a/opcodes/i386-opc.tbl
> +++ b/opcodes/i386-opc.tbl
> @@ -3345,6 +3345,10 @@ top8fmxn<tdpb>ps, 0x<tdpb:pfx>8e, ACE_V2, Modrm|EVex512|Space0F3A|Src2VVVV|VexW0
>  
>  top8fmxbf4ps, 0xf38c, ACE_V2, Modrm|EVex512|Space0F3A|Src2VVVV|VexW0|NoSuf, { Imm8, RegZMM, RegZMM, RegTMM }
>  
> +top2phps, 0xf25c, ACE_OP_FP16, Modrm|EVex512|Space0F38|Src2VVVV|VexW0|NoSuf, { RegZMM, RegZMM, RegTMM }
> +top1ps, 0x48, ACE_OP_FP32, Modrm|EVex512|Space0F38|Src2VVVV|VexW0|NoSuf|StaticRounding|SAE, { RegZMM, RegZMM, RegTMM }
> +top1pd, 0xf248, ACE_OP_FP64, Modrm|EVex512|Space0F38|Src2VVVV|VexW1|NoSuf|ImplicitGroup|StaticRounding|SAE, { RegZMM, RegZMM, RegTMM }

Along the lines of questions on the earlier series: Is EVex512 really needed
in the latter two of these?

Jan


More information about the Binutils mailing list