[clang] [clang] [ARM] Explicitly enable NEON for Windows/Darwin targets (PR #122095)
Martin Storsjö via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 8 05:35:34 PST 2025
mstorsjo wrote:
> Or is it that this change allows other downstreams to patch the Linux issue in a way that does not break Windows and iOS in the process?
Exactly - this makes it more explicit upstream, to make it easier to tweak for downstreams for Linux targets, without breaking the other OS targets.
> If I'm using clang on Debian, that's where I would find this C can use Neon but assembly cannot problem.
Yes, exactly.
On Ubuntu 24.04:
```
$ cat neon.s
vadd.i8 d0, d0, d0
$ cat neon.c
void add(void) {
__asm__ __volatile__("vadd.i8 d0, d0, d0");
}
$ which clang
/usr/bin/clang
$ clang --version
Ubuntu clang version 18.1.3 (1ubuntu1)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
$ clang -target armv7-windows -c neon.c # succeeds
$ clang -target armv7-windows -c neon.s
neon.s:1:1: error: invalid instruction, any one of the following would fix this:
vadd.i8 d0, d0, d0
^
neon.s:1:1: note: instruction requires: NEON
vadd.i8 d0, d0, d0
^
neon.s:1:5: note: invalid operand for instruction
vadd.i8 d0, d0, d0
^
$ clang -target armv7-apple-darwin -c neon.c
neon.c:2:23: error: invalid instruction, any one of the following would fix this:
2 | __asm__ __volatile__("vadd.i8 d0, d0, d0");
| ^
<inline asm>:1:2: note: instantiated into assembly here
1 | vadd.i8 d0, d0, d0
| ^
neon.c:2:23: note: instruction requires: NEON
2 | __asm__ __volatile__("vadd.i8 d0, d0, d0");
| ^
<inline asm>:1:2: note: instantiated into assembly here
1 | vadd.i8 d0, d0, d0
| ^
neon.c:2:23: note: invalid operand for instruction
2 | __asm__ __volatile__("vadd.i8 d0, d0, d0");
| ^
<inline asm>:1:6: note: instantiated into assembly here
1 | vadd.i8 d0, d0, d0
| ^
1 error generated.
$ clang -target armv7-apple-darwin -c neon.s
neon.s:1:1: error: invalid instruction, any one of the following would fix this:
vadd.i8 d0, d0, d0
^
neon.s:1:1: note: instruction requires: NEON
vadd.i8 d0, d0, d0
^
neon.s:1:5: note: invalid operand for instruction
vadd.i8 d0, d0, d0
^
```
This obviously is a downstream issue - but I'm trying to make it more explicit upstream, to make it easier for the downstreams that do patch it.
https://github.com/llvm/llvm-project/pull/122095
More information about the cfe-commits
mailing list