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

Jan Beulich jbeulich@suse.com
Wed Sep 11 07:19:31 GMT 2024


On 11.09.2024 09:07, Cui, Lili wrote:
>> -----Original Message-----
>> From: Jan Beulich <jbeulich@suse.com>
>> Sent: Friday, September 6, 2024 7:52 PM
>>
>> --- 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.

In most cases of what is being optimized there are no memory operands, or
the number of operands total doesn't change. That's different here. And
memory operands can come with a relocation, which needs to be kept
associated with the correct operands.

Jan



More information about the Binutils mailing list