From patchwork Sat Sep 3 12:35:59 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: 37626 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:139a:b0:8f:1db5:eae2 with SMTP id w26csp1542639pzh; Sat, 3 Sep 2022 05:36:09 -0700 (PDT) X-Google-Smtp-Source: AA6agR7GohTquRVvBhsiVM1Ghdjsh+e1NptQ8TyLyJnJW5gjFqBRjVy5Dvm2cPxbbCAKlE+o2fZy X-Received: by 2002:a05:6402:4150:b0:44a:ec16:def4 with SMTP id x16-20020a056402415000b0044aec16def4mr10432766eda.21.1662208569330; Sat, 03 Sep 2022 05:36:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662208569; cv=none; d=google.com; s=arc-20160816; b=UkfwPwsCntzIS0I6x+27p5xTY6ddkg8P8N5Al36vxTyW00Xd5A26VJl8tcCSVbxq5j Vm5q5A9Kx9yZC2xRIcuAk9V+wUjEnDvl2YivFpVUa6mu5Av7yWxJfT4vwnn7tSzsgEpy 0W9/aEQCsta8lWjAKPxi/T6nBfZC1QAhrrzakyCxM6Mud/QN0TQK9Zf+OyIdsDS8tc6E sP9N5oqFLDWs+n0KIDk+yE3EPEMSRrvwx5Ls96pw/BXzve0kQ/ItZrxU2v4V7GOQZF4v N4X/qzfCoXm1Wmf3mqZnIdAnkJyR5w56vXQCKeLAvklI6yeOiTf0wUKTm0TorrRCkhj6 JPGg== 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=Ixc/sd4k9xOPGQh46wv00uKpRc0SQDcFtaH47h6BkLn7NoWpXW5Ue31ZhQyThdRGhG RSk2H0ItPv5fGnwRwicfQF0+hEFW3ZP9Z5cF7P68rM1lUWqrZkT7iW7DxdCp16Fs3e3R 8oZSc0zdPjS1iJmdKQ0sLHzL8HDRn39tOGhnzRPjmJi/aOMkl1k0WHScKUa8Yh/gJqnB XwZPVNoCjWN8f5NekMvjJXRtFjtjMtXidOykmjqqFGtJDb6QZqlCJG6VKefMQzk3bqYv 0ncB2bXPF7/LC8PZaU+STSRvB6Y5tfOEoJhGRn7cdKbbRHAc2Rj+2aQ1BH0YMBah1EKA RLog== 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 y25-20020a170906471900b00730f3cb968fsi3282125ejq.990.2022.09.03.05.36.09; Sat, 03 Sep 2022 05:36:09 -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 4D2CD68B545; Sat, 3 Sep 2022 15:36:07 +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 7BFA968B545 for ; Sat, 3 Sep 2022 15:36:00 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id 04BA4C0003 for ; Sat, 3 Sep 2022 15:35:59 +0300 (EEST) From: remi@remlab.net To: ffmpeg-devel@ffmpeg.org Date: Sat, 3 Sep 2022 15:35:59 +0300 Message-Id: <20220903123559.78526-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: +4Mf20tCGenb 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