Arm Working On Function Multi-Versioning For GCC

A feature supported by the GNU Compiler Collection (GCC) that sadly isn't used more often is function multi-versioning (FMV) for supporting multiple versions of a function with the given function selected based upon the target processor in use. GCC FMV on x86_64 allows for different functions to be used whether supporting SSE4.2, AVX, or even a particular CPU micro-architecture. Arm is finally working on GCC function multi-versioning support for AArch64.

GCC function multi-versioning on x86_64 makes it easy for developers to create optimized functions for hot code paths that at run-time will be used by a compatible/relevant processor. Function Multi-Versioning allows for the run-time handling of the most appropriate code path for a given function without having to resort to shipping multiple binaries or raising the base requirements for your software. But currently GCC FMV only works for x86/x86_64. As well, this currently only works with GCC's C++ front-end.


The FMV syntax example from the GCC documentation on function multi-versioning.


Arm is looking at supporting GCC Function Multi-versioning for their CPU architecture and have recently published a beta specification around it.

Arm announced their beta work on FMV support and is currently seeking feedback from developers on their proposed handling of it. With FMV on Arm they are looking to be able to let developers use a target Arm version as one of the planned changes. On Arm's GitHub is their proposed specification for Arm FMV.