[llvm] r241460 - [Sparc] Add support for flush instruction.

James Y Knight jyknight at google.com
Mon Jul 6 09:01:04 PDT 2015


Author: jyknight
Date: Mon Jul  6 11:01:04 2015
New Revision: 241460

URL: http://llvm.org/viewvc/llvm-project?rev=241460&view=rev
Log:
[Sparc] Add support for flush instruction.

Differential Revision: http://reviews.llvm.org/D9833

Modified:
    llvm/trunk/lib/Target/Sparc/SparcInstrAliases.td
    llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td
    llvm/trunk/test/MC/Sparc/sparc-mem-instructions.s

Modified: llvm/trunk/lib/Target/Sparc/SparcInstrAliases.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcInstrAliases.td?rev=241460&r1=241459&r2=241460&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/SparcInstrAliases.td (original)
+++ llvm/trunk/lib/Target/Sparc/SparcInstrAliases.td Mon Jul  6 11:01:04 2015
@@ -306,6 +306,9 @@ def : InstAlias<"mov $rs2, $rd", (ORrr I
 // mov simm13, rd -> or %g0, simm13, rd
 def : InstAlias<"mov $simm13, $rd", (ORri IntRegs:$rd, G0, i32imm:$simm13)>;
 
+// flush -> flush %g0
+def : InstAlias<"flush", (FLUSH), 0>;
+
 // set value, rd
 // (turns into a sequence of sethi+or, depending on the value)
 // def : InstAlias<"set $val, $rd", (ORri IntRegs:$rd, (SETHIi (HI22 imm:$val)), (LO10 imm:$val))>;

Modified: llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td?rev=241460&r1=241459&r2=241460&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td (original)
+++ llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td Mon Jul  6 11:01:04 2015
@@ -828,6 +828,20 @@ let rd = 0 in
   def UNIMP : F2_1<0b000, (outs), (ins i32imm:$imm22),
                   "unimp $imm22", []>;
 
+// Section B.32 - Flush Instruction Memory
+let rd = 0 in {
+  def FLUSHrr : F3_1<2, 0b111011, (outs), (ins MEMrr:$addr),
+                       "flush $addr", []>;
+  def FLUSHri : F3_2<2, 0b111011, (outs), (ins MEMri:$addr),
+                       "flush $addr", []>;
+
+  // The no-arg FLUSH is only here for the benefit of the InstAlias
+  // "flush", which cannot seem to use FLUSHrr, due to the inability
+  // to construct a MEMrr with fixed G0 registers.
+  let rs1 = 0, rs2 = 0 in
+    def FLUSH   : F3_1<2, 0b111011, (outs), (ins), "flush %g0", []>;
+}
+
 // Section B.33 - Floating-point Operate (FPop) Instructions
 
 // Convert Integer to Floating-point Instructions, p. 141

Modified: llvm/trunk/test/MC/Sparc/sparc-mem-instructions.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Sparc/sparc-mem-instructions.s?rev=241460&r1=241459&r2=241460&view=diff
==============================================================================
--- llvm/trunk/test/MC/Sparc/sparc-mem-instructions.s (original)
+++ llvm/trunk/test/MC/Sparc/sparc-mem-instructions.s Mon Jul  6 11:01:04 2015
@@ -72,3 +72,13 @@
         st %o2, [%g1]
         ! CHECK: sta %o2, [%i0+%l6] 131 ! encoding: [0xd4,0xa6,0x10,0x76]
         sta %o2, [%i0 + %l6] 131
+
+        ! CHECK:  flush %g1+%g2         ! encoding: [0x81,0xd8,0x40,0x02]
+        flush %g1 + %g2
+        ! CHECK:  flush %g1+8           ! encoding: [0x81,0xd8,0x60,0x08]
+        flush %g1 + 8
+        ! CHECK:  flush %g1             ! encoding: [0x81,0xd8,0x40,0x00]
+        flush %g1
+        ! Not specified in manual, but accepted by gas.
+        ! CHECK:  flush %g0             ! encoding: [0x81,0xd8,0x00,0x00]
+        flush





More information about the llvm-commits mailing list