# Learn about function multiversioning

## In this learning path

- [Introduction](https://learn.arm.com/learning-paths/cross-platform/function-multiversioning/)
- [About function multiversioning](https://learn.arm.com/learning-paths/cross-platform/function-multiversioning/semantics/)
- [Example 1 - code generation](https://learn.arm.com/learning-paths/cross-platform/function-multiversioning/examples/)
- [Example 2 - runtime using ACLE intrinsics](https://learn.arm.com/learning-paths/cross-platform/function-multiversioning/examples2/)
- [Example 3 - inline assembly at runtime](https://learn.arm.com/learning-paths/cross-platform/function-multiversioning/examples3/)
- [Compatibility with streaming mode](https://learn.arm.com/learning-paths/cross-platform/function-multiversioning/streaming-mode/)
- [Further information on implementation](https://learn.arm.com/learning-paths/cross-platform/function-multiversioning/implementation-details/)
- [Changes from released compilers](https://learn.arm.com/learning-paths/cross-platform/function-multiversioning/changes-from-past-releases/)
- [Next Steps](https://learn.arm.com/learning-paths/cross-platform/function-multiversioning/_next-steps/)

## About this Learning Path

|  |  |
| --- | --- |
| Skill level: | Advanced |
| Reading time: | 1 hr |
| Last updated: | 06 Jul 2026 |

|  |  |
| --- | --- |
| Author: | Alexandros Lamprineas , Arm |
| Arm IP: | [Cortex-A](https://support.arm.com/?tab=compute-ip&Product%20Type=Application%20Processors) [Neoverse](https://support.arm.com/?tab=compute-ip&Product%20Type=Infrastructure%20Processors) |
| Tags: | [Performance and Architecture](https://learn.arm.com/tag/performance-and-architecture/) [Linux](https://learn.arm.com/tag/linux) [Android](https://learn.arm.com/tag/android) [macOS](https://learn.arm.com/tag/macos) [C](https://learn.arm.com/tag/c) [CPP](https://learn.arm.com/tag/cpp) [Runbook](https://learn.arm.com/tag/runbook) |

### Who is this for?

This is an advanced topic for developers interested in optimizing their C/C++ applications across Arm64 targets.

### What will you learn?

After completing this Learning Path, you'll be able to perform the following tasks:

- Use hardware features to tune your applications at function level.
- Create multiple versions of C/C++ functions for the targets that you intend to run applications on.
- Assist the compiler in generating optimal code for the targets, or provide your own optimized versions at source level.
- Automatically select the most appropriate function version at runtime.
- Reuse your optimized application binaries across various targets.

### Prerequisites

Before starting, you'll need the following prerequisites:

- Basic knowledge of GNU function attributes.
- Familiarity with indirect functions (ifuncs).
- Basic knowledge of loop vectorization.
- Familiarity with Arm assembly.
- A LLVM 20 compiler with runtime library support or GCC 16.

### Summary

You’ll implement function multiversioning for arm64 in C/C++ using the `target_version` and `target_clones` attributes, so a single binary contains feature-specific implementations. You’ll create versions keyed to architectural features such as `default`, `sve`, `sve2`, `simd`, `mops`, and `sme2` to enable runtime selection of the most suitable function. Through hands-on examples, you’ll compare code generation for a vectorized loop, write an SVE-based dot product with Arm C Language Extensions (ACLE), and mix SVE2 inline assembly with library calls where the compiler can emit `FEAT_MOPS` for `memcpy`. You’ll also cover streaming mode compatibility by keeping calling conventions consistent across function versions.

### Learn about function multiversioning

- [Introduction](https://learn.arm.com/learning-paths/cross-platform/function-multiversioning/)
- [About function multiversioning](https://learn.arm.com/learning-paths/cross-platform/function-multiversioning/semantics/)
- [Example 1 - code generation](https://learn.arm.com/learning-paths/cross-platform/function-multiversioning/examples/)
- [Example 2 - runtime using ACLE intrinsics](https://learn.arm.com/learning-paths/cross-platform/function-multiversioning/examples2/)
- [Example 3 - inline assembly at runtime](https://learn.arm.com/learning-paths/cross-platform/function-multiversioning/examples3/)
- [Compatibility with streaming mode](https://learn.arm.com/learning-paths/cross-platform/function-multiversioning/streaming-mode/)
- [Further information on implementation](https://learn.arm.com/learning-paths/cross-platform/function-multiversioning/implementation-details/)
- [Changes from released compilers](https://learn.arm.com/learning-paths/cross-platform/function-multiversioning/changes-from-past-releases/)
- [Next Steps](https://learn.arm.com/learning-paths/cross-platform/function-multiversioning/_next-steps/)
