[llvm] 33f2a00 - [ms] [llvm-ml] Add support for the remaining binary named operators
Eric Astor via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 7 18:45:41 PDT 2022
Author: Eric Astor
Date: 2022-07-07T21:45:23-04:00
New Revision: 33f2a00023cb2deabbcb9884cb142419c1003855
URL: https://github.com/llvm/llvm-project/commit/33f2a00023cb2deabbcb9884cb142419c1003855
DIFF: https://github.com/llvm/llvm-project/commit/33f2a00023cb2deabbcb9884cb142419c1003855.diff
LOG: [ms] [llvm-ml] Add support for the remaining binary named operators
Finish adding support for the remaining binary named operators in expression context: XOR, SHL, and SHR.
Differential Revision: https://reviews.llvm.org/D129299
Added:
Modified:
llvm/lib/MC/MCParser/MasmParser.cpp
llvm/test/tools/llvm-ml/named_operators.asm
Removed:
################################################################################
diff --git a/llvm/lib/MC/MCParser/MasmParser.cpp b/llvm/lib/MC/MCParser/MasmParser.cpp
index 2a2741a33326d..424e9dba45872 100644
--- a/llvm/lib/MC/MCParser/MasmParser.cpp
+++ b/llvm/lib/MC/MCParser/MasmParser.cpp
@@ -2028,6 +2028,9 @@ bool MasmParser::parseBinOpRHS(unsigned Precedence, const MCExpr *&Res,
.CaseLower("and", AsmToken::Amp)
.CaseLower("not", AsmToken::Exclaim)
.CaseLower("or", AsmToken::Pipe)
+ .CaseLower("xor", AsmToken::Caret)
+ .CaseLower("shl", AsmToken::LessLess)
+ .CaseLower("shr", AsmToken::GreaterGreater)
.CaseLower("eq", AsmToken::EqualEqual)
.CaseLower("ne", AsmToken::ExclaimEqual)
.CaseLower("lt", AsmToken::Less)
diff --git a/llvm/test/tools/llvm-ml/named_operators.asm b/llvm/test/tools/llvm-ml/named_operators.asm
index 49ae8b093350c..b1bac15d6df21 100644
--- a/llvm/test/tools/llvm-ml/named_operators.asm
+++ b/llvm/test/tools/llvm-ml/named_operators.asm
@@ -69,75 +69,120 @@ t9 BYTE 5 GE 6
; CHECK: .byte -1
; CHECK-NOT: .byte
+t10 BYTE 6 XOR 10
+; CHECK-LABEL: t10:
+; CHECK-NEXT: .byte 12
+
+t11 BYTE 1 SHL 2
+ BYTE 2 SHL 3
+ BYTE 3 SHL 1
+; CHECK-LABEL: t11:
+; CHECK-NEXT: .byte 4
+; CHECK: .byte 16
+; CHECK: .byte 6
+; CHECK-NOT: .byte
+
+t12 BYTE 6 SHR 2
+ BYTE 16 SHR 3
+ BYTE 7 SHR 1
+; CHECK-LABEL: t12:
+; CHECK-NEXT: .byte 1
+; CHECK: .byte 2
+; CHECK: .byte 3
+; CHECK-NOT: .byte
+
.code
-t10:
+t13:
xor eax, Not 1
-; CHECK-LABEL: t10:
+; CHECK-LABEL: t13:
; CHECK-NEXT: xor eax, -2
-t11:
+t14:
xor eax, 1 oR 2
-; CHECK-LABEL: t11:
+; CHECK-LABEL: t14:
; CHECK-NEXT: xor eax, 3
-t12:
+t15:
xor eax, 6 ANd 10
-; CHECK-LABEL: t12:
+; CHECK-LABEL: t15:
; CHECK-NEXT: xor eax, 2
-t13:
+t16:
xor eax, 5 Eq 6
xor eax, 6 eQ 6
xor eax, 7 eq 6
-; CHECK-LABEL: t13:
+; CHECK-LABEL: t16:
; CHECK-NEXT: xor eax, 0
; CHECK-NEXT: xor eax, -1
; CHECK-NEXT: xor eax, 0
-t14:
+t17:
xor eax, 5 Ne 6
xor eax, 6 nE 6
xor eax, 7 ne 6
-; CHECK-LABEL: t14:
+; CHECK-LABEL: t17:
; CHECK-NEXT: xor eax, -1
; CHECK-NEXT: xor eax, 0
; CHECK-NEXT: xor eax, -1
-t15:
+t18:
xor eax, 5 Lt 6
xor eax, 6 lT 6
xor eax, 7 lt 6
-; CHECK-LABEL: t15:
+; CHECK-LABEL: t18:
; CHECK-NEXT: xor eax, -1
; CHECK-NEXT: xor eax, 0
; CHECK-NEXT: xor eax, 0
-t16:
+t19:
xor eax, 5 Le 6
xor eax, 6 lE 6
xor eax, 7 le 6
-; CHECK-LABEL: t16:
+; CHECK-LABEL: t19:
; CHECK-NEXT: xor eax, -1
; CHECK-NEXT: xor eax, -1
; CHECK-NEXT: xor eax, 0
-t17:
+t20:
xor eax, 5 Gt 6
xor eax, 6 gT 6
xor eax, 7 gt 6
-; CHECK-LABEL: t17:
+; CHECK-LABEL: t20:
; CHECK-NEXT: xor eax, 0
; CHECK-NEXT: xor eax, 0
; CHECK-NEXT: xor eax, -1
-t18:
+t21:
xor eax, 5 Ge 6
xor eax, 6 gE 6
xor eax, 7 ge 6
-; CHECK-LABEL: t18:
+; CHECK-LABEL: t21:
; CHECK-NEXT: xor eax, 0
; CHECK-NEXT: xor eax, -1
; CHECK-NEXT: xor eax, -1
+t22:
+xor eax, 6 xOR 10
+; CHECK-LABEL: t22:
+; CHECK-NEXT: xor eax, 12
+
+t23:
+xor eax, 1 shl 2
+xor eax, 2 shL 3
+xor eax, 3 SHl 1
+; CHECK-LABEL: t23:
+; CHECK-NEXT: xor eax, 4
+; CHECK-NEXT: xor eax, 16
+; CHECK-NEXT: xor eax, 6
+
+t24:
+xor eax, 6 shr 2
+xor eax, 16 shR 3
+xor eax, 7 SHr 1
+; CHECK-LABEL: t24:
+; CHECK-NEXT: xor eax, 1
+; CHECK-NEXT: xor eax, 2
+; CHECK-NEXT: xor eax, 3
+
END
More information about the llvm-commits
mailing list