[llvm] [NVPTX] Add support for stacksave, stackrestore intrinsics (PR #114484)

Artem Belevich via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 31 17:01:10 PDT 2024


================
@@ -2287,6 +2290,54 @@ SDValue NVPTXTargetLowering::LowerDYNAMIC_STACKALLOC(SDValue Op,
   return DAG.getNode(NVPTXISD::DYNAMIC_STACKALLOC, DL, RetTypes, AllocOps);
 }
 
+SDValue NVPTXTargetLowering::LowerSTACKRESTORE(SDValue Op,
+                                               SelectionDAG &DAG) const {
+  SDLoc DL(Op.getNode());
+  if (STI.getPTXVersion() < 73 || STI.getSmVersion() < 52) {
+    const Function &Fn = DAG.getMachineFunction().getFunction();
+
+    DiagnosticInfoUnsupported NoStackRestore(
+        Fn,
+        "Support for stackrestore introduced in PTX ISA version 7.3 and "
+        "requires target sm_52.",
----------------
Artem-B wrote:

Wording nit: I'd stick with "requires {something} >= {min_version}" for both PTX and SM.

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


More information about the llvm-commits mailing list