John McKown asked:

| Why do I need to know the number of 1 bits in    
| each individual byte in a GPR? Is it _that_    
| common a question in application or system  
| code? 

Say you were an operating system software developer.
Let's further say that you wanted to write a really
efficient cell pool manager. What instructions would
you need to make that run, really, really quickly?
Let's go a bit more down this rabbit hole and say
you wanted to write the MVS Cell Pool Services code.
Would you love to have such an instruction? You bet 
your sweet ass you would. So you see we DO need this 
instruction.

Folks who need to keep track of essentially identical 
things, which can be managed with [or as] a vector of
storage infixes, eventually come to see the value of 
using, for maximum management/tracking efficiency, a 
bit map. There are many such vectors in an MVS system. 
For example, JES2 SPOOL space ("track") allocation. 

Bit maps easily minimize the storage overhead needed
to manage such things, but processing them is slow
and inefficient with the available instruction set,
and typical code that does so does not execute as 
fast as one might hope because of pipeline stalls. 

Hash tables are another application that immediately
comes to mind. Lots of things with a vector or array 
structure could be suitable candidates for the use of
such an instruction. I've already been drooling. 

I would say I am looking forward to seeing how some
of our favorite code gets improved when they finally
get the chance to use all these new whizbang opcodes,
but I would be too conservative to touch about any of
that stuff, since it's been working fine for decades,
and the machines are so freakin' fast these days ...
 
Frank Swarbrick quoted Majek's technical blog
http://blogger.popcnt.org/2007/09/magic-popcount-popcnt-command.html
which quoted Frank de Groot blog (now offline): 

| Magic popcount (popcnt) command:    
|     
| This "population count" instruction counts the   
| set bits in a register, and is so useful that   
| the NSA demands that all computers they purchase    
| implement it in hardware."    

I can't confirm the validity of that assertion, but
if you Google POPCNT and/or popcount and a few other
interesting keywords that come to mind, interesting
stuff pops out (to coin a phrase).

--
WB
 

Reply via email to