clang 20.0.0git
Macros | Functions
bmi2intrin.h File Reference

Go to the source code of this file.

Macros

#define __DEFAULT_FN_ATTRS   __attribute__((__always_inline__, __nodebug__, __target__("bmi2")))
 

Functions

static __inline__ unsigned int __DEFAULT_FN_ATTRS _bzhi_u32 (unsigned int __X, unsigned int __Y)
 Copies the unsigned 32-bit integer __X and zeroes the upper bits starting at bit number __Y.
 
static __inline__ unsigned int __DEFAULT_FN_ATTRS _pdep_u32 (unsigned int __X, unsigned int __Y)
 Deposit (scatter) low-order bits from the unsigned 32-bit integer __X into the 32-bit result, according to the mask in the unsigned 32-bit integer __Y.
 
static __inline__ unsigned int __DEFAULT_FN_ATTRS _pext_u32 (unsigned int __X, unsigned int __Y)
 Extract (gather) bits from the unsigned 32-bit integer __X into the low-order bits of the 32-bit result, according to the mask in the unsigned 32-bit integer __Y.
 
static __inline__ unsigned int __DEFAULT_FN_ATTRS _mulx_u32 (unsigned int __X, unsigned int __Y, unsigned int *__P)
 Multiplies the unsigned 32-bit integers __X and __Y to form a 64-bit product.
 

Macro Definition Documentation

◆ __DEFAULT_FN_ATTRS

#define __DEFAULT_FN_ATTRS   __attribute__((__always_inline__, __nodebug__, __target__("bmi2")))

Definition at line 18 of file bmi2intrin.h.

Function Documentation

◆ _bzhi_u32()

static __inline__ unsigned int __DEFAULT_FN_ATTRS _bzhi_u32 ( unsigned int  __X,
unsigned int  __Y 
)
static

Copies the unsigned 32-bit integer __X and zeroes the upper bits starting at bit number __Y.

i := __Y[7:0]
result := __X
IF i < 32
result[31:i] := 0
FI

This intrinsic corresponds to the BZHI instruction.

Parameters
__XThe 32-bit source value to copy.
__YThe lower 8 bits specify the bit number of the lowest bit to zero.
Returns
The partially zeroed 32-bit value.

Definition at line 41 of file bmi2intrin.h.

References __Y.

◆ _mulx_u32()

static __inline__ unsigned int __DEFAULT_FN_ATTRS _mulx_u32 ( unsigned int  __X,
unsigned int  __Y,
unsigned int __P 
)
static

Multiplies the unsigned 32-bit integers __X and __Y to form a 64-bit product.

Stores the upper 32 bits of the product in the memory at __P and returns the lower 32 bits.

Store32(__P, (__X * __Y)[63:32])
result := (__X * __Y)[31:0]

This intrinsic corresponds to the MULX instruction.

Parameters
__XAn unsigned 32-bit multiplicand.
__YAn unsigned 32-bit multiplicand.
__PA pointer to memory for storing the upper half of the product.
Returns
The lower half of the product.

Definition at line 127 of file bmi2intrin.h.

References __P, __Y, and int.

◆ _pdep_u32()

static __inline__ unsigned int __DEFAULT_FN_ATTRS _pdep_u32 ( unsigned int  __X,
unsigned int  __Y 
)
static

Deposit (scatter) low-order bits from the unsigned 32-bit integer __X into the 32-bit result, according to the mask in the unsigned 32-bit integer __Y.

All other bits of the result are zero.

i := 0
result := 0
FOR m := 0 TO 31
IF __Y[m] == 1
result[m] := __X[i]
i := i + 1
ENDIF
ENDFOR

This intrinsic corresponds to the PDEP instruction.

Parameters
__XThe 32-bit source value to copy.
__YThe 32-bit mask specifying where to deposit source bits.
Returns
The 32-bit result.

Definition at line 71 of file bmi2intrin.h.

References __Y.

◆ _pext_u32()

static __inline__ unsigned int __DEFAULT_FN_ATTRS _pext_u32 ( unsigned int  __X,
unsigned int  __Y 
)
static

Extract (gather) bits from the unsigned 32-bit integer __X into the low-order bits of the 32-bit result, according to the mask in the unsigned 32-bit integer __Y.

All other bits of the result are zero.

i := 0
result := 0
FOR m := 0 TO 31
IF __Y[m] == 1
result[i] := __X[m]
i := i + 1
ENDIF
ENDFOR

This intrinsic corresponds to the PEXT instruction.

Parameters
__XThe 32-bit source value to copy.
__YThe 32-bit mask specifying which source bits to extract.
Returns
The 32-bit result.

Definition at line 101 of file bmi2intrin.h.

References __Y.