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 12:13] – [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 532: | Line 537: | ||
| The **lzcnt** instruction counts the number of zeros in an argument starting from the most significant bit. The **tzcnt** counts zeros starting from the least significant bit. For an argument that is not zero, **lzcnt** returns the number of zeros before the first 1 from the left, and **tzcnt** gives the number of zeros before the first 1 from the right. | The **lzcnt** instruction counts the number of zeros in an argument starting from the most significant bit. The **tzcnt** counts zeros starting from the least significant bit. For an argument that is not zero, **lzcnt** returns the number of zeros before the first 1 from the left, and **tzcnt** gives the number of zeros before the first 1 from the right. | ||
| - | 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. | + | 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> |
| - | BEXTR Contiguous bitwise extract. | + | <figure bextr_instr> |
| - | 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. | + | |
| - | PDEP Parallel | + | The **blsi** instruction extracts the single, lowest bit set to one, as shown in figure {{ref> |
| - | PEXT Parallel | + | |
| + | <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 | ||
| + | |||
| + | <figure pdep_instr> | ||
| + | {{ : | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | The **pext** instruction performs a parallel | ||
| + | |||
| + | <figure pext_instr> | ||
| + | {{ : | ||
| + | < | ||
| + | </ | ||