From patchwork Sat Sep 3 12:35:03 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: 37625 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:139a:b0:8f:1db5:eae2 with SMTP id w26csp1542187pzh; Sat, 3 Sep 2022 05:35:14 -0700 (PDT) X-Google-Smtp-Source: AA6agR5KY2T7z/QhTinIlKmYBaJr4SDkwaXI+H3yhfsR4n9b3SLsviig2WWR1vw2B80etscq8+68 X-Received: by 2002:a17:906:491:b0:73d:c060:7cef with SMTP id f17-20020a170906049100b0073dc0607cefmr30589962eja.111.1662208514112; Sat, 03 Sep 2022 05:35:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662208514; cv=none; d=google.com; s=arc-20160816; b=elxnwr6sLQ8qI0k1nd62eI1yrO/UF8XdnVZfVfBdPziSyuAor8rpJqm4LT8x5wdIQe d1DOw7sZsuGrgn2hRsXrLXbLRubeOWt3c02BZanCCNbOdNHmVnJ55t2E2gUmaA3vW+5M TIgmmwTmuOHcBGMfwSpXCruMa1MO/6nhb2haVGeiK0fEZoO+o5CVUt4y3RI4YKmHVJU6 lRrkdjwAqhNIYCN29GBZwyIizui+6Y17ihU6VwpisJ1zLWU9HD6+CLQ82D05cZWy9Mdo X8SGcmQQyiR+MlDV49vqR+D2yaag2GkBiqgxjbgxSxhu6KmhRrU1j0xq45fMEXKnkV0e UTDg== 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:message-id:date:to:from :delivered-to; bh=QxSTC6zPorqZUICmvOqZXISBMKNdyVqIHtxQ138UsBE=; b=jZ7Kc9Cg7F4c0BvMcNzLbDcWIMjy2eBpQkvIZcEFqmqEja8GNV9UEliLgQ1HdRyt8j 0i2zzWBNf4OpiK3WUUwxDC5Bty7jocsKVbqDVl1wmWZnRtUaF0Mq9VM16DqXh8QxIj1K UNRPmIRxSMwaW6oQo8HlfEZ0UJ1IISH1XYreDRBhzWfX5hdMlltPdjWyQmxNiWsBFtPy V64bpjbOiM6659bekfEP1W5nux+dp56oHwGjIs6Ku3+P7/2QSxo1DIqiDhwJXYgor1YM Yj4fbPhG+g+y7hezYwU0pQOeE1IjaiZmxRhPhw7v9NS616uo9l8q2OVZmZOb4t+Se+Q8 md+w== 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 i10-20020a0564020f0a00b0043df391fc57si3782288eda.542.2022.09.03.05.35.13; Sat, 03 Sep 2022 05:35:14 -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 41A0C68B8BF; Sat, 3 Sep 2022 15:35:11 +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 CDC4168B291 for ; Sat, 3 Sep 2022 15:35:04 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id 9F2C2C0003 for ; Sat, 3 Sep 2022 15:35:03 +0300 (EEST) From: remi@remlab.net To: ffmpeg-devel@ffmpeg.org Date: Sat, 3 Sep 2022 15:35:03 +0300 Message-Id: <20220903123503.78451-1-remi@remlab.net> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] riscv: detect fast CLZ from Zbb extension 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: B9mY/BewfMdS From: RĂ©mi Denis-Courmont 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