From: Chris Lattner Date: Mon, 6 Sep 2010 23:51:44 +0000 (+0000) Subject: "sldt " is ambiguous in 64-bit mode, but should X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=c5cebeb3cb44a3fd0aaee956431159757ee47914;p=oota-llvm.git "sldt " is ambiguous in 64-bit mode, but should always be disambiguated as sldtw. sldtw and sldtq with a mem operands have the same effect, but sldtw is more compact. Force it to sldtw, resolving rdar://8017530 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113186 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/X86/AsmParser/X86AsmParser.cpp b/lib/Target/X86/AsmParser/X86AsmParser.cpp index 19d9470639d..e20f1e3895a 100644 --- a/lib/Target/X86/AsmParser/X86AsmParser.cpp +++ b/lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -819,6 +819,13 @@ ParseInstruction(StringRef Name, SMLoc NameLoc, Operands.push_back(X86Operand::CreateReg(Op->getReg(), Op->getStartLoc(), Op->getEndLoc())); } + + // 'sldt ' can be encoded with either sldtw or sldtq with the same + // effect (both store to a 16-bit mem). Force to sldtw to avoid ambiguity + // errors, since its encoding is the most compact. + if (Name == "sldt" && Operands.size() == 2 && + static_cast(Operands[1])->isMem()) + Operands[0] = X86Operand::CreateToken("sldtw", NameLoc); return false; } diff --git a/test/MC/AsmParser/X86/x86_instructions.s b/test/MC/AsmParser/X86/x86_instructions.s index 308dc09586d..f27f2433d3c 100644 --- a/test/MC/AsmParser/X86/x86_instructions.s +++ b/test/MC/AsmParser/X86/x86_instructions.s @@ -178,3 +178,6 @@ inb $161, %al // CHECK: pushq $1 push $1 +// rdar://8017530 +// CHECK: sldtw 4 +sldt 4