Skip to content

Commit cab3174

Browse files
author
git apple-llvm automerger
committed
Merge commit '91a55cf5adbe' from llvm.org/main into next
2 parents 10a04e4 + 91a55cf commit cab3174

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,10 @@ static int readPrefixes(struct InternalInstruction *insn) {
284284
// it's not mandatory prefix
285285
// 3. if (nextByte >= 0x40 && nextByte <= 0x4f) it's REX and we need
286286
// 0x0f exactly after it to be mandatory prefix
287-
if (isREX(insn, nextByte) || nextByte == 0x0f || nextByte == 0x66)
287+
// 4. if (nextByte == 0xd5) it's REX2 and we need
288+
// 0x0f exactly after it to be mandatory prefix
289+
if (isREX(insn, nextByte) || isREX2(insn, nextByte) || nextByte == 0x0f ||
290+
nextByte == 0x66)
288291
// The last of 0xf2 /0xf3 is mandatory prefix
289292
insn->mandatoryPrefix = byte;
290293
insn->repeatPrefix = byte;

llvm/test/MC/Disassembler/X86/apx/rex2-format.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
# INTEL: movsxd r17, r16d
2222
0xd5,0x58,0x63,0xc8
2323

24-
# ATT: rep
25-
# ATT-SAME: popcntl %r16d, %r17d
26-
# INTEL: rep
27-
# INTEL-SAME: popcnt r17d, r16d
24+
# ATT-NOT: rep
25+
# ATT: popcntl %r16d, %r17d
26+
# INTEL-NOT: rep
27+
# INTEL: popcnt r17d, r16d
2828
0xf3,0xd5,0xd0,0xb8,0xc8
2929

3030
## MRMSrcRegCC

0 commit comments

Comments
 (0)