s_swappc_b64 GPU Native ISA AMD Scalar

Scalar Arithmetic

s_swappc_b64

Store the address of the next instruction to a scalar register and then jump to an address specified in the scalar input.

Also written as s_swap_pc_i64. AMD's machine-readable ISA specification lists this name for the same instruction.

Encoding

Binary Layout (AMD CDNA 4)
101111101
31:23
SDST
22:16
00011110
15:8
SSRC0
7:0
 

The ENC_SOP1 layout from AMD's machine-readable ISA specification (AMD CDNA 4). Opcode 30 in OP rebuilds 0xBE801E00, an identifier AMD lists for this encoding. Not the same in every generation: AMD RDNA 4 (opcode 73), AMD RDNA 3.5 (opcode 73), AMD RDNA 3 (opcode 73), AMD RDNA 2 (opcode 33), AMD RDNA 1 (opcode 33). The same in AMD CDNA 3, AMD CDNA 2, AMD CDNA 1.

Format SOP1
Width 32 bits
Opcode 30
Identifier 0xBE801E00

Operands

  • SDST
    Written. N/A Data format: N/A (OPR_SDST, FMT_NUM_B64)
  • SSRC0
    Read. N/A Data format: N/A (OPR_SREG, FMT_NUM_B64)

In AMD's order, as its machine-readable ISA specification lists them for the ENC_SOP1 encoding (AMD CDNA 4).

GFX Target Compatibility

TargetSupport
gfx1100✅ Supported

This instruction must be 4 bytes.

Related PTX Concepts

Function Call ↗
equivalent with restrictions
call (PTX)

Related

More in Scalar Arithmetic

Reference

AMDGPU / GFX ISA

Description

Store the address of the next instruction to a scalar register and then jump to an address specified in the scalar input. The argument is a byte address of the instruction to jump to. The byte address of the instruction immediately following this instruction is saved to the destination.

Semantics

jump_addr = S0.i64; D0.i64 = PC + 4LL; PC = jump_addr.i64

Example

s_swappc_b64 s[0:1], vcc

A real instruction accepted by the LLVM assembler, taken verbatim from LLVM's own AMDGPU MC test suite. Not from an AMD document, and not authored here.

Sources