[PATCH 6/6] x86: optimize {,V}PEXTR{D,Q} with immediate of 0
Jiang, Haochen
haochen.jiang@intel.com
Mon Jun 17 06:49:52 GMT 2024
> -----Original Message-----
> From: Jan Beulich <jbeulich@suse.com>
> Sent: Friday, June 14, 2024 8:15 PM
> To: Binutils <binutils@sourceware.org>
> Cc: H.J. Lu <hjl.tools@gmail.com>; Cui, Lili <lili.cui@intel.com>
> Subject: [PATCH 6/6] x86: optimize {,V}PEXTR{D,Q} with immediate of 0
>
> Such are equivalent to simple moves, which are up to 3 bytes shorter to
> encode (and perhaps also cheaper to execute).
>
The optimization is problematic. Instead of movd/q, we should optimize to
psrldq, which has lower latency and it is exactly what GCC is doing for 0,1,2,3
in immediate.
psrldq has only 1 latency, while movd has 3 latency.
Also, I suppose the optimization related to latency should not be done in
assembler.
Thx,
Haochen
More information about the Binutils
mailing list