From e9e16a36d9ff355dab60e4b95673bf7a0cd27e86 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 15 Sep 2010 04:33:27 +0000 Subject: [PATCH] fix rdar://8431880 - rcl/rcr with no shift amount not recognized git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113936 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/AsmParser/X86AsmParser.cpp | 10 +++++++++- test/MC/AsmParser/X86/x86_instructions.s | 11 +++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/lib/Target/X86/AsmParser/X86AsmParser.cpp b/lib/Target/X86/AsmParser/X86AsmParser.cpp index 7098c58cde9..4856cc9283c 100644 --- a/lib/Target/X86/AsmParser/X86AsmParser.cpp +++ b/lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -813,7 +813,7 @@ ParseInstruction(StringRef Name, SMLoc NameLoc, if (getLexer().is(AsmToken::EndOfStatement)) Parser.Lex(); // Consume the EndOfStatement - // FIXME: Hack to handle recognize s{hr,ar,hl} , $1. Canonicalize to + // FIXME: Hack to handle recognize s{hr,ar,hl} $1, . Canonicalize to // "shift ". if ((Name.startswith("shr") || Name.startswith("sar") || Name.startswith("shl")) && @@ -825,6 +825,14 @@ ParseInstruction(StringRef Name, SMLoc NameLoc, Operands.erase(Operands.begin() + 1); } } + + // FIXME: Hack to handle recognize "rc[lr] " -> "rcl $1, ". + if ((Name.startswith("rcl") || Name.startswith("rcr")) && + Operands.size() == 2) { + const MCExpr *One = MCConstantExpr::Create(1, getParser().getContext()); + Operands.push_back(X86Operand::CreateImm(One, NameLoc, NameLoc)); + std::swap(Operands[1], Operands[2]); + } // FIXME: Hack to handle recognize "in[bwl] ". Canonicalize it to // "inb , %al". diff --git a/test/MC/AsmParser/X86/x86_instructions.s b/test/MC/AsmParser/X86/x86_instructions.s index 4faf2e55fe1..3bd2a305044 100644 --- a/test/MC/AsmParser/X86/x86_instructions.s +++ b/test/MC/AsmParser/X86/x86_instructions.s @@ -257,3 +257,14 @@ fnstsw fnstsw %ax fnstsw %eax fnstsw %al + +// rdar://8431880 +// CHECK: rclb $1, %bl +// CHECK: rcll $1, 3735928559(%ebx,%ecx,8) +// CHECK: rcrl $1, %ecx +// CHECK: rcrl $1, 305419896 + +rcl %bl +rcll 0xdeadbeef(%ebx,%ecx,8) +rcr %ecx +rcrl 0x12345678 -- 2.34.1