[X86] Don't ignore 0x66 prefix on relative jumps in 64-bit mode. Fix opcode selection...
authorCraig Topper <craig.topper@intel.com>
Mon, 13 Aug 2018 22:06:28 +0000 (22:06 +0000)
committerCraig Topper <craig.topper@intel.com>
Mon, 13 Aug 2018 22:06:28 +0000 (22:06 +0000)
commitcade635c77004ddfabe97a0bbefefcf90d322ed8
tree7b6b617cd6b25d4cdbcf54e90ce07550aef04150
parent3534874fbf71ea4fb7d26e3096f29cbfb96b7bc8
[X86] Don't ignore 0x66 prefix on relative jumps in 64-bit mode. Fix opcode selection of relative jumps in 16-bit mode. Treat jno/jo like other jcc instructions.

The behavior in 64-bit mode is different between Intel and AMD CPUs. Intel ignores the 0x66 prefix. AMD does not. objump doesn't ignore the 0x66 prefix. Since LLVM aims to match objdump behavior, we should do the same.

While I was trying to fix this I had change brtarget16/32 to use ENCODING_IW/ID instead of ENCODING_Iv to get the 0x66+REX.W case to act sort of sanely. It's still wrong, but that's a problem for another day.

The change in encoding exposed the fact that 16-bit mode disassembly of relative jumps was creating JMP_4 with a 2 byte immediate. It should have been JMP_2. From just printing you can't tell the difference, but if you dumped the encoding it wouldn't have matched what we started with.

While fixing that, it exposed that jo/jno opcodes were missing from the switch that this patch deleted and there were no test cases for them.

Fixes PR38537.

llvm-svn: 339622
llvm/lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp
llvm/test/MC/Disassembler/X86/x86-64.txt
llvm/utils/TableGen/X86RecognizableInstr.cpp