Skip to content

Conversation

koachan
Copy link
Contributor

@koachan koachan commented Jun 3, 2024

This adds %set_softint and %clear_softint alias for %asr20 and %asr21
as defined in JPS1.

koachan added 2 commits June 3, 2024 23:28
Created using spr 1.3.4
@llvmbot llvmbot added backend:Sparc llvm:mc Machine (object) code labels Jun 3, 2024
@llvmbot
Copy link
Member

llvmbot commented Jun 3, 2024

@llvm/pr-subscribers-mc

@llvm/pr-subscribers-backend-sparc

Author: Koakuma (koachan)

Changes

This adds %set_softint and %clear_softint alias for %asr20 and %asr21
as defined in JPS1.


Full diff: https://github.com/llvm/llvm-project/pull/94247.diff

2 Files Affected:

  • (modified) llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp (+9-2)
  • (modified) llvm/test/MC/Sparc/sparcv9-instructions.s (+4)
diff --git a/llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp b/llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp
index 185b2fe90c6cb..e4f5c64f9d00e 100644
--- a/llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp
+++ b/llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp
@@ -1384,12 +1384,11 @@ MCRegister SparcAsmParser::matchRegisterName(const AsmToken &Tok,
   }
 
   // JPS1 extension - aliases for ASRs
-  // Section A.51 - Read State Register
+  // Section 5.2.11 - Ancillary State Registers (ASRs)
   if (Name == "pcr") {
     RegKind = SparcOperand::rk_Special;
     return SP::ASR16;
   }
-
   if (Name == "pic") {
     RegKind = SparcOperand::rk_Special;
     return SP::ASR17;
@@ -1402,6 +1401,14 @@ MCRegister SparcAsmParser::matchRegisterName(const AsmToken &Tok,
     RegKind = SparcOperand::rk_Special;
     return SP::ASR19;
   }
+  if (Name == "set_softint") {
+    RegKind = SparcOperand::rk_Special;
+    return SP::ASR20;
+  }
+  if (Name == "clear_softint") {
+    RegKind = SparcOperand::rk_Special;
+    return SP::ASR21;
+  }
   if (Name == "softint") {
     RegKind = SparcOperand::rk_Special;
     return SP::ASR22;
diff --git a/llvm/test/MC/Sparc/sparcv9-instructions.s b/llvm/test/MC/Sparc/sparcv9-instructions.s
index b947243f8258f..d461c82467471 100644
--- a/llvm/test/MC/Sparc/sparcv9-instructions.s
+++ b/llvm/test/MC/Sparc/sparcv9-instructions.s
@@ -502,6 +502,10 @@
         wr %i0, %i1, %ccr
         ! V9: wr %i0, 1, %ccr           ! encoding: [0x85,0x86,0x20,0x01]
         wr %i0, 1, %ccr
+        ! V9: wr %i0, 1, %asr20         ! encoding: [0xa9,0x86,0x20,0x01]
+        wr %i0, 1, %set_softint
+        ! V9: wr %i0, 1, %asr21         ! encoding: [0xab,0x86,0x20,0x01]
+        wr %i0, 1, %clear_softint
 
         ! V9: st %o1, [%o0]             ! encoding: [0xd2,0x22,0x00,0x00]
         stw %o1, [%o0]

@koachan
Copy link
Contributor Author

koachan commented Jun 3, 2024

Note: this PR was created by spr, please do not hand-merge this.

Created using spr 1.3.5
@koachan koachan changed the base branch from users/koachan/spr/main.sparcias-add-aliases-for-asr20-21-as-defined-in-jps1 to main June 9, 2024 03:14
@koachan koachan merged commit 715a5d8 into main Jun 9, 2024
@koachan koachan deleted the users/koachan/spr/sparcias-add-aliases-for-asr20-21-as-defined-in-jps1 branch June 9, 2024 03:14
nekoshirro pushed a commit to nekoshirro/Alchemist-LLVM that referenced this pull request Jun 9, 2024
This adds %set_softint and %clear_softint alias for %asr20 and %asr21
as defined in JPS1.

Reviewers: jrtc27, brad0, s-barannikov, rorth

Reviewed By: s-barannikov

Pull Request: llvm#94247

Signed-off-by: Hafidz Muzakky <ais.muzakky@gmail.com>
@ldionne ldionne removed request for a team June 10, 2024 13:41
@ldionne ldionne removed the request for review from a team June 10, 2024 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:Sparc llvm:mc Machine (object) code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants