Intel publishes Feature Guide , which also applies to GCC. You will have to write your own backup code if you use these built-in functions.
You can achieve automatic implementation switching using IFUNC resolvers , but for non-library code, using conditional expressions or function pointers is probably easier.
gcc/config/i386/i386.md gcc/config/i386/i386.c, GCC 8, pext .