Skip to main content
Log in

Mojo function

byte_permute

byte_permute(a: SIMD[uint32, 1], b: SIMD[uint32, 1], c: SIMD[uint32, 1]) -> SIMD[uint32, 1]

Permutes bytes from two 32-bit integers based on a control mask.

This function selects and rearranges individual bytes from two source integers based on a control mask to create a new 32-bit value.

Note: The exact byte selection behavior depends on the GPU architecture: - On NVIDIA: Maps to PRMT instruction - On AMD: Maps to PERM instruction.

Args:

  • a (SIMD[uint32, 1]): First source integer containing bytes to select from.
  • b (SIMD[uint32, 1]): Second source integer containing bytes to select from.
  • c (SIMD[uint32, 1]): Control mask that specifies which bytes to select and their positions Each byte in the mask controls the selection and placement of one output byte.

Returns:

A new 32-bit integer containing the selected and rearranged bytes