[PATCH 1/4] x86/APX: handle EVEX.V4 in build_evex_prefix()

Jan Beulich <[email protected]>
Newsgroups gmane.comp.gnu.binutils
Message-ID <[email protected]>
There's no need to defer to the more expensive build_apx_evex_prefix().
This way is_apx_evex_encoding() ends up simpler / cheaper as well.

--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -4547,9 +4547,7 @@ is_any_vex_encoding (const insn_template
 static INLINE bool
 is_apx_evex_encoding (void)
 {
-  return i.rex2 || i.tm.opcode_space == SPACE_MAP4 || pp.has_nf
-    || (i.vex.register_specifier
-	&& (i.vex.register_specifier->reg_flags & RegRex2));
+  return i.rex2 || i.tm.opcode_space == SPACE_MAP4 || pp.has_nf;
 }
 
 static INLINE bool
@@ -4649,7 +4647,7 @@ build_evex_prefix (void)
 	register_specifier += 8;
       /* The upper 16 registers are encoded in the fourth byte of the
 	 EVEX prefix.  */
-      if (!(i.vex.register_specifier->reg_flags & RegVRex))
+      if (!(i.vex.register_specifier->reg_flags & (RegVRex | RegRex2)))
 	i.vex.bytes[3] = 0x8;
       register_specifier = ~register_specifier & 0xf;
     }
@@ -4879,9 +4877,6 @@ build_apx_evex_prefix (bool force_nd)
       gas_assert (i.rm.mode != 3);
       i.vex.bytes[2] &= ~0x04;
     }
-  if (i.vex.register_specifier
-      && i.vex.register_specifier->reg_flags & RegRex2)
-    i.vex.bytes[3] &= ~0x08;
 
   /* Encode the NDD bit of the instruction promoted from the legacy
      space. ZU shares the same bit with NDD.  */
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.