[PATCH 1/6] Support {evex} pseudo prefix for decode evex promoted insns without egpr32.

Jan Beulich jbeulich@suse.com
Thu Sep 28 14:36:33 GMT 2023


On 21.09.2023 12:11, Cui, Lili wrote:
> --- a/gas/config/tc-i386.c
> +++ b/gas/config/tc-i386.c
> @@ -7581,6 +7581,8 @@ match_template (char mnem_suffix)
>  		}
>  	      else if (t->opcode_space != SPACE_BASE
>  		       && !t->opcode_modifier.nf
> +		       && (t->opcode_space != SPACE_EVEXMAP4
> +			   || t->mnem_off == MN_movbe)
>  		       && (t->opcode_space != SPACE_0F
>  			   /* MOV to/from CR/DR/TR, as an exception, follow
>  			      the base opcode space encoding model.  */

So this is along the lines of the change that I would have expected earlier
in the other series, and which I also expect renders unnecessary the .nf
check here. I'm having a hard time seeing why it lives here.

> --- /dev/null
> +++ b/gas/testsuite/gas/i386/x86-64-apx_f-evex.s
> @@ -0,0 +1,1180 @@
> +# Check 64bit APX_F instructions with evex pseudo prefix
> +
> +	.text
> +_start:
> +	{evex}	aadd	%r15,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX

Once again earlier comments apply throughout this file.

> +	{evex}	aadd	%r15d,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	aand	%r15,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	aand	%r15d,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	adc	$0x7b,%r15	 #APX_F OPC_EVEX_EVEX
> +	{evex}	adc	$0x7b,%r15d	 #APX_F OPC_EVEX_EVEX
> +	{evex}	adc	$0x7b,%r15w	 #APX_F OPC_EVEX_EVEX
> +	{evex}	adc	$0x7b,%r8b	 #APX_F OPC_EVEX_EVEX
> +	{evex}	adcb	$0x7b,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	adcw	$0x7b,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	adcl	$0x7b,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	adcq	$0x7b,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	adc	%r15,%r15	 #APX_F OPC_EVEX_EVEX
> +	{evex}	adc	%r15,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	adc	%r15d,%edx	 #APX_F OPC_EVEX_EVEX
> +	{evex}	adc	%r15d,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	adc	%r15w,%ax	 #APX_F OPC_EVEX_EVEX
> +	{evex}	adc	%r15w,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	adc	%r8b,%dl	 #APX_F OPC_EVEX_EVEX
> +	{evex}	adc	%r8b,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	adc	0x123(%r8,%rax,4),%r15	 #APX_F OPC_EVEX_EVEX
> +	{evex}	adc	0x123(%r8,%rax,4),%r15d	 #APX_F OPC_EVEX_EVEX
> +	{evex}	adc	0x123(%r8,%rax,4),%r15w	 #APX_F OPC_EVEX_EVEX
> +	{evex}	adc	0x123(%r8,%rax,4),%r8b	 #APX_F OPC_EVEX_EVEX
> +	{evex}	adcx	%r15,%r15	 #APX_F OPC_EVEX_EVEX
> +	{evex}	adcx	%r15d,%edx	 #APX_F OPC_EVEX_EVEX
> +	{evex}	adcx	0x123(%r8,%rax,4),%r15	 #APX_F OPC_EVEX_EVEX
> +	{evex}	adcx	0x123(%r8,%rax,4),%r15d	 #APX_F OPC_EVEX_EVEX
> +	{evex}	add	$0x7b,%r15	 #APX_F OPC_EVEX_EVEX
> +	{evex}	add	$0x7b,%r15d	 #APX_F OPC_EVEX_EVEX
> +	{evex}	add	$0x7b,%r15w	 #APX_F OPC_EVEX_EVEX
> +	{evex}	add	$0x7b,%r8b	 #APX_F OPC_EVEX_EVEX
> +	{evex}	addb	$0x7b,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	addw	$0x7b,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	addl	$0x7b,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	addq	$0x7b,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	add	%r15,%r15	 #APX_F OPC_EVEX_EVEX
> +	{evex}	add	%r15,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	add	%r15d,%edx	 #APX_F OPC_EVEX_EVEX
> +	{evex}	add	%r15d,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	add	%r15w,%ax	 #APX_F OPC_EVEX_EVEX
> +	{evex}	add	%r15w,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	add	%r8b,%dl	 #APX_F OPC_EVEX_EVEX
> +	{evex}	add	%r8b,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	add	0x123(%r8,%rax,4),%r15	 #APX_F OPC_EVEX_EVEX
> +	{evex}	add	0x123(%r8,%rax,4),%r15d	 #APX_F OPC_EVEX_EVEX
> +	{evex}	add	0x123(%r8,%rax,4),%r15w	 #APX_F OPC_EVEX_EVEX
> +	{evex}	add	0x123(%r8,%rax,4),%r8b	 #APX_F OPC_EVEX_EVEX
> +	{evex}	adox	%r15,%r15	 #APX_F OPC_EVEX_EVEX
> +	{evex}	adox	%r15d,%edx	 #APX_F OPC_EVEX_EVEX
> +	{evex}	adox	0x123(%r8,%rax,4),%r15	 #APX_F OPC_EVEX_EVEX
> +	{evex}	adox	0x123(%r8,%rax,4),%r15d	 #APX_F OPC_EVEX_EVEX
> +	{evex}	aesdec128kl	0x123(%r8,%rax,4),%xmm12	 #APX_F OPC_EVEX_EVEX
> +	{evex}	aesdec256kl	0x123(%r8,%rax,4),%xmm12	 #APX_F OPC_EVEX_EVEX
> +	{evex}	aesdecwide128kl	0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	aesdecwide256kl	0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	aesenc128kl	0x123(%r8,%rax,4),%xmm12	 #APX_F OPC_EVEX_EVEX
> +	{evex}	aesenc256kl	0x123(%r8,%rax,4),%xmm12	 #APX_F OPC_EVEX_EVEX
> +	{evex}	aesencwide128kl	0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	aesencwide256kl	0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	and	$0x7b,%r15	 #APX_F OPC_EVEX_EVEX
> +	{evex}	and	$0x7b,%r15d	 #APX_F OPC_EVEX_EVEX
> +	{evex}	and	$0x7b,%r15w	 #APX_F OPC_EVEX_EVEX
> +	{evex}	and	$0x7b,%r8b	 #APX_F OPC_EVEX_EVEX
> +	{evex}	andb	$0x7b,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	andw	$0x7b,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	andl	$0x7b,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	andq	$0x7b,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	and	%r15,%r15	 #APX_F OPC_EVEX_EVEX
> +	{evex}	and	%r15,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	and	%r15d,%edx	 #APX_F OPC_EVEX_EVEX
> +	{evex}	and	%r15d,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	and	%r15w,%ax	 #APX_F OPC_EVEX_EVEX
> +	{evex}	and	%r15w,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	and	%r8b,%dl	 #APX_F OPC_EVEX_EVEX
> +	{evex}	and	%r8b,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	and	0x123(%r8,%rax,4),%r15	 #APX_F OPC_EVEX_EVEX
> +	{evex}	and	0x123(%r8,%rax,4),%r15d	 #APX_F OPC_EVEX_EVEX
> +	{evex}	and	0x123(%r8,%rax,4),%r15w	 #APX_F OPC_EVEX_EVEX
> +	{evex}	and	0x123(%r8,%rax,4),%r8b	 #APX_F OPC_EVEX_EVEX
> +	{evex}	andn	%r15,%r15,%r11	 #APX_F OPC_EVEX_EVEX
> +	{evex}	andn	%r15d,%edx,%r10d	 #APX_F OPC_EVEX_EVEX
> +	{evex}	andn	0x123(%r8,%rax,4),%r15,%r15	 #APX_F OPC_EVEX_EVEX
> +	{evex}	andn	0x123(%r8,%rax,4),%r15d,%edx	 #APX_F OPC_EVEX_EVEX
> +	{evex}	aor	%r15,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	aor	%r15d,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	axor	%r15,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	axor	%r15d,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	bextr	%r15,%r15,%r11	 #APX_F OPC_EVEX_EVEX
> +	{evex}	bextr	%r15,0x123(%r8,%rax,4),%r15	 #APX_F OPC_EVEX_EVEX
> +	{evex}	bextr	%r15d,%edx,%r10d	 #APX_F OPC_EVEX_EVEX
> +	{evex}	bextr	%r15d,0x123(%r8,%rax,4),%edx	 #APX_F OPC_EVEX_EVEX
> +	{evex}	blsi	%r15,%r15	 #APX_F OPC_EVEX_EVEX
> +	{evex}	blsi	%r15d,%edx	 #APX_F OPC_EVEX_EVEX
> +	{evex}	blsi	0x123(%r8,%rax,4),%r15	 #APX_F OPC_EVEX_EVEX
> +	{evex}	blsi	0x123(%r8,%rax,4),%r15d	 #APX_F OPC_EVEX_EVEX
> +	{evex}	blsmsk	%r15,%r15	 #APX_F OPC_EVEX_EVEX
> +	{evex}	blsmsk	%r15d,%edx	 #APX_F OPC_EVEX_EVEX
> +	{evex}	blsmsk	0x123(%r8,%rax,4),%r15	 #APX_F OPC_EVEX_EVEX
> +	{evex}	blsmsk	0x123(%r8,%rax,4),%r15d	 #APX_F OPC_EVEX_EVEX
> +	{evex}	blsr	%r15,%r15	 #APX_F OPC_EVEX_EVEX
> +	{evex}	blsr	%r15d,%edx	 #APX_F OPC_EVEX_EVEX
> +	{evex}	blsr	0x123(%r8,%rax,4),%r15	 #APX_F OPC_EVEX_EVEX
> +	{evex}	blsr	0x123(%r8,%rax,4),%r15d	 #APX_F OPC_EVEX_EVEX
> +	{evex}	bzhi	%r15,%r15,%r11	 #APX_F OPC_EVEX_EVEX
> +	{evex}	bzhi	%r15,0x123(%r8,%rax,4),%r15	 #APX_F OPC_EVEX_EVEX
> +	{evex}	bzhi	%r15d,%edx,%r10d	 #APX_F OPC_EVEX_EVEX
> +	{evex}	bzhi	%r15d,0x123(%r8,%rax,4),%edx	 #APX_F OPC_EVEX_EVEX
> +	{evex}	cmpbexadd	%r15,%r15,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	cmpbexadd	%r15d,%edx,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	cmpbxadd	%r15,%r15,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	cmpbxadd	%r15d,%edx,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	cmplexadd	%r15,%r15,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	cmplexadd	%r15d,%edx,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	cmplxadd	%r15,%r15,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	cmplxadd	%r15d,%edx,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	cmpnbexadd	%r15,%r15,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	cmpnbexadd	%r15d,%edx,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	cmpnbxadd	%r15,%r15,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	cmpnbxadd	%r15d,%edx,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	cmpnlexadd	%r15,%r15,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	cmpnlexadd	%r15d,%edx,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	cmpnlxadd	%r15,%r15,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	cmpnlxadd	%r15d,%edx,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	cmpnoxadd	%r15,%r15,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	cmpnoxadd	%r15d,%edx,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	cmpnpxadd	%r15,%r15,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	cmpnpxadd	%r15d,%edx,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	cmpnsxadd	%r15,%r15,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	cmpnsxadd	%r15d,%edx,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	cmpnzxadd	%r15,%r15,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	cmpnzxadd	%r15d,%edx,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	cmpoxadd	%r15,%r15,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	cmpoxadd	%r15d,%edx,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	cmppxadd	%r15,%r15,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	cmppxadd	%r15d,%edx,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	cmpsxadd	%r15,%r15,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	cmpsxadd	%r15d,%edx,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	cmpzxadd	%r15,%r15,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	cmpzxadd	%r15d,%edx,0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	dec	%r15	 #APX_F OPC_EVEX_EVEX
> +	{evex}	dec	%r15d	 #APX_F OPC_EVEX_EVEX
> +	{evex}	dec	%r15w	 #APX_F OPC_EVEX_EVEX
> +	{evex}	dec	%r8b	 #APX_F OPC_EVEX_EVEX
> +	{evex}	decb	0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	decw	0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	decl	0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	decq	0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	div	%r15	 #APX_F OPC_EVEX_EVEX
> +	{evex}	div	%r15d	 #APX_F OPC_EVEX_EVEX
> +	{evex}	div	%r15w	 #APX_F OPC_EVEX_EVEX
> +	{evex}	div	%r8b	 #APX_F OPC_EVEX_EVEX
> +	{evex}	divb	0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	divw	0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	divl	0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	divq	0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	encodekey128	%r15d,%edx	 #APX_F OPC_EVEX_EVEX
> +	{evex}	encodekey256	%r15d,%edx	 #APX_F OPC_EVEX_EVEX
> +	{evex}	enqcmd	0x123(%r8,%rax,4),%r15	 #APX_F OPC_EVEX_EVEX
> +	{evex}	enqcmd	0x123(%r8d,%eax,4),%r15d	 #APX_F OPC_EVEX_EVEX
> +	{evex}	enqcmds	0x123(%r8,%rax,4),%r15	 #APX_F OPC_EVEX_EVEX
> +	{evex}	enqcmds	0x123(%r8d,%eax,4),%r15d	 #APX_F OPC_EVEX_EVEX
> +	{evex}	idiv	%r15	 #APX_F OPC_EVEX_EVEX
> +	{evex}	idiv	%r15d	 #APX_F OPC_EVEX_EVEX
> +	{evex}	idiv	%r15w	 #APX_F OPC_EVEX_EVEX
> +	{evex}	idiv	%r8b	 #APX_F OPC_EVEX_EVEX
> +	{evex}	idivb	0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	idivw	0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	idivl	0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	idivq	0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	imul	%r15	 #APX_F OPC_EVEX_EVEX
> +	{evex}	imul	%r15,%r15	 #APX_F OPC_EVEX_EVEX
> +	{evex}	imul	%r15d	 #APX_F OPC_EVEX_EVEX
> +	{evex}	imul	%r15d,%edx	 #APX_F OPC_EVEX_EVEX
> +	{evex}	imul	%r15w	 #APX_F OPC_EVEX_EVEX
> +	{evex}	imul	%r15w,%ax	 #APX_F OPC_EVEX_EVEX
> +	{evex}	imul	%r8b	 #APX_F OPC_EVEX_EVEX
> +	{evex}	imulb	0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	imulw	0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	imull	0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX
> +	{evex}	imul	0x123(%r8,%rax,4),%r15	 #APX_F OPC_EVEX_EVEX
> +	{evex}	imul	0x123(%r8,%rax,4),%r15d	 #APX_F OPC_EVEX_EVEX
> +	{evex}	imul	0x123(%r8,%rax,4),%r15w	 #APX_F OPC_EVEX_EVEX
> +	{evex}	imulq	0x123(%r8,%rax,4)	 #APX_F OPC_EVEX_EVEX

Again no IMUL by immediate (and this time also missing from the Intel
syntax section)?

> --- a/opcodes/i386-dis-evex-len.h
> +++ b/opcodes/i386-dis-evex-len.h
> @@ -64,7 +64,7 @@ static const struct dis386 evex_len_table[][3] = {
>  
>    /* EVEX_LEN_0F38F2 */
>    {
> -    { "%XNandnS",		{ Gdq, VexGdq, Edq }, 0 },
> +    { "%XE%XNandnS",		{ Gdq, VexGdq, Edq }, 0 },
>    },

Why %XE when there already is %XN? (You add this in a few more cases,
but not everywhere, and it's unclear what the underlying pattern is.)
Imo the handling of %XN, when it doesn't emit {nf}, should simply fall
through (or goto) to %XE handling.

As to the further additions of %XE, same request as before: Please
introduce the final way right in the patch adding those, rather than
playing with things again a 2nd time. Not doing so may be necessary in
a few cases (where things intermediately wouldn't work right if put
into final shape right away), but I don't think this is one of them.

Jan


More information about the Binutils mailing list