This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:multiasm:papc:chapter_6_7 [2025/10/22 08:08] – [BMI1 and BMI2 Instructions] ktokarz | en:multiasm:papc:chapter_6_7 [2025/10/23 12:56] (current) – [BMI1 and BMI2 Instructions] ktokarz | ||
|---|---|---|---|
| Line 283: | Line 283: | ||
| The **set// | The **set// | ||
| + | |||
| + | The **popcnt** instruction counts the number of bits equal to " | ||
| + | |||
| + | The **crc32** instruction implements the calculation of the cyclic redundancy check in hardware. The polynomial of the value 11EDC6F41h is fixed. | ||
| + | |||
| ===== Control transfer instructions ===== | ===== Control transfer instructions ===== | ||
| Before describing the instructions used for control transfer, we will discuss how the destination address can be calculated. The destination address is the address given to the processor to make a jump to. | Before describing the instructions used for control transfer, we will discuss how the destination address can be calculated. The destination address is the address given to the processor to make a jump to. | ||
| Line 531: | Line 536: | ||
| Other instructions manipulate bits as the group name stays. | Other instructions manipulate bits as the group name stays. | ||
| - | LZCNT counts zeros from the most significant bit (MSB), while TZCNT counts from the least significant bit (LSB). For a non-zero input, LZCNT returns the number of zeros before the first 1 from the left, and TZCNT returns | + | The **lzcnt** instruction |
| + | The **bextr** instruction copies the number of bits from source to destination arguments starting at the chosen position. The third argument specifies the number of bits and the starting bit position. Bits 7:0 of the third operand specify the starting bit position, while bits 15:8 specify the maximum number of bits to extract, as shown in figure {{ref> | ||
| + | |||
| + | <figure bextr_instr> | ||
| + | {{ : | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | The **blsi** instruction extracts the single, lowest bit set to one, as shown in figure {{ref> | ||
| + | |||
| + | <figure blsi_instr> | ||
| + | {{ : | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | The **blsmsk** instruction sets all lower bits below a first bit set to 1. It is shown in figure {{ref> | ||
| + | |||
| + | <figure blsmsk_instr> | ||
| + | {{ : | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | The **blsr** instruction resets (clears the bit to zero value) the lowest set bit. It is shown in figure {{ref> | ||
| + | |||
| + | <figure blsr_instr> | ||
| + | {{ : | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | The **bzhi** instruction resets high bits starting from the specified bit position, as shown in figure {{ref> | ||
| + | |||
| + | <figure bzhi_instr> | ||
| + | {{ : | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | The **pdep** instruction performs a parallel deposit of bits using a mask. Its behaviour is shown in figure {{ref> | ||
| + | |||
| + | <figure pdep_instr> | ||
| + | {{ : | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | The **pext** instruction performs a parallel extraction of bits using a mask. Its behaviour is shown in figure {{ref> | ||
| + | |||
| + | <figure pext_instr> | ||
| + | {{ : | ||
| + | < | ||
| + | </ | ||
| - | BEXTR Contiguous bitwise extract. | ||
| - | BLSI Extract lowest set bit. | ||
| - | BLSMSK Set all lower bits below first set bit to 1. | ||
| - | BLSR Reset lowest set bit. | ||
| - | BZHI Zero high bits starting from specified bit position. | ||
| - | LZCNT Count the number leading zero bits. | ||
| - | PDEP Parallel deposit of bits using a mask. | ||
| - | PEXT Parallel extraction of bits using a mask. | ||
| - | TZCNT Count the number trailing zero bits. | ||