I think the cost would be something like:
+ case POPCOUNT: + *total = COSTS_N_INSNS (3); + return false;
Is that the cost when using popcountb? It is a lot more expensive when that instruction isn't available (like on most current machines). The rest (i.e. CLZ, CTZ) looks good to me. Segher