0

dead hachers! Background: Maybe you know mmx packing/unpacking instruction set, what howewer works on bytes and larger volumes, like shorts, words, etc.

Quesion: Are there any instructions for any x86_64 processor, to do the similar packing/unpacking but only for bits?

Purpose: It is an idea for optimizing the DES/AES bit shifts, but if you have other proposals about it, you may answer as well.

Thanks a lot for answers

Nate Eldredge
  • 48,811
  • 6
  • 54
  • 82
  • 1
    Could you be more specific about what you would want those instructions to do? I'm not clear which MMX packing instructions you have in mind; there's [`PACKSSWB`](https://www.felixcloutier.com/x86/packsswb:packssdw) and the like, but I'm not sure what that would mean in terms of bits. – Nate Eldredge Jan 15 '22 at 15:45
  • iin the result, the bits are shifted as they are shifted in the packssXX operation, but in smaller scale inside a byte of 2 byte value .ignoring sign saturation feature, what is not related for bits. Furher, it is for 2-x or 4-x blocks. Basically, it is the packing/unpacking for ranges, smaller then a byte – Peter Tschischik Jan 15 '22 at 15:50
  • 3
    I still don't quite understand, and I think some examples would help. But in any case, are you aware of [`PDEP`](https://www.felixcloutier.com/x86/pdep) / [`PEXT`](https://www.felixcloutier.com/x86/pext) ? – Nate Eldredge Jan 15 '22 at 15:53
  • yes, great! Thanks, i m looking for something like that! I m not aware of all instructions- i am ASKING for that here. Also if there are any similar, please answer. You can write it as an answer, i ll mark it correct. – Peter Tschischik Jan 15 '22 at 16:00
  • 1
    [What's a fast way to space-out bits within a word?](https://stackoverflow.com/q/47692902) includes `pdep`. Seems like a viable duplicate. Also I guess [Parallel bit deposit / parallel bit extract on intel compiler/LLVM?](https://stackoverflow.com/q/27363906) – Peter Cordes Jan 15 '22 at 17:21

0 Answers0