x86-64: make "length_vex" also account for VEX.B use by register operand
authorJan Beulich <jbeulich@suse.com>
Tue, 7 Jun 2022 07:17:25 +0000 (09:17 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 7 Jun 2022 07:17:25 +0000 (09:17 +0200)
commit76e3d60c16dc5ea31d2e83aff9735d53a0a275d1
tree591123830eb9c81f3a9e840c67090469bbf7aee9
parent6dd194e2ce201d057e4faaecc36d19e0d3695f57
x86-64: make "length_vex" also account for VEX.B use by register operand

The length attribute ought to be "the (bounding maximum) length of an
instruction" according to the comment next to its definition. A register
operand encoded using the ModR/M.rm field will additionally use VEX.B
for encoding the highest bit of the register number. Hence for the high
8 GPR registers as well as the [xy]mm{8..15} ones 3-byte VEX encoding
may be needed. Since it isn't known to the function calculating the
length which register goes where in the insn encoding, be conservative
and assume a 3-byte VEX prefix whenever any such register operand is
present and there's no memory operand.

gcc/

* config/i386/i386.cc (ix86_attr_length_vex_default): Take REX.B
into account for reg-only insns.
gcc/config/i386/i386.cc