summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2014-01-08 12:58:12 +0000
committerDavid Woodhouse <dwmw2@infradead.org>2014-01-08 12:58:12 +0000
commit975fe2cfc34c605746a644e96ff2cb96a7855131 (patch)
tree57007ef4666f01a8a806cdffa18d5e7d448c5b4a /lib
parentd7ae82f8f5091fc2467419f19e28fc9f1bb16820 (diff)
downloadllvm-975fe2cfc34c605746a644e96ff2cb96a7855131.tar.gz
llvm-975fe2cfc34c605746a644e96ff2cb96a7855131.tar.bz2
llvm-975fe2cfc34c605746a644e96ff2cb96a7855131.tar.xz
[x86] Fix JCXZ,JECXZ_32 for 16-bit mode
JCXZ should have the 0x67 prefix only if we're in 32-bit mode, so make that appropriately conditional. And JECXZ needs the prefix instead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198757 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp b/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp
index e44574c31e..d3879e6c4c 100644
--- a/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp
+++ b/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp
@@ -1161,7 +1161,11 @@ void X86MCCodeEmitter::EmitOpcodePrefix(uint64_t TSFlags, unsigned &CurByte,
// Emit the address size opcode prefix as needed.
bool need_address_override;
- if (TSFlags & X86II::AdSize) {
+ // The AdSize prefix is only for 32-bit and 64-bit modes; in 16-bit mode we
+ // need the address override only for JECXZ instead. Since it's only one
+ // instruction, we special-case it rather than introducing an AdSize16 bit.
+ if ((!is16BitMode() && TSFlags & X86II::AdSize) ||
+ (is16BitMode() && MI.getOpcode() == X86::JECXZ_32)) {
need_address_override = true;
} else if (MemOperand == -1) {
need_address_override = false;