From: H.J. Lu Date: Thu, 13 Sep 2018 13:12:31 +0000 (-0700) Subject: x86: Swap destination/source to encode VEX only if possible X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=79f0fa25b95fd82122ee76d61fded661cc3ece87;p=binutils-gdb.git x86: Swap destination/source to encode VEX only if possible When encoding VEX, we can swap destination and source only if there are more than 1 register operand. * config/tc-i386.c (build_vex_prefix): Swap destination and source only if there are more than 1 register operand. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index 7a82555a415..fc17226bb0c 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2018-09-13 H.J. Lu + + * config/tc-i386.c (build_vex_prefix): Swap destination and + source only if there are more than 1 register operand. + 2018-09-13 Jan Beulich * config/tc-i386.c (operand_size_match): Also deal with three diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 2bff48a778a..40b458333fe 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -3364,9 +3364,10 @@ build_vex_prefix (const insn_template *t) else register_specifier = 0xf; - /* Use 2-byte VEX prefix by swapping destination and source - operand. */ - if (i.vec_encoding != vex_encoding_vex3 + /* Use 2-byte VEX prefix by swapping destination and source operand + if there are more than 1 register operand. */ + if (i.reg_operands > 1 + && i.vec_encoding != vex_encoding_vex3 && i.dir_encoding == dir_encoding_default && i.operands == i.reg_operands && operand_type_equal (&i.types[0], &i.types[i.operands - 1])