Description
There are new architecture hwprobe features exposed by recent linux versions. The docs are here: https://docs.kernel.org/arch/riscv/hwprobe.html
I think we have implemented up to RISCV_HWPROBE_EXT_ZAWRS, but no further. We should add support for the rest of the supported extensions.
This entails:
- Proposing extension bitmask assignments for (standard) extensions that don't have them already. This is done via the https://github.com/riscv-non-isa/riscv-c-api-doc repo (note that there are some proposed but not yet landed bitmask assignments in the open PRs for that repo, which new proposals should not conflict with).
- Add the
RISCVExtensionBitmaskto the relevant extensions. - Implement detection in
llvm/lib/TargetParser/Host.cpp(used by-march=native) andcompiler-rt/lib/builtins/cpu_model/riscv.c(used by ifuncs)
There is no compiler-rt interface for exposing vendor-specific extensions (which have a different hwprobe keys), but we may still be able to detect them in llvm/lib/TargetParser/Host.cpp for -march=native.
This would also be a good opportunity to move away from the deprecated RISCV_HWPROBE_KEY_CPUPERF_0, and to RISCV_HWPROBE_KEY_MISALIGNED_SCALAR_PERF, and also implement the same for RISCV_HWPROBE_KEY_MISALIGNED_VECTOR_PERF potentially (this can be a separate PR).