diff mbox series

[FFmpeg-devel,3/5] configure/riscv: detect fast CLZ

Message ID 20220906165027.91347-3-remi@remlab.net
State New
Headers show
Series [FFmpeg-devel,1/5] doc: reference the RISC-V specification | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Rémi Denis-Courmont Sept. 6, 2022, 4:50 p.m. UTC
From: Rémi Denis-Courmont <remi@remlab.net>

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.
---
 configure | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/configure b/configure
index 9e51abd0d3..b7dc1d8656 100755
--- a/configure
+++ b/configure
@@ -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