4 ms·
C has a better SIMD story than Rust or Zig currently.
by anonymoushn 3y ago
C has a better SIMD story than Rust or Zig currently.
- pjmlp 3y agoNot really, some C compilers have language specific extensions that exposed SIMD, C as defined by ISO and POSIX, does not. Rust has them as part of the language, as does .NET, D, as will C++26 get, eventually Java as well,...
- anonymoushn 3y agoRust hides operations like register-register vpshufb behind unsafe despite this instruction having no implications for memory safety and crashing on CPUs that don't support it (just like auto-vectorized "safe" code built for a different set of extensions than the CPU it's running on). Zig formerly exposed a subset of SIMD operations via LLVM intrinsics, but this was a bug and was fixed, so we now must use inline assembly to recreate immintrin.h and arm_neon.h.
- pjmlp 3y agoDoesn't change the fact that neither immintrin.h or arm_neon.h. are listed on ISO C, or POSIX standards.
- anonymoushn 3y agoDoes this matter? Rust and Zig have no standard. Each has fewer compilers than C has compilers that ship these headers.