Issue 151473
Summary When using AArch64 instructions without their feature enabled, clang error is misleading for MTE and SPE
Labels clang
Assignees
Reporter DavidSpickett
    Compiler explorer:
[SPE](https://godbolt.org/z/Yqns8sqj3)
[MTE](https://godbolt.org/z/c383ExbG8)

When compiling an SPE instruction without SPE enabled via. -march:
```
void fn() {
    asm volatile ("psb csync");
}
```
```
$ ./bin/clang -target aarch64-linux-gnu -march=armv9.6-a /tmp/test.c -o /tmp/test.o -c
/tmp/test.c:2:19: error: instruction requires: spe
    2 |     asm volatile ("psb csync");
      |                   ^
<inline asm>:1:2: note: instantiated into assembly here
    1 |         psb csync
      | ^
1 error generated
```
Except that `spe` is the name llvm-mc uses, clang wants `profile`:
```
$ ./bin/clang -target aarch64-linux-gnu -march=armv9.6-a+profile /tmp/test.c -o /tmp/test.o -c
```
Same thing happens with MTE:
```
void fn() {
    asm volatile ("ldg x8, [x8]");
}
```
This tells you it requires `mte` but the clang option is actually `memtag`.

I know that `mte` vs. `memtag` is a historical artifact where different compilers implemented it at different times and clang ended up changing to match gcc, but not in the backend.

SPE could be the same story, or it could be that `spe` is bundled with other features, into `profile`.

Either way, the error message is useful when the name is correct, so it's a shame it is not for these ones. It comes straight from llvm-mc, so I see why it is using the `-mattr` names at the moment.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to