[llvm] 9179764 - SPARCv9: recognize SIR trap instruction

Joerg Sonnenberger via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 5 17:04:30 PST 2021


Author: Joerg Sonnenberger
Date: 2021-02-06T01:34:02+01:00
New Revision: 917976471068932bfec0aaa4ee82d34dd920206e

URL: https://github.com/llvm/llvm-project/commit/917976471068932bfec0aaa4ee82d34dd920206e
DIFF: https://github.com/llvm/llvm-project/commit/917976471068932bfec0aaa4ee82d34dd920206e.diff

LOG: SPARCv9: recognize SIR trap instruction

Added: 
    

Modified: 
    llvm/lib/Target/Sparc/SparcInstrAliases.td
    llvm/lib/Target/Sparc/SparcInstrInfo.td
    llvm/test/MC/Sparc/sparc-v9-traps.s

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/Sparc/SparcInstrAliases.td b/llvm/lib/Target/Sparc/SparcInstrAliases.td
index 4a0e8c856f27..8c528fca6a54 100644
--- a/llvm/lib/Target/Sparc/SparcInstrAliases.td
+++ b/llvm/lib/Target/Sparc/SparcInstrAliases.td
@@ -521,3 +521,6 @@ def : InstAlias<"signx $rd", (SRArr IntRegs:$rd, IntRegs:$rd, G0), 0>, Requires<
 
 // signx reg, rd -> sra reg, %g0, rd
 def : InstAlias<"signx $rs1, $rd", (SRArr IntRegs:$rd, IntRegs:$rs1, G0), 0>, Requires<[HasV9]>;
+
+// sir -> sir 0
+def : InstAlias<"sir", (SIR 0), 0>;

diff  --git a/llvm/lib/Target/Sparc/SparcInstrInfo.td b/llvm/lib/Target/Sparc/SparcInstrInfo.td
index d1190ae03d2c..5e41ff51204a 100644
--- a/llvm/lib/Target/Sparc/SparcInstrInfo.td
+++ b/llvm/lib/Target/Sparc/SparcInstrInfo.td
@@ -1534,6 +1534,11 @@ let Predicates = [HasV9], hasSideEffects = 1, rd = 0, rs1 = 0b01111 in
  def MEMBARi : F3_2<2, 0b101000, (outs), (ins MembarTag:$simm13),
                     "membar $simm13", []>;
 
+let Predicates = [HasV9], rd = 15, rs1 = 0b00000 in
+  def SIR: F3_2<2, 0b110000, (outs),
+                (ins simm13Op:$simm13),
+                 "sir $simm13", []>;
+
 // The CAS instruction, unlike other instructions, only comes in a
 // form which requires an ASI be provided. The ASI value hardcoded
 // here is ASI_PRIMARY, the default unprivileged ASI for SparcV9.

diff  --git a/llvm/test/MC/Sparc/sparc-v9-traps.s b/llvm/test/MC/Sparc/sparc-v9-traps.s
index da11b36003bd..8e5a48794ecf 100644
--- a/llvm/test/MC/Sparc/sparc-v9-traps.s
+++ b/llvm/test/MC/Sparc/sparc-v9-traps.s
@@ -300,4 +300,8 @@
         tvs %xcc, 82
         tvs %xcc, %g1 + %i2
         tvs %xcc, %i5 + 41
-      
\ No newline at end of file
+
+        ! CHECK: sir 0                  ! encoding: [0x9f,0x80,0x20,0x00]
+        ! CHECK: sir 123                ! encoding: [0x9f,0x80,0x20,0x7b]
+        sir
+        sir 123


        


More information about the llvm-commits mailing list