From patchwork Mon Sep 12 15:53:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= X-Patchwork-Id: 37860 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1c:b0:96:9ee8:5cfd with SMTP id c28csp163021pzh; Mon, 12 Sep 2022 08:54:04 -0700 (PDT) X-Google-Smtp-Source: AA6agR7rRT1ARtbRbhfoapXQVPSXv9g/rTUCb+PrDQXYwlQijMAMXwHpRGQHNtlvGhXIWRFRaWvd X-Received: by 2002:aa7:cc8a:0:b0:446:7668:2969 with SMTP id p10-20020aa7cc8a000000b0044676682969mr6507393edt.206.1662998044242; Mon, 12 Sep 2022 08:54:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662998044; cv=none; d=google.com; s=arc-20160816; b=AFSUWaPkR9c6IF5elcpH09vKP71eX9l91nL5TrIveLuVmrGYG3y34Ma1qnDgsylziI Or43I/jlQR6+bRr3ySOl3mMZ1s2/Tm6/v8rqaMrLyD2rwsD5SMslf64HB/grv/gxryQJ 9HLIZP4keTF1vp5aN3e6n21DLBb3pInntaSISEfSAwuUD2BXQzWykbvniJW8ss7BPSUe 4rg6wpMtaK1CAUl7u4Kzccv6R3YqDZd08NKSVBcJLxytjqhW/vrtZdv8SsFkF869r7TI KDYwWGnP+m3buO3f78GAyb2ScPiwkfTM53nrpiPgR0Wll3SzVR/rVr2B+7QOx7gZJwoC ydUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=ONZBQHtoJvrfNV/QO568SnsxRZmyZnJQQeRezT+R7iE=; b=EqZezQw24PBeK5pa2937qN4G4yrPgoc788fEx4bd4UVOmywO3b/ywaSuSJXaqkUghe ZQHp5BjTWu5+2nDktilDqAXJsEg+pvgrbYnCgvhqze98VfJ3lLfMkpkAbNjSLas5ww37 OGzk4H1JNR1T3hN+zgd/sHmfJ9FaJkoZ7LVKmY5jrTmMITlBOIBRFRJEmAScMzcdbq5u T9nEijeU/v2hc+c6Mdp2YNAAxMA6Ah6couVnUPEvvwUKcJuANs/UYZrLZ1hDRxKUQeIh nsR2aS4UAOXXRuO16dpckdv9i1XMIFHZJEmAXQdbxOAHtRPkSfiKZqQ41btMIVVtRQED 2k0A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id dt12-20020a170907728c00b0076f0a1c1501si3902490ejc.698.2022.09.12.08.54.03; Mon, 12 Sep 2022 08:54:04 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B190F68BB4C; Mon, 12 Sep 2022 18:53:43 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from ursule.remlab.net (vps-a2bccee9.vps.ovh.net [51.75.19.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C217A68BB38 for ; Mon, 12 Sep 2022 18:53:34 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id 74580C00AF for ; Mon, 12 Sep 2022 18:53:34 +0300 (EEST) From: remi@remlab.net To: ffmpeg-devel@ffmpeg.org Date: Mon, 12 Sep 2022 18:53:18 +0300 Message-Id: <20220912155333.59843-3-remi@remlab.net> X-Mailer: git-send-email 2.37.2 In-Reply-To: <2652141.mvXUDI8C0e@basile.remlab.net> References: <2652141.mvXUDI8C0e@basile.remlab.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 03/18] configure/riscv: detect fast CLZ X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: kVXV1hJT7sfP From: RĂ©mi Denis-Courmont 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 --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