if you are targeting more than one specific platform, do you like, include the immintrin.h header and use #ifdef to conditionally use avx512 if it's available on someone's platform?
It would be simpler to use the portable intrinsics from github.com/google/highway (disclosure: I am the main author).
You include a header, and use the same functions on all platforms; the library provides wrapper functions which boil down to the platform's intrinsics.
From what I have seen, this is unfortunately not very useful: it mainly only includes operations that the compiler is often able to autovectorize anyway (simple arithmetic). Support for anything more interesting such as swizzles seems nonexistent. Also, last I checked, this was only available on GCC 11+; has that changed?