[PATCH 1/5] x86: correct {,V}PEXTR{D,Q} optimization

Cui, Lili lili.cui@intel.com
Wed Sep 11 07:07:44 GMT 2024



> -----Original Message-----
> From: Jan Beulich <jbeulich@suse.com>
> Sent: Friday, September 6, 2024 7:52 PM
> To: Binutils <binutils@sourceware.org>
> Cc: H.J. Lu <hjl.tools@gmail.com>
> Subject: [PATCH 1/5] x86: correct {,V}PEXTR{D,Q} optimization
> 
> A possible relocation associated with a memory operand also needs moving.
> 
> --- a/gas/config/tc-i386.c
> +++ b/gas/config/tc-i386.c
> @@ -5503,6 +5503,7 @@ optimize_encoding (void)
>        i.op[1].regs = i.op[2].regs;
>        i.types[1] = i.types[2];
>        i.flags[1] = i.flags[2];
> +      i.reloc[1] = i.reloc[2];


      /* Optimize: -O:
         pextrd $0, %xmmN, ...   -> movd %xmmN, ...
         pextrq $0, %xmmN, ...   -> movq %xmmN, ...
         vpextrd $0, %xmmN, ...  -> vmovd %xmmN, ...
         vpextrq $0, %xmmN, ...  -> vmovq %xmmN, ...
       */

Jan, I have a question, why do you want to add the swap of i.reloc[] here (seems they are not related to reloc)? There is no swapping of i.reloc[] elsewhere in this function.

Thanks,
Lili.

>        i.tm.operand_types[1] = i.tm.operand_types[2];
> 
>        i.operands = 2;



More information about the Binutils mailing list