diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp index 1f045ac1711f..36075227b710 100644 --- a/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/llvm/lib/MC/MCParser/AsmParser.cpp @@ -783,8 +783,13 @@ bool AsmParser::ParseStatement() { return false; } + // Canonicalize the opcode to lower case. + SmallString<128> Opcode; + for (unsigned i = 0, e = IDVal.size(); i != e; ++i) + Opcode.push_back(tolower(IDVal[i])); + SmallVector ParsedOperands; - bool HadError = getTargetParser().ParseInstruction(IDVal, IDLoc, + bool HadError = getTargetParser().ParseInstruction(Opcode.str(), IDLoc, ParsedOperands); if (!HadError && Lexer.isNot(AsmToken::EndOfStatement)) HadError = TokError("unexpected token in argument list"); diff --git a/llvm/test/MC/AsmParser/X86/x86_instructions.s b/llvm/test/MC/AsmParser/X86/x86_instructions.s index 16a80460e809..4bc8a4bb3a84 100644 --- a/llvm/test/MC/AsmParser/X86/x86_instructions.s +++ b/llvm/test/MC/AsmParser/X86/x86_instructions.s @@ -146,3 +146,8 @@ fadd %st(7) // CHECK: leal 0, %eax leal 0, %eax + +// rdar://7986634 - Insensitivity on opcodes. +// CHECK: int3 +INT3 +