fix rdar://8456417 - llvm-mc can't do basic math

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114532 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2010-09-22 05:05:16 +00:00
parent c2b942acf6
commit f7d4da0c1d
2 changed files with 36 additions and 30 deletions

View File

@ -700,44 +700,45 @@ static unsigned getBinOpPrecedence(AsmToken::TokenKind K,
Kind = MCBinaryExpr::LOr;
return 1;
// Low Precedence: +, -, ==, !=, <>, <, <=, >, >=
case AsmToken::Plus:
Kind = MCBinaryExpr::Add;
return 2;
case AsmToken::Minus:
Kind = MCBinaryExpr::Sub;
return 2;
case AsmToken::EqualEqual:
Kind = MCBinaryExpr::EQ;
return 2;
case AsmToken::ExclaimEqual:
case AsmToken::LessGreater:
Kind = MCBinaryExpr::NE;
return 2;
case AsmToken::Less:
Kind = MCBinaryExpr::LT;
return 2;
case AsmToken::LessEqual:
Kind = MCBinaryExpr::LTE;
return 2;
case AsmToken::Greater:
Kind = MCBinaryExpr::GT;
return 2;
case AsmToken::GreaterEqual:
Kind = MCBinaryExpr::GTE;
return 2;
// Intermediate Precedence: |, &, ^
// Low Precedence: |, &, ^
//
// FIXME: gas seems to support '!' as an infix operator?
case AsmToken::Pipe:
Kind = MCBinaryExpr::Or;
return 3;
return 2;
case AsmToken::Caret:
Kind = MCBinaryExpr::Xor;
return 3;
return 2;
case AsmToken::Amp:
Kind = MCBinaryExpr::And;
return 2;
// Intermediate Precedence: +, -, ==, !=, <>, <, <=, >, >=
case AsmToken::Plus:
Kind = MCBinaryExpr::Add;
return 3;
case AsmToken::Minus:
Kind = MCBinaryExpr::Sub;
return 3;
case AsmToken::EqualEqual:
Kind = MCBinaryExpr::EQ;
return 3;
case AsmToken::ExclaimEqual:
case AsmToken::LessGreater:
Kind = MCBinaryExpr::NE;
return 3;
case AsmToken::Less:
Kind = MCBinaryExpr::LT;
return 3;
case AsmToken::LessEqual:
Kind = MCBinaryExpr::LTE;
return 3;
case AsmToken::Greater:
Kind = MCBinaryExpr::GT;
return 3;
case AsmToken::GreaterEqual:
Kind = MCBinaryExpr::GTE;
return 3;
// Highest Precedence: *, /, %, <<, >>

View File

@ -336,3 +336,8 @@ fcmovna %st(1), %st(0) // CHECK: fcmovbe %st(1), %st(0)
fcmovae %st(1), %st(0) // CHECK: fcmovnb %st(1), %st(0)
fcmova %st(1), %st(0) // CHECK: fcmovnbe %st(1), %st(0)
// rdar://8456417
.byte 88 + 1 & 15 // CHECK: .byte 9