Index: lib/Target/Mips/AsmParser/MipsAsmParser.cpp =================================================================== --- lib/Target/Mips/AsmParser/MipsAsmParser.cpp +++ lib/Target/Mips/AsmParser/MipsAsmParser.cpp @@ -200,6 +200,7 @@ bool parseSetNoDspDirective(); bool parseSetReorderDirective(); bool parseSetNoReorderDirective(); + bool parseSetMips16Directive(); bool parseSetNoMips16Directive(); bool parseSetFpDirective(); bool parseSetPopDirective(); @@ -2747,14 +2748,32 @@ return false; } +bool MipsAsmParser::parseSetMips16Directive() { + Parser.Lex(); // Eat "mips16". + + // If this is not the end of the statement, report an error. + if (getLexer().isNot(AsmToken::EndOfStatement)) { + reportParseError("unexpected token, expected end of statement"); + return false; + } + + setFeatureBits(Mips::FeatureMips16, "mips16"); + getTargetStreamer().emitDirectiveSetMips16(); + Parser.Lex(); // Consume the EndOfStatement. + return false; +} + bool MipsAsmParser::parseSetNoMips16Directive() { - Parser.Lex(); + Parser.Lex(); // Eat "nomips16". + // If this is not the end of the statement, report an error. if (getLexer().isNot(AsmToken::EndOfStatement)) { reportParseError("unexpected token, expected end of statement"); return false; } - // For now do nothing. + + clearFeatureBits(Mips::FeatureMips16, "mips16"); + getTargetStreamer().emitDirectiveSetNoMips16(); Parser.Lex(); // Consume the EndOfStatement. return false; } @@ -2904,9 +2923,6 @@ case Mips::FeatureMicroMips: getTargetStreamer().emitDirectiveSetMicroMips(); break; - case Mips::FeatureMips16: - getTargetStreamer().emitDirectiveSetMips16(); - break; case Mips::FeatureMips1: selectArch("mips1"); getTargetStreamer().emitDirectiveSetMips1(); @@ -3095,7 +3111,7 @@ } else if (Tok.getString() == "nomacro") { return parseSetNoMacroDirective(); } else if (Tok.getString() == "mips16") { - return parseSetFeature(Mips::FeatureMips16); + return parseSetMips16Directive(); } else if (Tok.getString() == "nomips16") { return parseSetNoMips16Directive(); } else if (Tok.getString() == "nomicromips") { Index: test/MC/Mips/set-mips16-directive.s =================================================================== --- /dev/null +++ test/MC/Mips/set-mips16-directive.s @@ -0,0 +1,10 @@ +# RUN: llvm-mc %s -arch=mips | FileCheck %s +# FIXME: Update this test when we have a more mature implementation of Mips16 in the IAS. + +.text +.set mips16 +.set nomips16 + +# CHECK: .text +# CHECK: .set mips16 +# CHECK: .set nomips16