diff options
author | Chris Lattner <sabre@nondot.org> | 2010-09-15 04:15:16 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-09-15 04:15:16 +0000 |
commit | 84f362d8912657bb21250a65331f797d5381e9a3 (patch) | |
tree | 023d5965deb472289e8e4fc6a377dd3e7ec29613 | |
parent | 8f777a205e4523b773ba3af3bad007d93da56a9a (diff) |
add various broken forms of fnstsw. I didn't add the %rax
version because it adds a prefix and makes even less sense
than the other broken forms. This wraps up rdar://8431422
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113932 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/X86/AsmParser/X86AsmParser.cpp | 19 | ||||
-rw-r--r-- | test/MC/AsmParser/X86/x86_instructions.s | 10 |
2 files changed, 28 insertions, 1 deletions
diff --git a/lib/Target/X86/AsmParser/X86AsmParser.cpp b/lib/Target/X86/AsmParser/X86AsmParser.cpp index c21fc7ab56..7098c58cde 100644 --- a/lib/Target/X86/AsmParser/X86AsmParser.cpp +++ b/lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -943,6 +943,25 @@ ParseInstruction(StringRef Name, SMLoc NameLoc, NameLoc, NameLoc)); } + // The assembler accepts various amounts of brokenness for fnstsw. + if (Name == "fnstsw") { + if (Operands.size() == 2 && + static_cast<X86Operand*>(Operands[1])->isReg()) { + // "fnstsw al" and "fnstsw eax" -> "fnstw" + unsigned Reg = static_cast<X86Operand*>(Operands[1])->Reg.RegNo; + if (Reg == MatchRegisterName("eax") || + Reg == MatchRegisterName("al")) { + delete Operands[1]; + Operands.pop_back(); + } + } + + // "fnstw" -> "fnstw %ax" + if (Operands.size() == 1) + Operands.push_back(X86Operand::CreateReg(MatchRegisterName("ax"), + NameLoc, NameLoc)); + } + return false; } diff --git a/test/MC/AsmParser/X86/x86_instructions.s b/test/MC/AsmParser/X86/x86_instructions.s index cd7c6e117a..4faf2e55fe 100644 --- a/test/MC/AsmParser/X86/x86_instructions.s +++ b/test/MC/AsmParser/X86/x86_instructions.s @@ -248,4 +248,12 @@ fucomi fucomi %st(2) fucomi %st(2), %st - +// CHECK: fnstsw %ax +// CHECK: fnstsw %ax +// CHECK: fnstsw %ax +// CHECK: fnstsw %ax + +fnstsw +fnstsw %ax +fnstsw %eax +fnstsw %al |