]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
x86: optimize left-shift-by-1
authorJan Beulich <jbeulich@suse.com>
Fri, 21 Jun 2024 12:39:52 +0000 (14:39 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 21 Jun 2024 12:39:52 +0000 (14:39 +0200)
commitfa2c4239f1ab70b198f6d404f727d0d744221595
tree36037743ae009cc65aab80b416dab9517431104a
parent87860ef6f4650d513530af4cb4e3e85a863139cf
x86: optimize left-shift-by-1

These can be replaced by adds when acting on a register operand.

While for the scalar forms there's no gain in encoding size, ADD
generally has higher throughput than SHL. EFLAGS set by ADD are a
superset of those set by SHL (AF in particular is undefined there).

For the SIMD cases the transformation also reduced code size, by
eliminating the 1-byte immediate from the resulting encoding. Note
that this transformation is not applied by gcc13 (according to my
observations), so would - as of now - even improve compiler generated
code.
gas/config/tc-i386.c
gas/testsuite/gas/i386/optimize-2.d
gas/testsuite/gas/i386/optimize-2.s
gas/testsuite/gas/i386/optimize-2b.d
gas/testsuite/gas/i386/x86-64-optimize-1.d
gas/testsuite/gas/i386/x86-64-optimize-1.s
opcodes/i386-opc.tbl
opcodes/i386-tbl.h