[PATCH] x86: suppress LEA optimization in a specific 16-bit case

H.J. Lu hjl.tools@gmail.com
Wed Jun 9 12:19:24 GMT 2021


On Wed, Jun 9, 2021 at 12:03 AM Jan Beulich <jbeulich@suse.com> wrote:
>
> In 16-bit mode a 16-bit address size LEA with a 16-bit displacement and
> a 32-bit destination is shorter to encode than the corresponding MOV.
> Commit fe134c656991 ("x86: optimize LEA")'s promise was to only do the
> transformation when the encoding size wouldn't grow, i.e. it did go a
> little too far. Restrict this specific case of the transformation to
> -O2.
>
> gas/
> 2021-06-XX  Jan Beulich  <jbeulich@suse.com>
>
>         * config/tc-i386.c (optimize_encoding): Suppress LEA conversion
>         when it would grow code size in 16-bit mode.
>         * testsuite/gas/i386/lea16-optimize.d: Adjust expectations.
>         * testsuite/gas/i386/lea16-optimize2.d: New.
>         * testsuite/gas/i386/i386.exp: Run new test.
> ---
> The choice to keep the optimization at -O2 is pretty arbitrary; I'd be
> okay to suppress the adjustment unconditionally (at which point the new
> test case would go away again).
>

OK.

Thanks.

-- 
H.J.


More information about the Binutils mailing list