aboutsummaryrefslogtreecommitdiff
path: root/gas/config
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2021-06-10 12:39:08 +0200
committerJan Beulich <jbeulich@suse.com>2021-06-10 12:39:08 +0200
commit7772f16880afc636b43184f443d173ec93302242 (patch)
treedf018a13c360d06797e72505d1acbb995b55c1dc /gas/config
parent4bdd1a062098b6ba5f59ce1fcd15ef654df648b2 (diff)
downloadgdb-7772f16880afc636b43184f443d173ec93302242.zip
gdb-7772f16880afc636b43184f443d173ec93302242.tar.gz
gdb-7772f16880afc636b43184f443d173ec93302242.tar.bz2
x86: suppress LEA optimization in a specific 16-bit case
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.
Diffstat (limited to 'gas/config')
-rw-r--r--gas/config/tc-i386.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 80b7098..47c12b9 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -4140,6 +4140,13 @@ optimize_encoding (void)
? i.op[1].regs->reg_type.bitfield.dword
: i.op[1].regs->reg_type.bitfield.word)))
return;
+ /* In 16-bit mode converting LEA with 16-bit addressing and a 32-bit
+ destination is going to grow encoding size. */
+ else if (flag_code == CODE_16BIT
+ && (optimize <= 1 || optimize_for_space)
+ && !i.prefix[ADDR_PREFIX]
+ && i.op[1].regs->reg_type.bitfield.dword)
+ return;
else
{
i.tm.base_opcode = 0xb8;