stacksave GPU Virtual ISA NVIDIA

stacksave Stack Manipulation Instructions

stacksave.type d;

Copies the current value of stack pointer into the destination register d.

Encoding

PTX is a virtual instruction set. It has no single, stable native binary encoding - the compiler lowers this instruction to different native machine code depending on the selected NVIDIA target architecture (compute capability). This page intentionally shows no bit-diagram; see the target/version requirements below for what governs how this instruction compiles.
PTX ISA Version Introduced PTX ISA 7.3
Minimum Target sm_52

Syntax Forms

One mnemonic covers many type / state-space / scope / modifier combinations - each row below is an independently valid form.

Syntax Data Types State Space(s) Modifiers Min. Target Description
stacksave.type d; sm_52 Copies the current value of stack pointer into the destination register d. Pointer returned by stacksave can be used in a subsequent stackrestore instruction to restore the stack pointer. (see the official PTX ISA docs for the full description)

Operands

  • d
    Destination register

At a Glance

Data Types -

Reference

NVIDIA PTX ISA

Description

Copies the current value of stack pointer into the destination register d. Pointer returned by stacksave can be used in a subsequent stackrestore instruction to restore the stack pointer. If d is modified prior to use in stackrestore instruction, it may corrupt data in the stack. Destination operand d has the same type as the instruction type.

Semantics

d = stackptr;

Examples

.reg .u32 rd;
stacksave.u32 rd;

.reg .u64 rd1;
stacksave.u64 rd1;

Reproduced from NVIDIA's official PTX ISA documentation for technical accuracy.

Sources