1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00

[X86] When parsing rounding mode operands, provide a proper end location so we don't crash when trying to print an error message using it.

llvm-svn: 321930
This commit is contained in:
Craig Topper 2018-01-06 06:41:07 +00:00
parent c07cea6d51
commit f8e5fe3847
2 changed files with 9 additions and 5 deletions

View File

@ -825,7 +825,7 @@ private:
bool ParseIntelDotOperator(IntelExprStateMachine &SM, SMLoc &End);
unsigned IdentifyIntelInlineAsmOperator(StringRef Name);
unsigned ParseIntelInlineAsmOperator(unsigned OpKind);
std::unique_ptr<X86Operand> ParseRoundingModeOp(SMLoc Start, SMLoc End);
std::unique_ptr<X86Operand> ParseRoundingModeOp(SMLoc Start);
bool ParseIntelNamedOperator(StringRef Name, IntelExprStateMachine &SM);
void RewriteIntelExpression(IntelExprStateMachine &SM, SMLoc Start,
SMLoc End);
@ -1595,7 +1595,7 @@ bool X86AsmParser::ParseIntelInlineAsmIdentifier(const MCExpr *&Val,
//ParseRoundingModeOp - Parse AVX-512 rounding mode operand
std::unique_ptr<X86Operand>
X86AsmParser::ParseRoundingModeOp(SMLoc Start, SMLoc End) {
X86AsmParser::ParseRoundingModeOp(SMLoc Start) {
MCAsmParser &Parser = getParser();
const AsmToken &Tok = Parser.getTok();
// Eat "{" and mark the current place.
@ -1616,6 +1616,7 @@ X86AsmParser::ParseRoundingModeOp(SMLoc Start, SMLoc End) {
Parser.Lex(); // Eat the sae
if (!getLexer().is(AsmToken::RCurly))
return ErrorOperand(Tok.getLoc(), "Expected } at this point");
SMLoc End = Tok.getEndLoc();
Parser.Lex(); // Eat "}"
const MCExpr *RndModeOp =
MCConstantExpr::create(rndMode, Parser.getContext());
@ -1794,7 +1795,7 @@ std::unique_ptr<X86Operand> X86AsmParser::ParseIntelOperand() {
// Rounding mode operand.
if (getSTI().getFeatureBits()[X86::FeatureAVX512] &&
getLexer().is(AsmToken::LCurly))
return ParseRoundingModeOp(Start, End);
return ParseRoundingModeOp(Start);
// Register operand.
unsigned RegNo = 0;
@ -1895,9 +1896,9 @@ std::unique_ptr<X86Operand> X86AsmParser::ParseATTOperand() {
return X86Operand::CreateImm(Val, Start, End);
}
case AsmToken::LCurly:{
SMLoc Start = Parser.getTok().getLoc(), End;
SMLoc Start = Parser.getTok().getLoc();
if (getSTI().getFeatureBits()[X86::FeatureAVX512])
return ParseRoundingModeOp(Start, End);
return ParseRoundingModeOp(Start);
return ErrorOperand(Start, "Unexpected '{' in expression");
}
}

View File

@ -8,3 +8,6 @@ vfmsub213ps %zmm8, %zmm8, %zmm8{%k2} {rn-sae}
// ERR: Expected an op-mask register at this point
vfmsub213ps %zmm8, %zmm8, %zmm8 {rn-sae}
// ERR: invalid operand for instruction
cvtsd2sil {rn-sae}, %xmm1, %eax