POPC : Population count

Format:

SPA 5.0:
        {@{!}Pg}   POPC{.fmt}   Rd, {~}Sb   {&req_6}   {&rdN}   {&wrN}   {?sched}   ;   

.fmt:      { .32* } 
            Data width for population count.

POPC allows the following source Sb:
        Sb(register)
        Sb(constant with immediate address)
        Sb(#SIMM20)

Description:

The POPC instruction computes the population count of a {~}Sb. I.e. it counts the number of ones in {~}Sb. Supports 1's complement of the inputs via optional '~' on the Sb source.

Examples:

     POPC        R1,  R2;      // POPC of R2
     POPC        R1, ~R2;      // POPC of 0's in R2

Back to Index of Instructions