Interesting to see this on HN, just a couple months after I ran into the same problem with GCC's intrinsic popcount myself on a project! I found that I needed to use an "-march" argument for GCC to actually emit POPCNT instructions.
If you want to use instructions that are only available on or after a specific cpu generation, then you need to tell your compiler to target that cpu's instruction set.
EDIT: running "echo | gcc -v -E - 2>&1 | grep cc1" shows the command line, which says "-mtune=generic -march=x86-64". I do not know what "-march=x86-64" implies, except SSE2.
0 - https://gcc.gnu.org/ml/gcc-help/2012-12/msg00074.html
1 - https://gcc.gnu.org/onlinedocs/gcc/i386-and-x86-64-Options.h...