3 ms·
Wow, I can't wait to play around with PDEP and PEXT instructions.
by gorset 15y ago
Wow, I can't wait to play around with PDEP and PEXT instructions.
- seunosewa 15y agoWhat do they do that's so exciting?
- thwarted 15y agoThe document is pretty easy to navigate if you know which instructions you want to look up. On page 488, PDEP and PEXT are Parallel Bits Deposit and Parallel Bits Extract. They are essentially scatter/gather instructions for bits. PDEP uses a mask in the second source operand (the third operand) to transfer/scatter contiguous low order bits in the first source operand (the second operand) into the destination (the first operand). PEXT uses a mask in the second source operand (the third operand) to transfer either contiguous or non-contiguous bits in the first source operand (the second operand) to contiguous low order bit positions in the destination (the first operand).
- gorset 15y agoI want to use them for speeding up some critical code for compression/decompresison, the current code is not straightforward. How to implement the instructions in software is covered in Hacker's delight, and has some additions in the latest revisions (http://www.hackersdelight.org/revisions.pdf http://www.hackersdelight.org/revisions.pdf). There's also a chapter in Matters Computational (http://www.jjj.de/fxt/#fxtbook http://www.jjj.de/fxt/#fxtbook) "CPU instructions often missed" that mentions them: > Primitives for permutations of bits, see section 1.29.2 on page 81. A bit-gather and a bit-scatter instruction for sub-words of all sizes a power of 2 would allow for arbitrary permutations (see [FXT: bits/bitgather.h] and [FXT: bits/bitseparate.h] for versions working on complete words).
- e_alf 15y agoYou can finally implement INTERCAL's squiggle operator efficiently!