4 ms·
Don’t bother. Autovectorization almost fundamentally doesn’t work. You can write code using explicit vectors and it’s not too bad, though less cross platform t
by astrange 4y ago
Don’t bother. Autovectorization almost fundamentally doesn’t work.
You can write code using explicit vectors and it’s not too bad, though less cross platform than you’d like.
An actual answer involves things like restrict and alignment keywords.
- janwas 4y agoExplicit vectors can be made portable (to SSE4/AVX2/AVX-512/NEON/SVE/SVE2/RISC-V V/WASM SIMD) using the Highway library which gives you wrapper functions over the platform's intrinsics, emulating missing functionality where required: github.com/google/highway. Disclosure: I am the main author.