[PATCH 0/6] x86: a few more optimizations
Cui, Lili
lili.cui@intel.com
Mon Jun 17 08:09:20 GMT 2024
> APX {nf} insn forms present a number of interesting optimization
> opportunities, often mostly for size. There are a few more that I'm aware of,
> but where I'm less convinced that input code would really ever be written like
> this:
>
> 1) Quite a few operations could be converted to plain MOV. For example
>
> {nf} xor %cl, %cl
> {nf} sub %cl, %cl
> {nf} and $0, %cl
>
> can all be replaced by the much shorter
>
> mov $0, %cl
>
> 2) Certain forms of IMUL{,ZU} with a power-of-2 immediate could be
> converted to SHL. This could be beneficial even when size doesn't shrink, for
> SHL still having better latency/throughput.
>
> Thoughts?
>
These two ideas are so good that several people think that GCC should support these two conversions. Would you consider implementing these conversions in gcc?
> Plus: Since, even if leaving out the further ones above, there are quite a few
> {nf}-specific ones, I was wondering whether it would make sense to put those
> in a separate optimize_nf_encoding() function, to somewhat limit
> optimize_encoding()'s growth.
>
Agree, optimize_encoding is already big.
Thanks,
Lili.
More information about the Binutils
mailing list