[PATCH 4/4] x86: update comments ahead of build_*_prefix()

Jan Beulich jbeulich@suse.com
Fri Aug 21 13:09:11 GMT 2026


The one that was there ahead of build_apx_evex_prefix() really belongs
ahead of build_evex_prefix(), in modernized form.
---
Alternatively we could consistently omit these layout details, which only
repeat what the manuals say.

--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -4370,8 +4370,15 @@ install_template (const insn_template *t
   i.opcode_length = l;
 }
 
-/* Build the VEX prefix.  */
+/* Build the VEX prefix (2- or 3-byte)
 
+   | C5h |
+   | `R3 | `vvvv | L | pp |
+
+   | C4h |
+   | `R3 | `X3 | `B3 | mmmmm |
+   | W | `vvvv | L | pp |
+*/
 static void
 build_vex_prefix (const insn_template *t)
 {
@@ -4628,8 +4635,12 @@ get_broadcast_bytes (const insn_template
   return bytes;
 }
 
-/* Build the EVEX prefix.  */
-
+/* Build the EVEX prefix (4-byte) for evex insn
+   | 62h |
+   | `R3 | `X3 | `B3 | `R4 | B4 | mmm |
+   | W | `vvvv | U | pp |
+   | z | L'L | b | `V4 | aaa |
+*/
 static void
 build_evex_prefix (void)
 {
@@ -4814,7 +4825,7 @@ build_evex_prefix (void)
 
 /* Build (2 bytes) rex2 prefix.
    | D5h |
-   | m | R4 X4 B4 | W R X B |
+   | m | R4 X4 B4 | W R3 X3 B3 |
 
    Rex2 reuses i.vex as they both encode i.tm.opcode_space in their prefixes.
  */
@@ -4829,11 +4840,20 @@ build_rex2_prefix (void)
 		    | ((i.rex | i.prefix[REX_PREFIX]) & 0xf));
 }
 
-/* Build the EVEX prefix (4-byte) for evex insn
+/* Build the EVEX prefix (4-byte) for APX insn.  Apart from the basic form
+   (see build_evex_prefix()) there are two new forms:
+
+   | 62h |
+   | `R3 | `X3 | `B3 | `R4 | B4 | mmm |
+   | W | `vvvv | `X4 | pp |
+   | 00 | L | ND | `V4 | NF | 00 |
+
+   and for NCI:
+
    | 62h |
-   | `R`X`B`R' | B'mmm |
-   | W | v`v`v`v | `x' | pp |
-   | z| L'L | b | `v | aaa |
+   | `R3 | `X3 | `B3 | `R4 | B4 | mmm |
+   | W | OSZC | `X4 | pp |
+   | 0000 | SC3 SC2 SC1 SC0 |
 */
 static bool
 build_apx_evex_prefix (bool force_nd)



More information about the Binutils mailing list