[llvm] r245485 - [Sparc]: asm-only support for the ldstub instruction.

Douglas Katzman via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 19 12:30:58 PDT 2015


Author: dougk
Date: Wed Aug 19 14:30:57 2015
New Revision: 245485

URL: http://llvm.org/viewvc/llvm-project?rev=245485&view=rev
Log:
[Sparc]: asm-only support for the ldstub instruction.

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

Modified: llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td?rev=245485&r1=245484&r2=245485&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td (original)
+++ llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td Wed Aug 19 14:30:57 2015
@@ -298,6 +298,17 @@ multiclass LoadA<string OpcStr, bits<6>
   def Arr  : LoadASI<OpcStr, LoadAOp3Val, OpNode, RC, Ty>;
 }
 
+// The LDSTUB instruction is supported for asm only.
+// It is unlikely that general-purpose code could make use of it.
+// CAS is preferred for sparc v9.
+def LDSTUBrr : F3_1<3, 0b001101, (outs IntRegs:$dst), (ins MEMrr:$addr),
+                  "ldstub [$addr], $dst", []>;
+def LDSTUBri : F3_2<3, 0b001101, (outs IntRegs:$dst), (ins MEMri:$addr),
+                  "ldstub [$addr], $dst", []>;
+def LDSTUBArr : F3_1_asi<3, 0b011101, (outs IntRegs:$dst),
+                         (ins MEMrr:$addr, i8imm:$asi),
+                         "ldstuba [$addr] $asi, $dst", []>;
+
 // Store multiclass - Define both Reg+Reg/Reg+Imm patterns in one shot.
 multiclass Store<string OpcStr, bits<6> Op3Val, SDPatternOperator OpNode,
            RegisterClass RC, ValueType Ty> {

Modified: llvm/trunk/test/MC/Sparc/sparc-atomic-instructions.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Sparc/sparc-atomic-instructions.s?rev=245485&r1=245484&r2=245485&view=diff
==============================================================================
--- llvm/trunk/test/MC/Sparc/sparc-atomic-instructions.s (original)
+++ llvm/trunk/test/MC/Sparc/sparc-atomic-instructions.s Wed Aug 19 14:30:57 2015
@@ -12,3 +12,12 @@
 
         ! CHECK: swapa [%i0+%l6] 131, %o2   ! encoding: [0xd4,0xfe,0x10,0x76]
         swapa [%i0+%l6] 131, %o2
+
+        ! CHECK: ldstub [%i0+40], %g1 ! encoding: [0xc2,0x6e,0x20,0x28]
+        ldstub [%i0+40], %g1
+
+        ! CHECK: ldstub [%i0+%i2], %g1 ! encoding: [0xc2,0x6e,0x00,0x1a]
+        ldstub [%i0+%i2], %g1
+
+        ! CHECK: ldstuba [%i0+%i2] 131, %g1 ! encoding: [0xc2,0xee,0x10,0x7a]
+        ldstuba [%i0+%i2] 131, %g1




More information about the llvm-commits mailing list