Open andrewrk opened 4 years ago
Thanks to @alichay the x86 and x86-64 parts of this are complete!
Does it make sense to have the arch-avr label? While that's a valid target, of course, I can't see a situation where it makes sense for the compiler to run natively on it.
This is implemented for a few variants. The next step in this issue is to enumerate what exactly is still missing, extract issues for each one, then close this issue.
To be filled eventually (by me/others) the tier 1 support matrix:
| freestanding | Linux | Darwin | Windows | Wasi
--------- | ----------- | ------| ------- | -------- | ----
x86_64 | ? | ? | ? | ? | ?
x86 | ? | ? | ? | ? | ?
aarch64 | ? | ? | ? | ? | ?
arm | ? | ? | ? | ? | ?
mips64 | ? | ? | ? | ? | ?
mips | ? | ? | ? | ? | ?
risc64 | ? | ? | ? | ? | ?
powerpc32 | ? | ? | ? | ? | ?
powerpc64 | ? | ? | ? | ? | ?
wasm32 | ? | ? | ? | ? | ?
Here you go @andrewrk
Comparing tier 1 targets
| freestanding | Linux | macOS | Windows | Wasi
--------- | ----------- | ------| ------- | -------- | ----
x86_64 | ✓ | ✓ | ✓ | ✓ | N/A
x86 | ✓ | ✓ | ✓ | ✓ | N/A
aarch64 | ✗ | ✓ | ✓ | ✓ | N/A
arm | ✗ | ✓ | N/A | ✗ | N/A
mips | ✗ | ✗ | N/A | N/A | N/A
risc64 | ✗ | ✗ | N/A | N/A | N/A
powerpc32 | ✗ | ✓ | N/A | N/A | N/A
powerpc64 | ✗ | ✓ | N/A | N/A | N/A
wasm32 | ✗ | ✗ | N/A | N/A | ✓
(not sure if wasm32 standard even has the concept of feature detection via SIMD yet) Why:
Looking at detectNativeCpuAndFeatures in lib\std\zig\system\NativeTargetInfo.zig .x86_64, .x86 handled at first
lib\std\zig\system\windows.zig .aarch64, .aarch64_be, .aarch64_32
lib\std\zig\system\linux.zig .arm, .armeb, .thumb, .thumbeb, .aarch64, .aarch64_be, .aarch64_32 .sparc64 .powerpc, .powerpcle, .powerpc64, .powerpc64le
lib\std\zig\system\darwin\macos.zig .aarch64, .aarch64_be, .aarch64_32 => {
cc @alexrp this issue may be of interest to you.
Currently we rely on LLVM to do this:
https://github.com/ziglang/zig/blob/48cef8d5be24c40b4c845f6b07c78abd6c3d1b0d/lib/std/zig/system.zig#L790-L793
https://github.com/ziglang/zig/blob/48cef8d5be24c40b4c845f6b07c78abd6c3d1b0d/src-self-hosted/stage2.zig#L1156-L1167
The LLVM functions we are currently calling probably have some helpful code to look at when doing this implementation.
LLVM getHostCPUFeatures