PTX ISA v9.4

9.7.19.1. Stack Manipulation Instructions: stacksave

stacksave

Save the value of stack pointer into a register.

Syntax

ptx
stacksave.type  d;

.type = { .u32, .u64 };

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

ptx
d = stackptr;

PTX ISA Notes

Introduced in PTX ISA version 7.3.

Target ISA Notes

stacksave requires sm_52 or higher.

Examples

ptx
.reg .u32 rd;
stacksave.u32 rd;

.reg .u64 rd1;
stacksave.u64 rd1;
esc
Type to search across all documentation