7.8 Function Multiversioning

With the GNU C++ front end, for target i386, you may specify multiple
versions of a function, where each function is specialized for a
specific target feature. At runtime, the appropriate version of the
function is automatically executed depending on the characteristics of
the execution platform. Here is an example.

In the above example, four versions of function foo are created. The
first version of foo with the target attribute "default" is the default
version. This version gets executed when no other target specific
version qualifies for execution on a particular platform. A new version
of foo is created by using the same function signature but with a
different target string. Function foo is called or a pointer to it is
taken just like a regular function. GCC takes care of doing the
dispatching to call the right version at runtime. Refer to the
GCC wiki on Function Multiversioning for more details.