-
Notifications
You must be signed in to change notification settings - Fork 19
Description
x86's SIMD support is a huge mess, and it's not clearly delineated by vector width. I noticed this when looking at #97: _mm_mullo_epi64 is not an SSE intrinsic nor even an AVX2 intrinsic, but requires AVX512! This is very hard to catch, and I only noticed it because Clippy flagged its usage as an MSRV violation.
We should add some sort of check to ensure we don't accidentally use any unsupported intrinsics on x86. My first thought was the Clippy disallowed_methods lint, but Clippy lints can only be configured on a per-workspace basis, and we need something that can vary per-file.
My idea is this: using whatever method @raphlinus used to generate the core_arch modules (it doesn't seem to be checked into the repository), we can gather a list of intrinsics that are supported at a given feature level. Then, for the generated implementations (currently sse4_2.rs and avx2.rs), we create an inner module that re-exports only the supported intrinsics from core::arch::x86_64, and wildcard-import from that inner module. This is done to avoid any "unused import" lint warnings while not requiring us to maintain a full list of every single intrinsic we call into.