Index: docs/LangRef.rst =================================================================== --- docs/LangRef.rst +++ docs/LangRef.rst @@ -3239,9 +3239,10 @@ """""""""""""""" After a potential prefix comes constraint code, or codes. -A Constraint Code is either a single letter (e.g. "``r``"), a "``^``" character -followed by two letters (e.g. "``^wc``"), or "``{``" register-name "``}``" -(e.g. "``{eax}``"). +A Constraint Code is either a single letter (e.g. "``r``"), a single letter, +followed by arbitrary digits (e.g. "``A32``", a "``^``" character +followed by any number of letters and digits (e.g. "``^wc4``"), +or "``{``" register-name "``}``" (e.g. "``{eax}``"). The one and two letter constraint codes are typically chosen to be the same as GCC's constraint codes. Index: lib/IR/InlineAsm.cpp =================================================================== --- lib/IR/InlineAsm.cpp +++ lib/IR/InlineAsm.cpp @@ -181,14 +181,24 @@ pCodes = &multipleAlternatives[multipleAlternativeIndex].Codes; ++I; } else if (*I == '^') { - // Multi-letter constraint - // FIXME: For now assuming these are 2-character constraints. - pCodes->push_back(std::string(I+1, I+3)); - I += 3; + // Multi-letter constraint: any number of letters and digits + ++I; + std::string code(I, I+1); + ++I; + while (isalnum(static_cast(*I))) { + code += *I; + ++I; + } + pCodes->push_back(code); } else { - // Single letter constraint. - pCodes->push_back(std::string(I, I+1)); + // Single letter constraint, or single letter with trailing digits + std::string code(I, I+1); ++I; + while (isdigit(static_cast(*I))) { + code += *I; + ++I; + } + pCodes->push_back(code); } }