configure/riscv: detect fast CLZ

RISC-V defines the CLZ instruction as part of the ratified Zbb subset
of the (not yet ratified) bit mapulation extension (B). We can detect
it from the __riscv_zbb predefined constant. At least GCC 12 already
supports this correctly.

Note that the macro will be non-zero if supported, zero if enabled
in the compiler flags (e.g. -march=rv64gzbb) but not known to the
compiler, and undefined otherwise.
This commit is contained in:
Rémi Denis-Courmont 2022-09-12 18:53:18 +03:00 committed by James Almer
parent d808070547
commit ff14e37393
1 changed files with 6 additions and 0 deletions

6
configure vendored
View File

@ -5334,6 +5334,12 @@ elif enabled ppc; then
;;
esac
elif enabled riscv; then
if test_cpp_condition stddef.h "__riscv_zbb"; then
enable fast_clz
fi
elif enabled sparc; then
case $cpu in