[llvm] r245475 - [SPARC] Enable writing to floating-point-state register.

Douglas Katzman via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 19 11:34:49 PDT 2015


Author: dougk
Date: Wed Aug 19 13:34:48 2015
New Revision: 245475

URL: http://llvm.org/viewvc/llvm-project?rev=245475&view=rev
Log:
[SPARC] Enable writing to floating-point-state register.

Modified:
    llvm/trunk/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp
    llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td
    llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.td
    llvm/trunk/test/MC/Sparc/sparc-special-registers.s
    llvm/trunk/test/MC/Sparc/sparcv9-instructions.s

Modified: llvm/trunk/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp?rev=245475&r1=245474&r2=245475&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp Wed Aug 19 13:34:48 2015
@@ -772,6 +772,9 @@ SparcAsmParser::parseSparcAsmOperand(std
       case Sparc::PSR:
         Op = SparcOperand::CreateToken("%psr", S);
         break;
+      case Sparc::FSR:
+        Op = SparcOperand::CreateToken("%fsr", S);
+        break;
       case Sparc::WIM:
         Op = SparcOperand::CreateToken("%wim", S);
         break;
@@ -897,6 +900,12 @@ bool SparcAsmParser::matchRegisterName(c
       RegKind = SparcOperand::rk_Special;
       return true;
     }
+
+    if (name.equals("fsr")) {
+      RegNo = Sparc::FSR;
+      RegKind = SparcOperand::rk_Special;
+      return true;
+    }
 
     if (name.equals("wim")) {
       RegNo = Sparc::WIM;

Modified: llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td?rev=245475&r1=245474&r2=245475&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td (original)
+++ llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td Wed Aug 19 13:34:48 2015
@@ -434,6 +434,22 @@ let DecoderMethod = "DecodeLoadQFP" in
   defm LDQF  : LoadA<"ldq", 0b100010, 0b110010, load, QFPRegs, f128>,
                Requires<[HasV9, HasHardQuad]>;
 
+let DecoderMethod = "DecodeLoadFP" in
+  let Defs = [FSR] in {
+    let rd = 0 in {
+      def LDFSRrr : F3_1<3, 0b100001, (outs), (ins MEMrr:$addr),
+                     "ld [$addr], %fsr", []>;
+      def LDFSRri : F3_2<3, 0b100001, (outs), (ins MEMri:$addr),
+                     "ld [$addr], %fsr", []>;
+    }
+    let rd = 1 in {
+      def LDXFSRrr : F3_1<3, 0b100001, (outs), (ins MEMrr:$addr),
+                     "ldx [$addr], %fsr", []>, Requires<[HasV9]>;
+      def LDXFSRri : F3_2<3, 0b100001, (outs), (ins MEMri:$addr),
+                     "ldx [$addr], %fsr", []>, Requires<[HasV9]>;
+    }
+  }
+
 // Section B.4 - Store Integer Instructions, p. 95
 let DecoderMethod = "DecodeStoreInt" in {
   defm STB   : StoreA<"stb", 0b000101, 0b010101, truncstorei8,  IntRegs, i32>;

Modified: llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.td?rev=245475&r1=245474&r2=245475&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.td (original)
+++ llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.td Wed Aug 19 13:34:48 2015
@@ -60,6 +60,8 @@ def ICC : SparcCtrlReg<0, "ICC">; // Thi
 foreach I = 0-3 in
   def FCC#I : SparcCtrlReg<I, "FCC"#I>;
 
+def FSR : SparcCtrlReg<0, "FSR">; // Floating-point state register.
+
 // Y register
 def Y : SparcCtrlReg<0, "Y">, DwarfRegNum<[64]>;
 // Ancillary state registers (implementation defined)

Modified: llvm/trunk/test/MC/Sparc/sparc-special-registers.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Sparc/sparc-special-registers.s?rev=245475&r1=245474&r2=245475&view=diff
==============================================================================
--- llvm/trunk/test/MC/Sparc/sparc-special-registers.s (original)
+++ llvm/trunk/test/MC/Sparc/sparc-special-registers.s Wed Aug 19 13:34:48 2015
@@ -39,3 +39,9 @@
 
         ! CHECK: wr %i0, 7, %asr6      ! encoding: [0x8d,0x86,0x20,0x07]
         wr %i0, 7, %fprs
+
+        ! CHECK: ld [%g2+20], %fsr     ! encoding: [0xc1,0x08,0xa0,0x14]
+        ld [%g2 + 20],%fsr
+
+        ! CHECK: ld [%g2+%i5], %fsr    ! encoding: [0xc1,0x08,0x80,0x1d]
+        ld [%g2 + %i5],%fsr

Modified: llvm/trunk/test/MC/Sparc/sparcv9-instructions.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Sparc/sparcv9-instructions.s?rev=245475&r1=245474&r2=245475&view=diff
==============================================================================
--- llvm/trunk/test/MC/Sparc/sparcv9-instructions.s (original)
+++ llvm/trunk/test/MC/Sparc/sparcv9-instructions.s Wed Aug 19 13:34:48 2015
@@ -90,3 +90,13 @@
         ! V9: stq %f48, [%l0]                 ! encoding: [0xe3,0x34,0x00,0x00]
         stqa %f48, [%l0] 0xf0
         stq %f48, [%l0]
+
+        ! V8:      error: instruction requires a CPU feature not currently enabled
+        ! V8-NEXT: ldx [%g2 + 20],%fsr
+        ! V9: ldx [%g2+20], %fsr    ! encoding: [0xc3,0x08,0xa0,0x14]
+        ldx [%g2 + 20],%fsr
+
+        ! V8:      error: instruction requires a CPU feature not currently enabled
+        ! V8-NEXT: ldx [%g2 + %i5],%fsr
+        ! V9: ldx [%g2+%i5], %fsr   ! encoding: [0xc3,0x08,0x80,0x1d]
+        ldx [%g2 + %i5],%fsr




More information about the llvm-commits mailing list