Skip to content

aarch64: Check for assembler support for various aarch64 extensions

Martin Storsjö requested to merge mstorsjo/dav1d:aarch64-exts into master

First check if the assembler supports the ".arch" directive, and what architecture levels are supported.

In principle, we'd only need to check for support for ".arch armv8.2-a", since that's enough for enabling the i8mm and sve2 extensions.

However, recent Clang versions (before version 17) wasn't able to enable the dotprod and i8mm extensions via the ".arch_extension" directives, so check for support for armv8.4-a and armv8.6-a as well, which enable dotprod and i8mm implicitly.

This allows assembling these instructions on most commonly available GCC and Clang based toolchains, while still allowing toggling support for the instruction sets on and off within the source files.

Within assembly, we disable these extensions by default, so that instructions enabled within these extension sets can't be used by accident in unintended functions. Code meaning to use these extensions can be assembled like this:

#if HAVE_SVE
ENABLE_SVE
// code
DISABLE_SVE
#endif

CC @arpadpanyik-arm - this should allow assembling the various extensions, wherever supported, while being able to build on older tools as well, and being able to enable/disable the extensions within one .S file as long as the tools support it. (This also matches quite closely how the same is done within FFmpeg.)

Merge request reports