[llvm] 3762331 - [RISCV] Use TargetConstant for CSR number for READ_CSR/WRITE_CSR.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 8 15:10:35 PST 2021


Author: Craig Topper
Date: 2021-11-08T15:10:24-08:00
New Revision: 376233113e254e47ea9624c770150c1e90bbce80

URL: https://github.com/llvm/llvm-project/commit/376233113e254e47ea9624c770150c1e90bbce80
DIFF: https://github.com/llvm/llvm-project/commit/376233113e254e47ea9624c770150c1e90bbce80.diff

LOG: [RISCV] Use TargetConstant for CSR number for READ_CSR/WRITE_CSR.

This is consistent with what we do for other operands that are required
to be constants.

I don't think this results in any real changes. The pattern match
code for isel treats ConstantSDNode and TargetConstantSDNode the same.

Added: 
    

Modified: 
    llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 9d8d11e8b980..9f5f3d25bca9 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -5362,7 +5362,7 @@ SDValue RISCVTargetLowering::lowerGET_ROUNDING(SDValue Op,
   const MVT XLenVT = Subtarget.getXLenVT();
   SDLoc DL(Op);
   SDValue Chain = Op->getOperand(0);
-  SDValue SysRegNo = DAG.getConstant(
+  SDValue SysRegNo = DAG.getTargetConstant(
       RISCVSysReg::lookupSysRegByName("FRM")->Encoding, DL, XLenVT);
   SDVTList VTs = DAG.getVTList(XLenVT, MVT::Other);
   SDValue RM = DAG.getNode(RISCVISD::READ_CSR, DL, VTs, Chain, SysRegNo);
@@ -5394,7 +5394,7 @@ SDValue RISCVTargetLowering::lowerSET_ROUNDING(SDValue Op,
   SDLoc DL(Op);
   SDValue Chain = Op->getOperand(0);
   SDValue RMValue = Op->getOperand(1);
-  SDValue SysRegNo = DAG.getConstant(
+  SDValue SysRegNo = DAG.getTargetConstant(
       RISCVSysReg::lookupSysRegByName("FRM")->Encoding, DL, XLenVT);
 
   // Encoding used for rounding mode in RISCV 
diff ers from that used in


        


More information about the llvm-commits mailing list