Scalar Arithmetic Instructions
239 AMDGPU instructions in this category - showing 100 per page, page 1 of 3 - click any row for encoding, pseudocode, and full documentation.
| Mnemonic | Syntax | Format | Summary |
|---|---|---|---|
| s_abs_i32 | s_abs_i32 | SOP1 | Compute the absolute value of a scalar input, store the result into a scalar register and set SCC iff the result is nonzero. |
| s_absdiff_i32 | s_absdiff_i32 | SOP2 | Calculate the absolute value of difference between two scalar inputs, store the result into a scalar register and set SCC iff the result is nonzero. |
| s_add_co_ci_u32 | s_add_co_ci_u32 | SOP2 | Add two unsigned 32-bit integer inputs and a carry-in bit from SCC, store the result into a scalar register and store the carry-out bit into SCC. |
| s_add_co_i32 | s_add_co_i32 | SOP2 | Add two signed 32-bit integer inputs, store the result into a scalar register and store the carry-out bit into SCC. |
| s_add_co_u32 | s_add_co_u32 | SOP2 | Add two unsigned 32-bit integer inputs, store the result into a scalar register and store the carry-out bit into SCC. |
| s_add_f16 | s_add_f16 | SOP2 | Add two floating point inputs and store the result into a scalar register. |
| s_add_f32 | s_add_f32 | SOP2 | Add two floating point inputs and store the result into a scalar register. |
| s_add_i32 | s_add_i32 | SOP2 | Add two signed 32-bit integer inputs, store the result into a scalar register and store the carry-out bit into SCC. |
| s_add_nc_u64 | s_add_nc_u64 | SOP2 | Add two unsigned 64-bit integer inputs and store the result into a scalar register. |
| s_add_pc_i64 | s_add_pc_i64 | SOP1 | Increment the PC by a signed literal offset. |
| s_add_u32 | s_add_u32 SDST, S0, S1 | SOP2 | Add two 32-bit unsigned scalar operands, wavefront-uniform. |
| s_add_u64 | s_add_u64 | SOP2 | AMDGPU SOP2 scalar instruction operating on u64 data. (Format and name extracted from LLVM's AMDGPU backend source - semantics not yet curated.) |
| s_addc_u32 | s_addc_u32 | SOP2 | Add two unsigned 32-bit integer inputs and a carry-in bit from SCC, store the result into a scalar register and store the carry-out bit into SCC. |
| s_addk_co_i32 | s_addk_co_i32 | SOPK | Add a scalar input and the sign extension of a literal 16-bit constant, store the result into a scalar register and store the carry-out bit into SCC. |
| s_addk_i32 | s_addk_i32 | SOPK | Add a scalar input and the sign extension of a literal 16-bit constant, store the result into a scalar register and store the carry-out bit into SCC. |
| s_alloc_vgpr | s_alloc_vgpr | SOP1 | Attempt to set the wave's VGPR allocation to the specified number of VGPRs (or greater). The desired VGPR count may be specified as a constant or in an SGPR. The request is rounded up to the next block size so a successful allocation may include more than the requested number of VGPRs. |
| s_and_b32 | s_and_b32 | SOP2 | Calculate bitwise AND on two scalar inputs, store the result into a scalar register and set SCC iff the result is nonzero. |
| s_and_b64 | s_and_b64 | SOP2 | Calculate bitwise AND on two scalar inputs, store the result into a scalar register and set SCC iff the result is nonzero. |
| s_and_not0_saveexec_b32 | s_and_not0_saveexec_b32 | SOP1 | Calculate bitwise AND on the EXEC mask and the negation of the scalar input, store the calculated result into the EXEC mask, set SCC iff the calculated result is nonzero and store the original value of the EXEC mask into the scalar destination register. |
| s_and_not0_saveexec_b64 | s_and_not0_saveexec_b64 | SOP1 | Calculate bitwise AND on the EXEC mask and the negation of the scalar input, store the calculated result into the EXEC mask, set SCC iff the calculated result is nonzero and store the original value of the EXEC mask into the scalar destination register. |
| s_and_not0_wrexec_b32 | s_and_not0_wrexec_b32 | SOP1 | Calculate bitwise AND on the EXEC mask and the negation of the scalar input, store the calculated result into the EXEC mask and also into the scalar destination register, and set SCC iff the calculated result is nonzero. |
| s_and_not0_wrexec_b64 | s_and_not0_wrexec_b64 | SOP1 | Calculate bitwise AND on the EXEC mask and the negation of the scalar input, store the calculated result into the EXEC mask and also into the scalar destination register, and set SCC iff the calculated result is nonzero. |
| s_and_not1_b32 | s_and_not1_b32 | SOP2 | Calculate bitwise AND with the first input and the negation of the second input, store the result into a scalar register and set SCC if the result is nonzero. |
| s_and_not1_b64 | s_and_not1_b64 | SOP2 | Calculate bitwise AND with the first input and the negation of the second input, store the result into a scalar register and set SCC if the result is nonzero. |
| s_and_not1_saveexec_b32 | s_and_not1_saveexec_b32 | SOP1 | Calculate bitwise AND on the scalar input and the negation of the EXEC mask, store the calculated result into the EXEC mask, set SCC iff the calculated result is nonzero and store the original value of the EXEC mask into the scalar destination register. |
| s_and_not1_saveexec_b64 | s_and_not1_saveexec_b64 | SOP1 | Calculate bitwise AND on the scalar input and the negation of the EXEC mask, store the calculated result into the EXEC mask, set SCC iff the calculated result is nonzero and store the original value of the EXEC mask into the scalar destination register. |
| s_and_not1_wrexec_b32 | s_and_not1_wrexec_b32 | SOP1 | Calculate bitwise AND on the scalar input and the negation of the EXEC mask, store the calculated result into the EXEC mask and also into the scalar destination register, and set SCC iff the calculated result is nonzero. |
| s_and_not1_wrexec_b64 | s_and_not1_wrexec_b64 | SOP1 | Calculate bitwise AND on the scalar input and the negation of the EXEC mask, store the calculated result into the EXEC mask and also into the scalar destination register, and set SCC iff the calculated result is nonzero. |
| s_and_saveexec_b32 | s_and_saveexec_b32 | SOP1 | Calculate bitwise AND on the scalar input and the EXEC mask, store the calculated result into the EXEC mask, set SCC iff the calculated result is nonzero and store the original value of the EXEC mask into the scalar destination register. |
| s_and_saveexec_b64 | s_and_saveexec_b64 | SOP1 | Calculate bitwise AND on the scalar input and the EXEC mask, store the calculated result into the EXEC mask, set SCC iff the calculated result is nonzero and store the original value of the EXEC mask into the scalar destination register. |
| s_andn1_saveexec_b32 | s_andn1_saveexec_b32 | SOP1 | Calculate bitwise AND on the EXEC mask and the negation of the scalar input, store the calculated result into the EXEC mask, set SCC iff the calculated result is nonzero and store the original value of the EXEC mask into the scalar destination register. |
| s_andn1_saveexec_b64 | s_andn1_saveexec_b64 | SOP1 | Calculate bitwise AND on the EXEC mask and the negation of the scalar input, store the calculated result into the EXEC mask, set SCC iff the calculated result is nonzero and store the original value of the EXEC mask into the scalar destination register. |
| s_andn1_wrexec_b32 | s_andn1_wrexec_b32 | SOP1 | Calculate bitwise AND on the EXEC mask and the negation of the scalar input, store the calculated result into the EXEC mask and also into the scalar destination register, and set SCC iff the calculated result is nonzero. |
| s_andn1_wrexec_b64 | s_andn1_wrexec_b64 | SOP1 | Calculate bitwise AND on the EXEC mask and the negation of the scalar input, store the calculated result into the EXEC mask and also into the scalar destination register, and set SCC iff the calculated result is nonzero. |
| s_andn2_b32 | s_andn2_b32 | SOP2 | Calculate bitwise AND with the first input and the negation of the second input, store the result into a scalar register and set SCC if the result is nonzero. |
| s_andn2_b64 | s_andn2_b64 | SOP2 | Calculate bitwise AND with the first input and the negation of the second input, store the result into a scalar register and set SCC if the result is nonzero. |
| s_andn2_saveexec_b32 | s_andn2_saveexec_b32 | SOP1 | Calculate bitwise AND on the scalar input and the negation of the EXEC mask, store the calculated result into the EXEC mask, set SCC iff the calculated result is nonzero and store the original value of the EXEC mask into the scalar destination register. |
| s_andn2_saveexec_b64 | s_andn2_saveexec_b64 | SOP1 | Calculate bitwise AND on the scalar input and the negation of the EXEC mask, store the calculated result into the EXEC mask, set SCC iff the calculated result is nonzero and store the original value of the EXEC mask into the scalar destination register. |
| s_andn2_wrexec_b32 | s_andn2_wrexec_b32 | SOP1 | Calculate bitwise AND on the scalar input and the negation of the EXEC mask, store the calculated result into the EXEC mask and also into the scalar destination register, and set SCC iff the calculated result is nonzero. |
| s_andn2_wrexec_b64 | s_andn2_wrexec_b64 | SOP1 | Calculate bitwise AND on the scalar input and the negation of the EXEC mask, store the calculated result into the EXEC mask and also into the scalar destination register, and set SCC iff the calculated result is nonzero. |
| s_ashr_i32 | s_ashr_i32 | SOP2 | Given a shift count in the second scalar input, calculate the arithmetic shift right (preserving sign bit) of the first scalar input, store the result into a scalar register and set SCC iff the result is nonzero. |
| s_ashr_i64 | s_ashr_i64 | SOP2 | Given a shift count in the second scalar input, calculate the arithmetic shift right (preserving sign bit) of the first scalar input, store the result into a scalar register and set SCC iff the result is nonzero. |
| s_barrier_init | s_barrier_init | SOP1 | Initialize a named barrier's member count and reset its signal count. |
| s_barrier_join | s_barrier_join | SOP1 | Join a named barrier. |
| s_barrier_signal | s_barrier_signal | SOP1 | Signal that a wave has arrived at a barrier . The argument specifies which barrier to signal. |
| s_barrier_signal_isfirst | s_barrier_signal_isfirst | SOP1 | Signal that a wave has arrived at a barrier and set SCC to indicate if this is the first wave to signal the barrier. The argument specifies which barrier to signal. |
| s_bcnt0_i32_b32 | s_bcnt0_i32_b32 | SOP1 | Count the number of "0" bits in a scalar input, store the result into a scalar register and set SCC iff the result is nonzero. |
| s_bcnt0_i32_b64 | s_bcnt0_i32_b64 | SOP1 | Count the number of "0" bits in a scalar input, store the result into a scalar register and set SCC iff the result is nonzero. |
| s_bcnt1_i32_b32 | s_bcnt1_i32_b32 | SOP1 | Count the number of "1" bits in a scalar input, store the result into a scalar register and set SCC iff the result is nonzero. |
| s_bcnt1_i32_b64 | s_bcnt1_i32_b64 | SOP1 | Count the number of "1" bits in a scalar input, store the result into a scalar register and set SCC iff the result is nonzero. |
| s_bfe_i32 | s_bfe_i32 | SOP2 | Extract a signed bitfield from the first input using field offset and size encoded in the second input, store the result into a scalar register and set SCC iff the result is nonzero. |
| s_bfe_i64 | s_bfe_i64 | SOP2 | Extract a signed bitfield from the first input using field offset and size encoded in the second input, store the result into a scalar register and set SCC iff the result is nonzero. |
| s_bfe_u32 | s_bfe_u32 | SOP2 | Extract an unsigned bitfield from the first input using field offset and size encoded in the second input, store the result into a scalar register and set SCC iff the result is nonzero. |
| s_bfe_u64 | s_bfe_u64 | SOP2 | Extract an unsigned bitfield from the first input using field offset and size encoded in the second input, store the result into a scalar register and set SCC iff the result is nonzero. |
| s_bfm_b32 | s_bfm_b32 | SOP2 | Calculate a bitfield mask given a field offset and size and store the result in a scalar register. |
| s_bfm_b64 | s_bfm_b64 | SOP2 | Calculate a bitfield mask given a field offset and size and store the result in a scalar register. |
| s_bitreplicate_b64_b32 | s_bitreplicate_b64_b32 | SOP1 | Substitute each bit of a 32 bit scalar input with two instances of itself and store the result into a 64 bit scalar register. |
| s_bitset0_b32 | s_bitset0_b32 | SOP1 | Given a bit offset in a scalar input, set the indicated bit in the destination scalar register to 0. |
| s_bitset0_b64 | s_bitset0_b64 | SOP1 | Given a bit offset in a scalar input, set the indicated bit in the destination scalar register to 0. |
| s_bitset1_b32 | s_bitset1_b32 | SOP1 | Given a bit offset in a scalar input, set the indicated bit in the destination scalar register to 1. |
| s_bitset1_b64 | s_bitset1_b64 | SOP1 | Given a bit offset in a scalar input, set the indicated bit in the destination scalar register to 1. |
| s_brev_b32 | s_brev_b32 | SOP1 | Reverse the order of bits in a scalar input and store the result into a scalar register. |
| s_brev_b64 | s_brev_b64 | SOP1 | Reverse the order of bits in a scalar input and store the result into a scalar register. |
| s_call_b64 | s_call_b64 | SOPK | Store the address of the next instruction to a scalar register and then jump to a constant offset relative to the current PC. |
| s_call_i64 | s_call_i64 | SOPK | Store the address of the next instruction to a scalar register and then jump to a constant offset relative to the current PC. |
| s_cbranch_g_fork | s_cbranch_g_fork | SOP2 | Conditional branch using branch-stack. |
| s_cbranch_i_fork | s_cbranch_i_fork | SOPK | Conditional branch using branch-stack. |
| s_cbranch_join | s_cbranch_join | SOP1 | Conditional branch join point (end of conditional branch block). S0 is saved CSP value. See S_CBRANCH_G_FORK and S_CBRANCH_I_FORK for related instructions. |
| s_ceil_f16 | s_ceil_f16 | SOP1 | Round the half-precision float input up to next integer and store the result in floating point format into a scalar register. |
| s_ceil_f32 | s_ceil_f32 | SOP1 | Round the single-precision float input up to next integer and store the result in floating point format into a scalar register. |
| s_cls_i32 | s_cls_i32 | SOP1 | Count the number of leading bits that are the same as the sign bit of a scalar input and store the result into a scalar register. Store -1 if all input bits are the same. |
| s_cls_i32_i64 | s_cls_i32_i64 | SOP1 | Count the number of leading bits that are the same as the sign bit of a scalar input and store the result into a scalar register. Store -1 if all input bits are the same. |
| s_clz_i32_u32 | s_clz_i32_u32 | SOP1 | Count the number of leading "0" bits before the first "1" in a scalar input and store the result into a scalar register. Store -1 if there are no "1" bits. |
| s_clz_i32_u64 | s_clz_i32_u64 | SOP1 | Count the number of leading "0" bits before the first "1" in a scalar input and store the result into a scalar register. Store -1 if there are no "1" bits. |
| s_cmov_b32 | s_cmov_b32 | SOP1 | Move scalar input into a scalar register iff SCC is nonzero. |
| s_cmov_b64 | s_cmov_b64 | SOP1 | Move scalar input into a scalar register iff SCC is nonzero. |
| s_cmovk_i32 | s_cmovk_i32 | SOPK | Move the sign extension of a literal 16-bit constant into a scalar register iff SCC is nonzero. |
| s_cmpk_eq_i32 | s_cmpk_eq_i32 | SOPK | Set SCC to 1 iff scalar input is equal to the sign extension of a literal 16-bit constant. |
| s_cmpk_eq_u32 | s_cmpk_eq_u32 | SOPK | Set SCC to 1 iff scalar input is equal to the zero extension of a literal 16-bit constant. |
| s_cmpk_ge_i32 | s_cmpk_ge_i32 | SOPK | Set SCC to 1 iff scalar input is greater than or equal to the sign extension of a literal 16-bit constant. |
| s_cmpk_ge_u32 | s_cmpk_ge_u32 | SOPK | Set SCC to 1 iff scalar input is greater than or equal to the zero extension of a literal 16-bit constant. |
| s_cmpk_gt_i32 | s_cmpk_gt_i32 | SOPK | Set SCC to 1 iff scalar input is greater than the sign extension of a literal 16-bit constant. |
| s_cmpk_gt_u32 | s_cmpk_gt_u32 | SOPK | Set SCC to 1 iff scalar input is greater than the zero extension of a literal 16-bit constant. |
| s_cmpk_le_i32 | s_cmpk_le_i32 | SOPK | Set SCC to 1 iff scalar input is less than or equal to the sign extension of a literal 16-bit constant. |
| s_cmpk_le_u32 | s_cmpk_le_u32 | SOPK | Set SCC to 1 iff scalar input is less than or equal to the zero extension of a literal 16-bit constant. |
| s_cmpk_lg_i32 | s_cmpk_lg_i32 | SOPK | Set SCC to 1 iff scalar input is less than or greater than the sign extension of a literal 16-bit constant. |
| s_cmpk_lg_u32 | s_cmpk_lg_u32 | SOPK | Set SCC to 1 iff scalar input is less than or greater than the zero extension of a literal 16-bit constant. |
| s_cmpk_lt_i32 | s_cmpk_lt_i32 | SOPK | Set SCC to 1 iff scalar input is less than the sign extension of a literal 16-bit constant. |
| s_cmpk_lt_u32 | s_cmpk_lt_u32 | SOPK | Set SCC to 1 iff scalar input is less than the zero extension of a literal 16-bit constant. |
| s_cselect_b32 | s_cselect_b32 | SOP2 | Select the first input if SCC is true otherwise select the second input, then store the selected input into a scalar register. |
| s_cselect_b64 | s_cselect_b64 | SOP2 | Select the first input if SCC is true otherwise select the second input, then store the selected input into a scalar register. |
| s_ctz_i32_b32 | s_ctz_i32_b32 | SOP1 | Count the number of trailing "0" bits before the first "1" in a scalar input and store the result into a scalar register. Store -1 if there are no "1" bits in the input. |
| s_ctz_i32_b64 | s_ctz_i32_b64 | SOP1 | Count the number of trailing "0" bits before the first "1" in a scalar input and store the result into a scalar register. Store -1 if there are no "1" bits in the input. |
| s_cvt_f16_f32 | s_cvt_f16_f32 | SOP1 | Convert from a single-precision float input to a half-precision float value and store the result into a scalar register. |
| s_cvt_f32_f16 | s_cvt_f32_f16 | SOP1 | Convert from a half-precision float input to a single-precision float value and store the result into a scalar register. |
| s_cvt_f32_i32 | s_cvt_f32_i32 | SOP1 | Convert from a signed 32-bit integer input to a single-precision float value and store the result into a scalar register. |
| s_cvt_f32_u32 | s_cvt_f32_u32 | SOP1 | Convert from an unsigned 32-bit integer input to a single-precision float value and store the result into a scalar register. |
| s_cvt_hi_f32_f16 | s_cvt_hi_f32_f16 | SOP1 | Convert from a half-precision float value in the high 16 bits of a scalar input to a single-precision float value and store the result into a scalar register. |
| s_cvt_i32_f32 | s_cvt_i32_f32 | SOP1 | Convert from a single-precision float input to a signed 32-bit integer value and store the result into a scalar register. |
| s_cvt_pk_rtz_f16_f32 | s_cvt_pk_rtz_f16_f32 | SOP2 | Convert two single-precision float inputs into a packed half-precision float result using round toward zero semantics (ignore the current rounding mode), and store the result into a scalar register. |