[PATCH 1/5] x86/SSE2AVX: respect prefixes

Cui, Lili lili.cui@intel.com
Wed Mar 27 08:47:43 GMT 2024


> 1) Without -msse2avx we unconditionally honor REX.W. Hence we ought to
>    also do so with -msse2avx, converting to VEX.W.
> 
> 2) {rex} doesn't prevent conversion to VEX encodings. Thus {rex2}
>    shouldn't either.
> ---
> Further {evex} may better also be respected, but that'll be a bigger change.
> 
> --- a/gas/config/tc-i386.c
> +++ b/gas/config/tc-i386.c
> @@ -3885,7 +3885,7 @@ build_vex_prefix (const insn_template *t
>    /* Check the REX.W bit and VEXW.  */
>    if (i.tm.opcode_modifier.vexw == VEXWIG)
>      w = (vexwig == vexw1 || (i.rex & REX_W)) ? 1 : 0;
> -  else if (i.tm.opcode_modifier.vexw)
> +  else if (i.tm.opcode_modifier.vexw && !(i.rex & REX_W))
>      w = i.tm.opcode_modifier.vexw == VEXW1 ? 1 : 0;
>    else
>      w = (flag_code == CODE_64BIT ? i.rex & REX_W : vexwig == vexw1) ? 1 : 0;

Yes, we should also correct the operand size for AVX when rex.w appears.

Lili. 



More information about the Binutils mailing list