Skip to main content
Log in

Mojo function

mulwide

mulwide(a: SIMD[uint32, 1], b: SIMD[uint32, 1]) -> SIMD[uint64, 1]

Performs a wide multiplication of two 32-bit unsigned integers.

Multiplies two 32-bit unsigned integers and returns the full 64-bit result. This is useful when the product may exceed 32 bits.

Note: On NVIDIA GPUs, this maps directly to the MUL.WIDE.U32 PTX instruction. On other architectures, it performs the multiplication using 64-bit casts.

Args:

  • a (SIMD[uint32, 1]): First 32-bit unsigned integer operand.
  • b (SIMD[uint32, 1]): Second 32-bit unsigned integer operand.

Returns:

The full 64-bit product of a * b

mulwide(a: SIMD[int32, 1], b: SIMD[int32, 1]) -> SIMD[int64, 1]

Performs a wide multiplication of two 32-bit signed integers.

Multiplies two 32-bit signed integers and returns the full 64-bit result. This is useful when the product may exceed 32 bits or be negative.

Note: On NVIDIA GPUs, this maps directly to the MUL.WIDE.S32 PTX instruction. On other architectures, it performs the multiplication using 64-bit casts.

Args:

  • a (SIMD[int32, 1]): First 32-bit signed integer operand.
  • b (SIMD[int32, 1]): Second 32-bit signed integer operand.

Returns:

The full 64-bit signed product of a * b