As discussed here: https://lwn.net/Articles/691932/
GCC6.0 adds target_clones multiversioning. This functionality is
an odd cross between the cpu_dispatch and 'target' MV, but is compatible
with neither.
This attribute allows you to list all options, then emits a separately
optimized version of each function per-option (similar to the
cpu_specific attribute). It automatically generates a resolver, just
like the other two.
The mangling however, is... ODD to say the least. The mangling format is:
<normal_mangling>.<option string>.<option ordinal>.
However, the 'option ordinal' is where it gets strange. When parsing the
list, 'default' is moved to the end, so "foo,default,bar", foo is 0, bar is 1,
and default is 2.
Otherwise, emission rules should be the same as 'target'.
Sorry, I don't think it's acceptable from a design perspective to have mutable state in an Attr object, even if you can ensure that only one client of the Attr will be using the state at a time. CodeGen is going to need to track its own index into the attribute's list of clones.