Page MenuHomePhabricator

[X86] Teach X86MCInstLower to swap operands of commutable instructions to enable 2-byte VEX encoding.

Authored by craig.topper on Oct 5 2019, 11:39 PM.



The 2 source operands commutable instructions are encoded in the
VEX.VVVV field and the r/m field of the MODRM byte plus the VEX.B

The VEX.B field is missing from the 2-byte VEX encoding. If the
VEX.VVVV source is 0-7 and the other register is 8-15 we can
swap them to avoid needing the VEX.B field. This works as long as
the VEX.W, VEX.mmmmm, and VEX.X fields are also not needed.

Fixes PR36706.

Diff Detail

Event Timeline

craig.topper created this revision.Oct 5 2019, 11:39 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 5 2019, 11:39 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
RKSimon accepted this revision.Oct 13 2019, 4:34 AM

LGTM with one minor query.


The need to exclude specific opcodes here is unfortunate - maybe add a comment explaining why? Maybe even put them under a separate 'no doing' case statement?

This revision is now accepted and ready to land.Oct 13 2019, 4:34 AM
This revision was automatically updated to reflect the committed changes.