V2 [PATCH] x86: Rename VexOpcode to OpcodePrefix

Jan Beulich jbeulich@suse.com
Wed Oct 14 12:38:51 GMT 2020


On 14.10.2020 04:21, H.J. Lu via Binutils wrote:
> This is the patch I am checking in.
> 
> gas/
> 
> * config/tc-i386.c (build_vex_prefix): Replace vexopcode with
> opcodeprefix.
> (build_evex_prefix): Likewise.
> (is_any_vex_encoding): Don't check vexopcode.
> (output_insn): Handle opcodeprefix.
> 
> opcodes/
> 
> * i386-gen.c (opcode_modifiers): Replace VexOpcode with
> OpcodePrefix.
> * i386-opc.h (VexOpcode): Renamed to ...
> (OpcodePrefix): This.
> (PREFIX_NONE): New.
> (PREFIX_0X66): Likewise.
> (PREFIX_0XF2): Likewise.
> (PREFIX_0XF3): Likewise.

Why 0X66 etc and not just 66?

> * i386-opc.tbl (Prefix_0X66): New.
> (Prefix_0XF2): Likewise.
> (Prefix_0XF3): Likewise.
> Replace VexOpcode= with OpcodePrefix=.  Use Prefix_0X66 on xorpd.
> Use Prefix_0XF3 on cvtdq2pd.  Use Prefix_0XF2 on cvtpd2dq.

Is this an arbitrary choice? Such things would be helpful to be
spelled out in a little bit of a description, not just for reviewing
now, but also when later running into this commit. If so, I expect
there'll be a full run through all opcodes to replace the current
model with the new one?

I'd also like to note that your "Use prefix ... on ..." isn't
actually correct, as you only changed the non-SSE2AVX encodings.

(quoting the actual patch)

>--- a/opcodes/i386-opc.h
>+++ b/opcodes/i386-opc.h
>@@ -561,6 +561,16 @@ enum
> #define VEXW1	2
> #define VEXWIG	3
>   VexW,
>+  /* Regular opcode prefix:
>+     0: None
>+     1: Add 0x66 opcode prefix.
>+     2: Add 0xf2 opcode prefix.
>+     3: Add 0xf3 opcode prefix.
>+   */
>+#define PREFIX_NONE	0
>+#define PREFIX_0X66	1
>+#define PREFIX_0XF2	2
>+#define PREFIX_0XF3	3
>   /* VEX opcode prefix:
>      0: VEX 0x0F opcode prefix.
>      1: VEX 0x0F38 opcode prefix.
>@@ -575,7 +585,7 @@ enum
> #define XOP08		3
> #define XOP09		4
> #define XOP0A		5
>-  VexOpcode,
>+  OpcodePrefix,

I don't think this is a helpful repurposing. Instead I was
thinking to encode 0F, 0F38, and 0F3A for non-VEX the same way,
re-using the encodings here. 66, F3, and F2 as a result would
need separate encoding.

I also think it would have been more logical (because of the
way VEX/XOP/EVEX encode them) if it were

#define PREFIX_NONE	0
#define PREFIX_66	1
#define PREFIX_F3	2
#define PREFIX_F2	3

Jan


More information about the Binutils mailing list