[llvm] r339570 - Revert "[Sparc] Add support for the cycle counter available in GR740"

Daniel Cederman via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 13 07:18:09 PDT 2018


Author: dcederman
Date: Mon Aug 13 07:18:09 2018
New Revision: 339570

URL: http://llvm.org/viewvc/llvm-project?rev=339570&view=rev
Log:
Revert "[Sparc] Add support for the cycle counter available in GR740"

It breaks when using EXPENSIVE_CHECKS with the error message
"Bad machine code: Using an undefined physical register".

Removed:
    llvm/trunk/test/CodeGen/SPARC/readcycle.ll
Modified:
    llvm/trunk/lib/Target/Sparc/LeonFeatures.td
    llvm/trunk/lib/Target/Sparc/Sparc.td
    llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp
    llvm/trunk/lib/Target/Sparc/SparcSubtarget.cpp
    llvm/trunk/lib/Target/Sparc/SparcSubtarget.h

Modified: llvm/trunk/lib/Target/Sparc/LeonFeatures.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/LeonFeatures.td?rev=339570&r1=339569&r2=339570&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/LeonFeatures.td (original)
+++ llvm/trunk/lib/Target/Sparc/LeonFeatures.td Mon Aug 13 07:18:09 2018
@@ -58,7 +58,3 @@ def FixAllFDIVSQRT : SubtargetFeature<
   "true",
   "LEON erratum fix: Fix FDIVS/FDIVD/FSQRTS/FSQRTD instructions with NOPs and floating-point store" 
 >;
-
-def LeonCycleCounter
-  : SubtargetFeature<"leoncyclecounter", "HasLeonCycleCounter", "true",
-                     "Use the Leon cycle counter register">;

Modified: llvm/trunk/lib/Target/Sparc/Sparc.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/Sparc.td?rev=339570&r1=339569&r2=339570&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/Sparc.td (original)
+++ llvm/trunk/lib/Target/Sparc/Sparc.td Mon Aug 13 07:18:09 2018
@@ -159,7 +159,7 @@ def : Processor<"leon4", LEON4Itinerarie
 // LEON 4 FT (GR740) 
 // TO DO: Place-holder: Processor specific features will be added *very* soon here.
 def : Processor<"gr740", LEON4Itineraries, 
-                [FeatureLeon, UMACSMACSupport, LeonCASA, LeonCycleCounter]>;
+                [FeatureLeon, UMACSMACSupport, LeonCASA]>;
 
 //===----------------------------------------------------------------------===//
 // Declare the target which we are implementing

Modified: llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp?rev=339570&r1=339569&r2=339570&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp Mon Aug 13 07:18:09 2018
@@ -1841,9 +1841,6 @@ SparcTargetLowering::SparcTargetLowering
     setOperationAction(ISD::FMUL, MVT::f32, Promote);
   }
 
-  if (Subtarget->hasLeonCycleCounter())
-    setOperationAction(ISD::READCYCLECOUNTER, MVT::i64, Custom);
-
   setOperationAction(ISD::INTRINSIC_WO_CHAIN, MVT::Other, Custom);
 
   setMinFunctionAlignment(2);
@@ -3590,16 +3587,7 @@ void SparcTargetLowering::ReplaceNodeRes
                                   getLibcallName(libCall),
                                   1));
     return;
-  case ISD::READCYCLECOUNTER: {
-    assert(Subtarget->hasLeonCycleCounter());
-    SDValue Lo = DAG.getCopyFromReg(N->getOperand(0), dl, SP::ASR23, MVT::i32);
-    SDValue Hi = DAG.getCopyFromReg(Lo, dl, SP::G0, MVT::i32);
-    SDValue Ops[] = { Lo, Hi };
-    SDValue Pair = DAG.getNode(ISD::BUILD_PAIR, dl, MVT::i64, Ops);
-    Results.push_back(Pair);
-    Results.push_back(N->getOperand(0));
-    return;
-  }
+
   case ISD::SINT_TO_FP:
   case ISD::UINT_TO_FP:
     // Custom lower only if it involves f128 or i64.

Modified: llvm/trunk/lib/Target/Sparc/SparcSubtarget.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcSubtarget.cpp?rev=339570&r1=339569&r2=339570&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/SparcSubtarget.cpp (original)
+++ llvm/trunk/lib/Target/Sparc/SparcSubtarget.cpp Mon Aug 13 07:18:09 2018
@@ -47,7 +47,6 @@ SparcSubtarget &SparcSubtarget::initiali
   InsertNOPLoad = false;
   FixAllFDIVSQRT = false;
   DetectRoundChange = false;
-  HasLeonCycleCounter = false;
 
   // Determine default and user specified characteristics
   std::string CPUName = CPU;

Modified: llvm/trunk/lib/Target/Sparc/SparcSubtarget.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcSubtarget.h?rev=339570&r1=339569&r2=339570&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/SparcSubtarget.h (original)
+++ llvm/trunk/lib/Target/Sparc/SparcSubtarget.h Mon Aug 13 07:18:09 2018
@@ -50,7 +50,6 @@ class SparcSubtarget : public SparcGenSu
   bool InsertNOPLoad;
   bool FixAllFDIVSQRT;
   bool DetectRoundChange;
-  bool HasLeonCycleCounter;
 
   SparcInstrInfo InstrInfo;
   SparcTargetLowering TLInfo;
@@ -96,7 +95,6 @@ public:
   bool insertNOPLoad() const { return InsertNOPLoad; }
   bool fixAllFDIVSQRT() const { return FixAllFDIVSQRT; }
   bool detectRoundChange() const { return DetectRoundChange; }
-  bool hasLeonCycleCounter() const { return HasLeonCycleCounter; }
 
   /// ParseSubtargetFeatures - Parses features string setting specified
   /// subtarget options.  Definition of function is auto generated by tblgen.

Removed: llvm/trunk/test/CodeGen/SPARC/readcycle.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SPARC/readcycle.ll?rev=339569&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/SPARC/readcycle.ll (original)
+++ llvm/trunk/test/CodeGen/SPARC/readcycle.ll (removed)
@@ -1,11 +0,0 @@
-; RUN: llc < %s -march=sparc -mcpu=gr740 | FileCheck %s
-; CHECK: rd %asr23, %o1
-; CHECK: mov %g0, %o0
-
-define i64 @test() {
-entry:
-  %0 = call i64 @llvm.readcyclecounter()
-  ret i64 %0
-}
-
-declare i64 @llvm.readcyclecounter()




More information about the llvm-commits mailing list