summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-09-06 23:51:44 +0000
committerChris Lattner <sabre@nondot.org>2010-09-06 23:51:44 +0000
commit7ece716da2061bd01dcaf29e8e384f1c0722bf8a (patch)
tree4bb7234f11580767bc0dc9e5298bc0c4011d0f80
parent25f9ea6f0a18f2c153456e4dc98e6e6748cd63ac (diff)
downloadbcm5719-llvm-7ece716da2061bd01dcaf29e8e384f1c0722bf8a.tar.gz
bcm5719-llvm-7ece716da2061bd01dcaf29e8e384f1c0722bf8a.zip
"sldt <mem>" 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 llvm-svn: 113186
-rw-r--r--llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp7
-rw-r--r--llvm/test/MC/AsmParser/X86/x86_instructions.s3
2 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
index 19d9470639d..e20f1e3895a 100644
--- a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ b/llvm/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 <mem>' 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<X86Operand*>(Operands[1])->isMem())
+ Operands[0] = X86Operand::CreateToken("sldtw", NameLoc);
return false;
}
diff --git a/llvm/test/MC/AsmParser/X86/x86_instructions.s b/llvm/test/MC/AsmParser/X86/x86_instructions.s
index 308dc09586d..f27f2433d3c 100644
--- a/llvm/test/MC/AsmParser/X86/x86_instructions.s
+++ b/llvm/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
OpenPOWER on IntegriCloud