[FFmpeg-devel] [PATCH] riscv: detect fast CLZ from Zbb extension

remi at remlab.net remi at remlab.net
Sat Sep 3 15:35:03 EEST 2022


From: Rémi Denis-Courmont <remi at remlab.net>

RISC-V defines the CLZ instruction as part of the Zbb subset of the
bit mapulation extension (B). We can detect it from the __riscv_zbb
predefined constant. It will be non-zero if supported, zero if enabled
in the compiler flags but not supported by the compiler, and undefined
otherwise.
---
 configure | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/configure b/configure
index 932ea5b553..b54ff5fc44 100755
--- a/configure
+++ b/configure
@@ -5331,6 +5331,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
-- 
2.37.2



More information about the ffmpeg-devel mailing list