Mojo function
mulhi
mulhi(a: SIMD[uint16, 1], b: SIMD[uint16, 1]) -> SIMD[uint32, 1]
Calculates the most significant 32 bits of the product of two 16-bit unsigned integers.
This function multiplies two 16-bit unsigned integers and returns the high 32 bits of their product. This is useful for fixed-point arithmetic and overflow detection.
Note: On NVIDIA GPUs, this maps directly to the MULHI.U16 PTX instruction. On other architectures, it performs the multiplication using 32-bit arithmetic.
Args:
- a (
SIMD[uint16, 1]
): First 16-bit unsigned integer operand. - b (
SIMD[uint16, 1]
): Second 16-bit unsigned integer operand.
Returns:
The high 32 bits of the product a * b
mulhi(a: SIMD[int16, 1], b: SIMD[int16, 1]) -> SIMD[int32, 1]
Calculates the most significant 32 bits of the product of two 16-bit signed integers.
This function multiplies two 16-bit signed integers and returns the high 32 bits of their product. This is useful for fixed-point arithmetic and overflow detection.
Note: On NVIDIA GPUs, this maps directly to the MULHI.S16 PTX instruction. On other architectures, it performs the multiplication using 32-bit arithmetic.
Args:
- a (
SIMD[int16, 1]
): First 16-bit signed integer operand. - b (
SIMD[int16, 1]
): Second 16-bit signed integer operand.
Returns:
The high 32 bits of the product a * b
mulhi(a: SIMD[uint32, 1], b: SIMD[uint32, 1]) -> SIMD[uint32, 1]
Calculates the most significant 32 bits of the product of two 32-bit unsigned integers.
This function multiplies two 32-bit unsigned integers and returns the high 32 bits of their product. This is useful for fixed-point arithmetic and overflow detection.
Note: On NVIDIA GPUs, this maps directly to the MULHI.U32 PTX instruction. On other architectures, it performs the multiplication using 64-bit arithmetic.
Args:
- a (
SIMD[uint32, 1]
): First 32-bit unsigned integer operand. - b (
SIMD[uint32, 1]
): Second 32-bit unsigned integer operand.
Returns:
The high 32 bits of the product a * b
mulhi(a: SIMD[int32, 1], b: SIMD[int32, 1]) -> SIMD[int32, 1]
Calculates the most significant 32 bits of the product of two 32-bit signed integers.
This function multiplies two 32-bit signed integers and returns the high 32 bits of their product. This is useful for fixed-point arithmetic and overflow detection.
Note: On NVIDIA GPUs, this maps directly to the MULHI.S32 PTX instruction. On other architectures, it performs the multiplication using 64-bit arithmetic.
Args:
- a (
SIMD[int32, 1]
): First 32-bit signed integer operand. - b (
SIMD[int32, 1]
): Second 32-bit signed integer operand.
Returns:
The high 32 bits of the product a * b
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!