HomePhabricator

[X86] .code16: temporarily set Mode32Bit when matching an instruction with the…

Authored by MaskRay on Oct 6 2020, 8:26 AM.

Description

[X86] .code16: temporarily set Mode32Bit when matching an instruction with the data32 prefix

PR47632

This allows MC to match data32 ... as one instruction instead of two (data32 without insn + insn).

The compatibility with GNU as improves: data32 ljmp will be matched as ljmpl.
data32 lgdt 4(%eax) will be matched as lgdtl (prefixes: 0x67 0x66, instead
of 0x66 0x67).

GNU as supports many other data32 *w as *l. We currently just hard code
data32 callw and data32 ljmpw. Generalizing the suffix replacement is
tricky and requires a think about the "bwlq" appending suffix rules in MatchAndEmitATTInstruction.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D88772