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

llvm-svn: 114532
This commit is contained in:
Chris Lattner 2010-09-22 05:05:16 +00:00
parent 9dfd2e354e
commit 2bb9504d1a
2 changed files with 36 additions and 30 deletions

View File

@ -700,44 +700,45 @@ static unsigned getBinOpPrecedence(AsmToken::TokenKind K,
Kind = MCBinaryExpr::LOr; Kind = MCBinaryExpr::LOr;
return 1; return 1;
// Low Precedence: +, -, ==, !=, <>, <, <=, >, >=
case AsmToken::Plus: // Low Precedence: |, &, ^
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: |, &, ^
// //
// FIXME: gas seems to support '!' as an infix operator? // FIXME: gas seems to support '!' as an infix operator?
case AsmToken::Pipe: case AsmToken::Pipe:
Kind = MCBinaryExpr::Or; Kind = MCBinaryExpr::Or;
return 3; return 2;
case AsmToken::Caret: case AsmToken::Caret:
Kind = MCBinaryExpr::Xor; Kind = MCBinaryExpr::Xor;
return 3; return 2;
case AsmToken::Amp: case AsmToken::Amp:
Kind = MCBinaryExpr::And; 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; return 3;
// Highest Precedence: *, /, %, <<, >> // 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) fcmovae %st(1), %st(0) // CHECK: fcmovnb %st(1), %st(0)
fcmova %st(1), %st(0) // CHECK: fcmovnbe %st(1), %st(0) fcmova %st(1), %st(0) // CHECK: fcmovnbe %st(1), %st(0)
// rdar://8456417
.byte 88 + 1 & 15 // CHECK: .byte 9