3 ms·
POPCNT was not from the future, it was from the past. The Intel designers only assumed that this belongs to the operations that would not be frequently used in
by adrian_b 2y ago
POPCNT was not from the future, it was from the past.
The Intel designers only assumed that this belongs to the operations that would not be frequently used in the applications expected for their processors.
This was caused in part because they were not personally familiar with such applications. Even if POPCNT actually has a very wide area of applicability, during the seventies of the 20th century the only people who were concerned with the speed of executing POPCNT were some who worked at cryptographic applications and at that time almost all such work was classified.
However, with such operations there is always a chicken and egg problem. When they are not implemented in hardware, the programmers and the compiler writers avoid expressing algorithms with them and use various workarounds to implement in a different way the algorithms that would benefit from them.
This leads to a low frequency of use of such operations, which is then used to justify that it is not necessary to implement them in hardware.
The correct analysis whether such operations would be worthwhile when implemented in hardware requires much more work in writing alternative versions of various algorithms, to be run in simulated hardware, and this is almost never done.
- sumtechguy 2y agoThere are also a few different algorithms to handle it https://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetNaive https://graphics.stanford.edu/~seander/bithacks.html#CountBi... x86 started as basically a calculator chip. Not a lot of need in that particular space/usecase for it, and more importantly silicon space for it. However, what is interesting is how long it took to add it to the x86 set of instructions. But at least we have it now.