Hi all,
On Tue, Feb 02, 2021 at 08:23:39AM -0500, Jeffrey Walton wrote:
I think my mentioning of llvm-as was a red herring. Looking at the output of clang -v, llvm-as isn't involved at all. This is supported by the man page stating that llvm-as accepts LLVM assembly and emits LLVM bytecode. It appears, clang implements the assembler internally and we'd need documentation on that. The clang man page even says so):
Clang always uses its integrated assembler unless you pass -fno-integrated-as. If you use -fno-integrated-as, then be sure you
I've downloaded binary builds of clang for aarch64 from https://releases.llvm.org/download.html. 3.9.1 was the oldest prebuilt toolchain I could find there and 11.0.0 the most recent.
As expected, a one-liner with just a pmull throws errors with gas and the two clangs:
$ cat t.s pmull v2.1q, v2.1d, v1.1d $ aarch64-unknown-linux-gnu-as -v -o t.o t.s GNU assembler version 2.35.1 (aarch64-unknown-linux-gnu) using BFD version (Gentoo 2.35.1 p2) 2.35.1 t.s: Assembler messages: t.s:1: Error: selected processor does not support `pmull v2.1q,v2.1d,v1.1d' $ clang+llvm-3.9.1-aarch64-linux-gnu/bin/clang -c -o t.o t.s t.s:1: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:1:1: error: instruction requires: aes pmull v2.1q, v2.1d, v1.1d ^
This can be solved for all three with the -march option:
$ aarch64-unknown-linux-gnu-as -o t.o t.s -march=armv8-a+crypto $ clang+llvm-3.9.1-aarch64-linux-gnu/bin/clang -c -o t.o t.s -march=armv8-a+crypto $ clang+llvm-11.0.0-aarch64-linux-gnu/bin/clang -c -o t.o t.s -march=armv8-a+crypto $
They also all support the .arch directive:
$ cat t.s .arch armv8-a+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 $ clang+llvm-11.0.0-aarch64-linux-gnu/bin/clang -c -o t.o t.s $
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 ^