[llvm] [Mips] Support llvm.readcyclecounter intrinsic (PR #114953)

YunQiang Su via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 24 20:28:34 PST 2024


================
@@ -2092,6 +2095,42 @@ MachineBasicBlock *MipsTargetLowering::emitAtomicCmpSwapPartword(
   return exitMBB;
 }
 
+SDValue MipsTargetLowering::lowerREADCYCLECOUNTER(SDValue Op,
+                                                  SelectionDAG &DAG) const {
+  SmallVector<SDValue, 3> Results;
+  SDLoc DL(Op);
+  unsigned RdhwrOpc, DestReg;
+
+  if (Subtarget.hasMips64()) {
+    RdhwrOpc = Mips::RDHWR64;
+    DestReg = Mips::V1_64;
----------------
wzssyqa wrote:

Why can V1 can hardcoded here?
If the IR is quite long, will it overwrite some previous value?

https://github.com/llvm/llvm-project/pull/114953


More information about the llvm-commits mailing list