On Tue, 2 Feb 2021, Michael Weiser wrote:
clang does not, however, support the .arch_extension directive. 3.9.1 complains about the directive, 11.0.0 seems to silently ignore it:
$ cat t.s .arch_extension crypto pmull v2.1q, v2.1d, v1.1d $ aarch64-unknown-linux-gnu-as -o t.o t.s $ clang+llvm-3.9.1-aarch64-linux-gnu/bin/clang -c -o t.o t.s t.s:1:1: error: unknown directive .arch_extension crypto ^ t.s:2:1: error: instruction requires: crypto pmull v2.1q, v2.1d, v1.1d ^ $ clang+llvm-11.0.0-aarch64-linux-gnu/bin/clang -c -o t.o t.s t.s:2:1: error: instruction requires: aes pmull v2.1q, v2.1d, v1.1d ^
Clang does actually support .arch_extension for aarch64 in general since Clang 8 - but the "crypto" extension seems to be a bit of a special case, as it expands to a number of other features, including aes and sha2, depending on the base architecture level:
https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/AArch64/AsmPa...
This routine is called when enabling extensions in .arch, but not in .arch_extension - which is a bug.
So ".arch_extension aes" would work, but setting the extension via the .arch directive is indeed more compatible.
// Martin