[llvm-branch-commits] [llvm] 5089f14 - [SPARC] Parse unary complement immediates (#219970)

Tobias Hieta via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sat Sep 5 00:12:28 PDT 2026


Author: Daniel Cederman
Date: 2026-09-05T09:11:59+02:00
New Revision: 5089f145193dd45f25634e2cb531aff9399e64fe

URL: https://github.com/llvm/llvm-project/commit/5089f145193dd45f25634e2cb531aff9399e64fe
DIFF: https://github.com/llvm/llvm-project/commit/5089f145193dd45f25634e2cb531aff9399e64fe.diff

LOG: [SPARC] Parse unary complement immediates (#219970)

Accept the tilde operand for unary complement of assembler immediates.

(cherry picked from commit ce1a7aefc06f2d9bf6d1ee797303017c807d7c67)

Added: 
    llvm/test/MC/Sparc/sparc-unary-not.s

Modified: 
    llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp b/llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp
index bab05f5e0ada8..7bc14b4892a73 100644
--- a/llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp
+++ b/llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp
@@ -1477,6 +1477,7 @@ SparcAsmParser::parseSparcAsmOperand(std::unique_ptr<SparcOperand> &Op) {
 
   case AsmToken::Plus:
   case AsmToken::Minus:
+  case AsmToken::Tilde:
   case AsmToken::Integer:
   case AsmToken::LParen:
   case AsmToken::Dot:

diff  --git a/llvm/test/MC/Sparc/sparc-unary-not.s b/llvm/test/MC/Sparc/sparc-unary-not.s
new file mode 100644
index 0000000000000..d5935d1c500f3
--- /dev/null
+++ b/llvm/test/MC/Sparc/sparc-unary-not.s
@@ -0,0 +1,4 @@
+# RUN: llvm-mc %s -triple=sparc | FileCheck %s
+
+# CHECK: and %g3, -32, %g3
+and %g3, ~0x0000001f, %g3


        


More information about the llvm-branch-commits mailing list