x86: Swap destination/source to encode VEX only if possible
authorH.J. Lu <hjl.tools@gmail.com>
Thu, 13 Sep 2018 13:12:31 +0000 (06:12 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Thu, 13 Sep 2018 13:12:31 +0000 (06:12 -0700)
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.

gas/ChangeLog
gas/config/tc-i386.c

index 7a82555a415ff23faed8d3e74785cbd7eb2ba559..fc17226bb0cc77f928c9780cea2e265bbc31c444 100644 (file)
@@ -1,3 +1,8 @@
+2018-09-13  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * 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  <jbeulich@suse.com>
 
        * config/tc-i386.c (operand_size_match): Also deal with three
index 2bff48a778af7ce1e1baeb4bb0ca51d2e8e9fe89..40b458333fe32a2b34f4b759eec8a5354d0687ad 100644 (file)
@@ -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])
This page took 0.030959 seconds and 4 git commands to generate.