clang 20.0.0git
Macros | Functions
ia32intrin.h File Reference

Go to the source code of this file.

Macros

#define __DEFAULT_FN_ATTRS   __attribute__((__always_inline__, __nodebug__))
 
#define __DEFAULT_FN_ATTRS_CRC32   __attribute__((__always_inline__, __nodebug__, __target__("crc32")))
 
#define __DEFAULT_FN_ATTRS_CAST   __attribute__((__always_inline__))
 
#define __DEFAULT_FN_ATTRS_CONSTEXPR   __DEFAULT_FN_ATTRS
 
#define _bit_scan_forward(A)   __bsfd((A))
 Finds the first set bit starting from the least significant bit.
 
#define _bit_scan_reverse(A)   __bsrd((A))
 Finds the first set bit starting from the most significant bit.
 
#define _popcnt32(A)   __popcntd((A))
 Counts the number of bits in the source operand having a value of 1.
 
#define _rdtsc()   __rdtsc()
 Reads the processor's time-stamp counter.
 
#define _rdpmc(A)   __rdpmc(A)
 Reads the specified performance monitoring counter.
 
#define _lrotl(a, b)   __rold((a), (b))
 Rotates a 32-bit value to the left by the specified number of bits.
 
#define _lrotr(a, b)   __rord((a), (b))
 Rotates a 32-bit value to the right by the specified number of bits.
 
#define _rotl(a, b)   __rold((a), (b))
 Rotates a 32-bit value to the left by the specified number of bits.
 
#define _rotr(a, b)   __rord((a), (b))
 Rotates a 32-bit value to the right by the specified number of bits.
 
#define _rotwl(a, b)   __rolw((a), (b))
 Rotates a 16-bit value to the left by the specified number of bits.
 
#define _rotwr(a, b)   __rorw((a), (b))
 Rotates a 16-bit value to the right by the specified number of bits.
 

Functions

static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR __bsfd (int __A)
 Finds the first set bit starting from the least significant bit.
 
static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR __bsrd (int __A)
 Finds the first set bit starting from the most significant bit.
 
static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR __bswapd (int __A)
 Swaps the bytes in the input, converting little endian to big endian or vice versa.
 
static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR _bswap (int __A)
 Swaps the bytes in the input, converting little endian to big endian or vice versa.
 
static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR __popcntd (unsigned int __A)
 Counts the number of bits in the source operand having a value of 1.
 
static __inline__ unsigned int __DEFAULT_FN_ATTRS __readeflags (void)
 Returns the program status-and-control EFLAGS register with the VM and RF flags cleared.
 
static __inline__ void __DEFAULT_FN_ATTRS __writeeflags (unsigned int __f)
 Writes the specified value to the program status-and-control EFLAGS register.
 
static __inline__ unsigned int __DEFAULT_FN_ATTRS_CAST _castf32_u32 (float __A)
 Casts a 32-bit float value to a 32-bit unsigned integer value.
 
static __inline__ unsigned long long __DEFAULT_FN_ATTRS_CAST _castf64_u64 (double __A)
 Casts a 64-bit float value to a 64-bit unsigned integer value.
 
static __inline__ float __DEFAULT_FN_ATTRS_CAST _castu32_f32 (unsigned int __A)
 Casts a 32-bit unsigned integer value to a 32-bit float value.
 
static __inline__ double __DEFAULT_FN_ATTRS_CAST _castu64_f64 (unsigned long long __A)
 Casts a 64-bit unsigned integer value to a 64-bit float value.
 
static __inline__ unsigned int __DEFAULT_FN_ATTRS_CRC32 __crc32b (unsigned int __C, unsigned char __D)
 Adds the unsigned integer operand to the CRC-32C checksum of the unsigned char operand.
 
static __inline__ unsigned int __DEFAULT_FN_ATTRS_CRC32 __crc32w (unsigned int __C, unsigned short __D)
 Adds the unsigned integer operand to the CRC-32C checksum of the unsigned short operand.
 
static __inline__ unsigned int __DEFAULT_FN_ATTRS_CRC32 __crc32d (unsigned int __C, unsigned int __D)
 Adds the unsigned integer operand to the CRC-32C checksum of the second unsigned integer operand.
 
static __inline__ unsigned long long __DEFAULT_FN_ATTRS __rdpmc (int __A)
 Reads the specified performance-monitoring counter.
 
static __inline__ unsigned long long __DEFAULT_FN_ATTRS __rdtscp (unsigned int *__A)
 Reads the processor's time-stamp counter and the IA32_TSC_AUX MSR (0xc0000103).
 
static __inline__ void __DEFAULT_FN_ATTRS _wbinvd (void)
 
static __inline__ unsigned char __DEFAULT_FN_ATTRS_CONSTEXPR __rolb (unsigned char __X, int __C)
 Rotates an 8-bit value to the left by the specified number of bits.
 
static __inline__ unsigned char __DEFAULT_FN_ATTRS_CONSTEXPR __rorb (unsigned char __X, int __C)
 Rotates an 8-bit value to the right by the specified number of bits.
 
static __inline__ unsigned short __DEFAULT_FN_ATTRS_CONSTEXPR __rolw (unsigned short __X, int __C)
 Rotates a 16-bit value to the left by the specified number of bits.
 
static __inline__ unsigned short __DEFAULT_FN_ATTRS_CONSTEXPR __rorw (unsigned short __X, int __C)
 Rotates a 16-bit value to the right by the specified number of bits.
 
static __inline__ unsigned int __DEFAULT_FN_ATTRS_CONSTEXPR __rold (unsigned int __X, int __C)
 Rotates a 32-bit value to the left by the specified number of bits.
 
static __inline__ unsigned int __DEFAULT_FN_ATTRS_CONSTEXPR __rord (unsigned int __X, int __C)
 Rotates a 32-bit value to the right by the specified number of bits.
 

Macro Definition Documentation

◆ __DEFAULT_FN_ATTRS

#define __DEFAULT_FN_ATTRS   __attribute__((__always_inline__, __nodebug__))

Definition at line 18 of file ia32intrin.h.

◆ __DEFAULT_FN_ATTRS_CAST

#define __DEFAULT_FN_ATTRS_CAST   __attribute__((__always_inline__))

Definition at line 25 of file ia32intrin.h.

◆ __DEFAULT_FN_ATTRS_CONSTEXPR

#define __DEFAULT_FN_ATTRS_CONSTEXPR   __DEFAULT_FN_ATTRS

Definition at line 26 of file ia32intrin.h.

◆ __DEFAULT_FN_ATTRS_CRC32

#define __DEFAULT_FN_ATTRS_CRC32   __attribute__((__always_inline__, __nodebug__, __target__("crc32")))

Definition at line 19 of file ia32intrin.h.

◆ _bit_scan_forward

#define _bit_scan_forward (   A)    __bsfd((A))

Finds the first set bit starting from the least significant bit.

The result is undefined if the input is 0.

int _bit_scan_forward(int A);
#define _bit_scan_forward(A)
Finds the first set bit starting from the least significant bit.
Definition: ia32intrin.h:109

This intrinsic corresponds to the BSF instruction or the TZCNT instruction.

Parameters
AA 32-bit integer operand.
Returns
A 32-bit integer containing the bit number.
See also
__bsfd

Definition at line 109 of file ia32intrin.h.

◆ _bit_scan_reverse

#define _bit_scan_reverse (   A)    __bsrd((A))

Finds the first set bit starting from the most significant bit.

The result is undefined if the input is 0.

int _bit_scan_reverse(int A);
#define _bit_scan_reverse(A)
Finds the first set bit starting from the most significant bit.
Definition: ia32intrin.h:127

This intrinsic corresponds to the BSR instruction or the LZCNT instruction and an XOR.

Parameters
AA 32-bit integer operand.
Returns
A 32-bit integer containing the bit number.
See also
__bsrd

Definition at line 127 of file ia32intrin.h.

◆ _lrotl

#define _lrotl (   a,
  b 
)    __rold((a), (b))

Rotates a 32-bit value to the left by the specified number of bits.

This operation is undefined if the number of bits exceeds the size of the value.

unsigned int _lrotl(unsigned int a, int b);
__device__ __2f16 b
#define _lrotl(a, b)
Rotates a 32-bit value to the left by the specified number of bits.
Definition: ia32intrin.h:753

This intrinsic corresponds to the ROL instruction.

Parameters
aThe unsigned 32-bit value to be rotated.
bThe number of bits to rotate the value.
Returns
The rotated value.
See also
__rold

Definition at line 753 of file ia32intrin.h.

◆ _lrotr

#define _lrotr (   a,
  b 
)    __rord((a), (b))

Rotates a 32-bit value to the right by the specified number of bits.

This operation is undefined if the number of bits exceeds the size of the value.

unsigned int _lrotr(unsigned int a, int b);
#define _lrotr(a, b)
Rotates a 32-bit value to the right by the specified number of bits.
Definition: ia32intrin.h:773

This intrinsic corresponds to the ROR instruction.

Parameters
aThe unsigned 32-bit value to be rotated.
bThe number of bits to rotate the value.
Returns
The rotated value.
See also
__rord

Definition at line 773 of file ia32intrin.h.

◆ _popcnt32

#define _popcnt32 (   A)    __popcntd((A))

Counts the number of bits in the source operand having a value of 1.

int _popcnt32(int A);
#define _popcnt32(A)
Counts the number of bits in the source operand having a value of 1.
Definition: ia32intrin.h:230

This intrinsic corresponds to the POPCNT instruction or a sequence of arithmetic and logic operations to calculate it.

Parameters
AAn unsigned 32-bit integer operand.
Returns
A 32-bit integer containing the number of bits with value 1 in the source operand.
See also
__popcntd

Definition at line 230 of file ia32intrin.h.

◆ _rdpmc

#define _rdpmc (   A)    __rdpmc(A)

Reads the specified performance monitoring counter.

Refer to your processor's documentation to determine which performance counters are supported.

unsigned long long _rdpmc(int A);
#define _rdpmc(A)
Reads the specified performance monitoring counter.
Definition: ia32intrin.h:534

This intrinsic corresponds to the RDPMC instruction.

Parameters
AThe performance counter to read.
Returns
The 64-bit value read from the performance counter.
See also
__rdpmc

Definition at line 534 of file ia32intrin.h.

◆ _rdtsc

#define _rdtsc ( )    __rdtsc()

Reads the processor's time-stamp counter.

unsigned long long _rdtsc();
#define _rdtsc()
Reads the processor's time-stamp counter.
Definition: ia32intrin.h:516

This intrinsic corresponds to the RDTSC instruction.

Returns
The 64-bit value of the time-stamp counter.

Definition at line 516 of file ia32intrin.h.

◆ _rotl

#define _rotl (   a,
  b 
)    __rold((a), (b))

Rotates a 32-bit value to the left by the specified number of bits.

This operation is undefined if the number of bits exceeds the size of the value.

unsigned int _rotl(unsigned int a, int b);
#define _rotl(a, b)
Rotates a 32-bit value to the left by the specified number of bits.
Definition: ia32intrin.h:794

This intrinsic corresponds to the ROL instruction.

Parameters
aThe unsigned 32-bit value to be rotated.
bThe number of bits to rotate the value.
Returns
The rotated value.
See also
__rold

Definition at line 794 of file ia32intrin.h.

◆ _rotr

#define _rotr (   a,
  b 
)    __rord((a), (b))

Rotates a 32-bit value to the right by the specified number of bits.

This operation is undefined if the number of bits exceeds the size of the value.

unsigned int _rotr(unsigned int a, int b);
#define _rotr(a, b)
Rotates a 32-bit value to the right by the specified number of bits.
Definition: ia32intrin.h:814

This intrinsic corresponds to the ROR instruction.

Parameters
aThe unsigned 32-bit value to be rotated.
bThe number of bits to rotate the value.
Returns
The rotated value.
See also
__rord

Definition at line 814 of file ia32intrin.h.

◆ _rotwl

#define _rotwl (   a,
  b 
)    __rolw((a), (b))

Rotates a 16-bit value to the left by the specified number of bits.

This operation is undefined if the number of bits exceeds the size of the value.

unsigned short _rotwl(unsigned short a, int b);
#define _rotwl(a, b)
Rotates a 16-bit value to the left by the specified number of bits.
Definition: ia32intrin.h:836

This intrinsic corresponds to the ROL instruction.

Parameters
aThe unsigned 16-bit value to be rotated.
bThe number of bits to rotate the value.
Returns
The rotated value.
See also
__rolw

Definition at line 836 of file ia32intrin.h.

◆ _rotwr

#define _rotwr (   a,
  b 
)    __rorw((a), (b))

Rotates a 16-bit value to the right by the specified number of bits.

This operation is undefined if the number of bits exceeds the size of the value.

unsigned short _rotwr(unsigned short a, int b);
#define _rotwr(a, b)
Rotates a 16-bit value to the right by the specified number of bits.
Definition: ia32intrin.h:856

This intrinsic corresponds to the ROR instruction.

Parameters
aThe unsigned 16-bit value to be rotated.
bThe number of bits to rotate the value.
Returns
The rotated value.
See also
__rorw

Definition at line 856 of file ia32intrin.h.

Function Documentation

◆ __bsfd()

static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR __bsfd ( int  __A)
static

Finds the first set bit starting from the least significant bit.

The result is undefined if the input is 0.

This intrinsic corresponds to the BSF instruction or the TZCNT instruction.

Parameters
__AA 32-bit integer operand.
Returns
A 32-bit integer containing the bit number.
See also
_bit_scan_forward

Definition at line 42 of file ia32intrin.h.

◆ __bsrd()

static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR __bsrd ( int  __A)
static

Finds the first set bit starting from the most significant bit.

The result is undefined if the input is 0.

This intrinsic corresponds to the BSR instruction or the LZCNT instruction and an XOR.

Parameters
__AA 32-bit integer operand.
Returns
A 32-bit integer containing the bit number.
See also
_bit_scan_reverse

Definition at line 59 of file ia32intrin.h.

◆ __bswapd()

static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR __bswapd ( int  __A)
static

Swaps the bytes in the input, converting little endian to big endian or vice versa.

This intrinsic corresponds to the BSWAP instruction.

Parameters
__AA 32-bit integer operand.
Returns
A 32-bit integer containing the swapped bytes.

Definition at line 74 of file ia32intrin.h.

◆ __crc32b()

static __inline__ unsigned int __DEFAULT_FN_ATTRS_CRC32 __crc32b ( unsigned int  __C,
unsigned char  __D 
)
static

Adds the unsigned integer operand to the CRC-32C checksum of the unsigned char operand.

This intrinsic corresponds to the CRC32B instruction.

Parameters
__CAn unsigned integer operand to add to the CRC-32C checksum of operand __D.
__DAn unsigned 8-bit integer operand used to compute the CRC-32C checksum.
Returns
The result of adding operand __C to the CRC-32C checksum of operand __D.

Definition at line 406 of file ia32intrin.h.

References __D.

◆ __crc32d()

static __inline__ unsigned int __DEFAULT_FN_ATTRS_CRC32 __crc32d ( unsigned int  __C,
unsigned int  __D 
)
static

Adds the unsigned integer operand to the CRC-32C checksum of the second unsigned integer operand.

This intrinsic corresponds to the CRC32D instruction.

Parameters
__CAn unsigned integer operand to add to the CRC-32C checksum of operand __D.
__DAn unsigned 32-bit integer operand used to compute the CRC-32C checksum.
Returns
The result of adding operand __C to the CRC-32C checksum of operand __D.

Definition at line 446 of file ia32intrin.h.

References __D.

◆ __crc32w()

static __inline__ unsigned int __DEFAULT_FN_ATTRS_CRC32 __crc32w ( unsigned int  __C,
unsigned short  __D 
)
static

Adds the unsigned integer operand to the CRC-32C checksum of the unsigned short operand.

This intrinsic corresponds to the CRC32W instruction.

Parameters
__CAn unsigned integer operand to add to the CRC-32C checksum of operand __D.
__DAn unsigned 16-bit integer operand used to compute the CRC-32C checksum.
Returns
The result of adding operand __C to the CRC-32C checksum of operand __D.

Definition at line 426 of file ia32intrin.h.

References __D.

◆ __popcntd()

static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR __popcntd ( unsigned int  __A)
static

Counts the number of bits in the source operand having a value of 1.

This intrinsic corresponds to the POPCNT instruction or a sequence of arithmetic and logic operations to calculate it.

Parameters
__AAn unsigned 32-bit integer operand.
Returns
A 32-bit integer containing the number of bits with value 1 in the source operand.
See also
_popcnt32

Definition at line 209 of file ia32intrin.h.

◆ __rdpmc()

static __inline__ unsigned long long __DEFAULT_FN_ATTRS __rdpmc ( int  __A)
static

Reads the specified performance-monitoring counter.

Refer to your processor's documentation to determine which performance counters are supported.

This intrinsic corresponds to the RDPMC instruction.

Parameters
__AThe performance counter to read.
Returns
The 64-bit value read from the performance counter.
See also
_rdpmc

Definition at line 486 of file ia32intrin.h.

◆ __rdtscp()

static __inline__ unsigned long long __DEFAULT_FN_ATTRS __rdtscp ( unsigned int __A)
static

Reads the processor's time-stamp counter and the IA32_TSC_AUX MSR (0xc0000103).

This intrinsic corresponds to the RDTSCP instruction.

Parameters
__AThe address of where to store the 32-bit IA32_TSC_AUX value.
Returns
The 64-bit value of the time-stamp counter.

Definition at line 501 of file ia32intrin.h.

◆ __readeflags()

static __inline__ unsigned int __DEFAULT_FN_ATTRS __readeflags ( void  )
static

Returns the program status-and-control EFLAGS register with the VM and RF flags cleared.

This intrinsic corresponds to the PUSHFD + POP instruction sequence.

Returns
The 32-bit value of the EFLAGS register.

Definition at line 310 of file ia32intrin.h.

◆ __rolb()

static __inline__ unsigned char __DEFAULT_FN_ATTRS_CONSTEXPR __rolb ( unsigned char  __X,
int  __C 
)
static

Rotates an 8-bit value to the left by the specified number of bits.

This operation is undefined if the number of bits exceeds the size of the value.

This intrinsic corresponds to the ROL instruction.

Parameters
__XThe unsigned 8-bit value to be rotated.
__CThe number of bits to rotate the value.
Returns
The rotated value.

Definition at line 555 of file ia32intrin.h.

◆ __rold()

static __inline__ unsigned int __DEFAULT_FN_ATTRS_CONSTEXPR __rold ( unsigned int  __X,
int  __C 
)
static

Rotates a 32-bit value to the left by the specified number of bits.

This operation is undefined if the number of bits exceeds the size of the value.

This intrinsic corresponds to the ROL instruction.

Parameters
__XThe unsigned 32-bit value to be rotated.
__CThe number of bits to rotate the value.
Returns
The rotated value.
See also
_rotl

Definition at line 630 of file ia32intrin.h.

◆ __rolw()

static __inline__ unsigned short __DEFAULT_FN_ATTRS_CONSTEXPR __rolw ( unsigned short  __X,
int  __C 
)
static

Rotates a 16-bit value to the left by the specified number of bits.

This operation is undefined if the number of bits exceeds the size of the value.

This intrinsic corresponds to the ROL instruction.

Parameters
__XThe unsigned 16-bit value to be rotated.
__CThe number of bits to rotate the value.
Returns
The rotated value.
See also
_rotwl

Definition at line 592 of file ia32intrin.h.

◆ __rorb()

static __inline__ unsigned char __DEFAULT_FN_ATTRS_CONSTEXPR __rorb ( unsigned char  __X,
int  __C 
)
static

Rotates an 8-bit value to the right by the specified number of bits.

This operation is undefined if the number of bits exceeds the size of the value.

This intrinsic corresponds to the ROR instruction.

Parameters
__XThe unsigned 8-bit value to be rotated.
__CThe number of bits to rotate the value.
Returns
The rotated value.

Definition at line 573 of file ia32intrin.h.

◆ __rord()

static __inline__ unsigned int __DEFAULT_FN_ATTRS_CONSTEXPR __rord ( unsigned int  __X,
int  __C 
)
static

Rotates a 32-bit value to the right by the specified number of bits.

This operation is undefined if the number of bits exceeds the size of the value.

This intrinsic corresponds to the ROR instruction.

Parameters
__XThe unsigned 32-bit value to be rotated.
__CThe number of bits to rotate the value.
Returns
The rotated value.
See also
_rotr

Definition at line 649 of file ia32intrin.h.

◆ __rorw()

static __inline__ unsigned short __DEFAULT_FN_ATTRS_CONSTEXPR __rorw ( unsigned short  __X,
int  __C 
)
static

Rotates a 16-bit value to the right by the specified number of bits.

This operation is undefined if the number of bits exceeds the size of the value.

This intrinsic corresponds to the ROR instruction.

Parameters
__XThe unsigned 16-bit value to be rotated.
__CThe number of bits to rotate the value.
Returns
The rotated value.
See also
_rotwr

Definition at line 611 of file ia32intrin.h.

◆ __writeeflags()

static __inline__ void __DEFAULT_FN_ATTRS __writeeflags ( unsigned int  __f)
static

Writes the specified value to the program status-and-control EFLAGS register.

Reserved bits are not affected.

This intrinsic corresponds to the PUSH + POPFD instruction sequence.

Parameters
__fThe 32-bit value to write to EFLAGS.

Definition at line 325 of file ia32intrin.h.

◆ _bswap()

static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR _bswap ( int  __A)
static

Swaps the bytes in the input, converting little endian to big endian or vice versa.

This intrinsic corresponds to the BSWAP instruction.

Parameters
__AA 32-bit integer operand.
Returns
A 32-bit integer containing the swapped bytes.

Definition at line 89 of file ia32intrin.h.

◆ _castf32_u32()

static __inline__ unsigned int __DEFAULT_FN_ATTRS_CAST _castf32_u32 ( float  __A)
static

Casts a 32-bit float value to a 32-bit unsigned integer value.

This intrinsic corresponds to the VMOVD / MOVD instruction in x86_64, and corresponds to the VMOVL / MOVL instruction in ia32.

Parameters
__AA 32-bit float value.
Returns
A 32-bit unsigned integer containing the converted value.

Definition at line 342 of file ia32intrin.h.

◆ _castf64_u64()

static __inline__ unsigned long long __DEFAULT_FN_ATTRS_CAST _castf64_u64 ( double  __A)
static

Casts a 64-bit float value to a 64-bit unsigned integer value.

This intrinsic corresponds to the VMOVQ / MOVQ instruction in x86_64, and corresponds to the VMOVL / MOVL instruction in ia32.

Parameters
__AA 64-bit float value.
Returns
A 64-bit unsigned integer containing the converted value.

Definition at line 357 of file ia32intrin.h.

◆ _castu32_f32()

static __inline__ float __DEFAULT_FN_ATTRS_CAST _castu32_f32 ( unsigned int  __A)
static

Casts a 32-bit unsigned integer value to a 32-bit float value.

This intrinsic corresponds to the VMOVQ / MOVQ instruction in x86_64, and corresponds to the FLDS instruction in ia32.

Parameters
__AA 32-bit unsigned integer value.
Returns
A 32-bit float value containing the converted value.

Definition at line 372 of file ia32intrin.h.

◆ _castu64_f64()

static __inline__ double __DEFAULT_FN_ATTRS_CAST _castu64_f64 ( unsigned long long  __A)
static

Casts a 64-bit unsigned integer value to a 64-bit float value.

This intrinsic corresponds to the VMOVQ / MOVQ instruction in x86_64, and corresponds to the FLDL instruction in ia32.

Parameters
__AA 64-bit unsigned integer value.
Returns
A 64-bit float value containing the converted value.

Definition at line 387 of file ia32intrin.h.

◆ _wbinvd()

static __inline__ void __DEFAULT_FN_ATTRS _wbinvd ( void  )
static

Definition at line 537 of file ia32intrin.h.