From f7d4da0c1dcdac3941fe440982bce19706541629 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 22 Sep 2010 05:05:16 +0000 Subject: [PATCH] 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 --- lib/MC/MCParser/AsmParser.cpp | 43 ++++++++++++------------ test/MC/AsmParser/X86/x86_instructions.s | 5 +++ 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp index 84606bc3104..ffd5df1a238 100644 --- a/lib/MC/MCParser/AsmParser.cpp +++ b/lib/MC/MCParser/AsmParser.cpp @@ -700,44 +700,45 @@ static unsigned getBinOpPrecedence(AsmToken::TokenKind K, Kind = MCBinaryExpr::LOr; return 1; - // Low Precedence: +, -, ==, !=, <>, <, <=, >, >= + + // Low Precedence: |, &, ^ + // + // FIXME: gas seems to support '!' as an infix operator? + case AsmToken::Pipe: + Kind = MCBinaryExpr::Or; + return 2; + case AsmToken::Caret: + Kind = MCBinaryExpr::Xor; + return 2; + case AsmToken::Amp: + Kind = MCBinaryExpr::And; + return 2; + + // Intermediate Precedence: +, -, ==, !=, <>, <, <=, >, >= case AsmToken::Plus: Kind = MCBinaryExpr::Add; - return 2; + return 3; case AsmToken::Minus: Kind = MCBinaryExpr::Sub; - return 2; + return 3; case AsmToken::EqualEqual: Kind = MCBinaryExpr::EQ; - return 2; + return 3; case AsmToken::ExclaimEqual: case AsmToken::LessGreater: Kind = MCBinaryExpr::NE; - return 2; + return 3; case AsmToken::Less: Kind = MCBinaryExpr::LT; - return 2; + return 3; case AsmToken::LessEqual: Kind = MCBinaryExpr::LTE; - return 2; + return 3; case AsmToken::Greater: Kind = MCBinaryExpr::GT; - return 2; + return 3; case AsmToken::GreaterEqual: Kind = MCBinaryExpr::GTE; - return 2; - - // Intermediate Precedence: |, &, ^ - // - // FIXME: gas seems to support '!' as an infix operator? - case AsmToken::Pipe: - Kind = MCBinaryExpr::Or; - return 3; - case AsmToken::Caret: - Kind = MCBinaryExpr::Xor; - return 3; - case AsmToken::Amp: - Kind = MCBinaryExpr::And; return 3; // Highest Precedence: *, /, %, <<, >> diff --git a/test/MC/AsmParser/X86/x86_instructions.s b/test/MC/AsmParser/X86/x86_instructions.s index cfea1bde9e3..df0acaa9d99 100644 --- a/test/MC/AsmParser/X86/x86_instructions.s +++ b/test/MC/AsmParser/X86/x86_instructions.s @@ -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 + + -- 2.34.1