@@ -1497,8 +1497,6 @@ static unsigned getDarwinBinOpPrecedence(AsmToken::TokenKind K,
14971497 return 1 ;
14981498
14991499 // Low Precedence: |, &, ^
1500- //
1501- // FIXME: gas seems to support '!' as an infix operator?
15021500 case AsmToken::Pipe:
15031501 Kind = MCBinaryExpr::Or;
15041502 return 2 ;
@@ -1559,7 +1557,8 @@ static unsigned getDarwinBinOpPrecedence(AsmToken::TokenKind K,
15591557 }
15601558}
15611559
1562- static unsigned getGNUBinOpPrecedence (AsmToken::TokenKind K,
1560+ static unsigned getGNUBinOpPrecedence (const MCAsmInfo &MAI,
1561+ AsmToken::TokenKind K,
15631562 MCBinaryExpr::Opcode &Kind,
15641563 bool ShouldUseLogicalShr) {
15651564 switch (K) {
@@ -1603,12 +1602,18 @@ static unsigned getGNUBinOpPrecedence(AsmToken::TokenKind K,
16031602 Kind = MCBinaryExpr::Sub;
16041603 return 4 ;
16051604
1606- // High Intermediate Precedence: |, &, ^
1605+ // High Intermediate Precedence: |, !, &, ^
16071606 //
1608- // FIXME: gas seems to support '!' as an infix operator?
16091607 case AsmToken::Pipe:
16101608 Kind = MCBinaryExpr::Or;
16111609 return 5 ;
1610+ case AsmToken::Exclaim:
1611+ // Hack to support ARM compatible aliases (implied 'sp' operand in 'srs*'
1612+ // instructions like 'srsda #31!') and not parse ! as an infix operator.
1613+ if (MAI.getCommentString () == " @" )
1614+ return 0 ;
1615+ Kind = MCBinaryExpr::OrNot;
1616+ return 5 ;
16121617 case AsmToken::Caret:
16131618 Kind = MCBinaryExpr::Xor;
16141619 return 5 ;
@@ -1639,7 +1644,7 @@ unsigned AsmParser::getBinOpPrecedence(AsmToken::TokenKind K,
16391644 MCBinaryExpr::Opcode &Kind) {
16401645 bool ShouldUseLogicalShr = MAI.shouldUseLogicalShr ();
16411646 return IsDarwin ? getDarwinBinOpPrecedence (K, Kind, ShouldUseLogicalShr)
1642- : getGNUBinOpPrecedence (K, Kind, ShouldUseLogicalShr);
1647+ : getGNUBinOpPrecedence (MAI, K, Kind, ShouldUseLogicalShr);
16431648}
16441649
16451650// / Parse all binary operators with precedence >= 'Precedence'.
0 commit comments