From patchwork Fri Sep 9 15:48:44 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: 37791 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:139a:b0:8f:1db5:eae2 with SMTP id w26csp997676pzh; Fri, 9 Sep 2022 08:49:18 -0700 (PDT) X-Google-Smtp-Source: AA6agR4j0reMX+ZpzRUR+RLgdBC2l98aTWztR8PHYNEzO+ohgUkl9iFnjRRLe3ewvU1U1ovj2ZP3 X-Received: by 2002:a17:906:8a4e:b0:740:2450:d69a with SMTP id gx14-20020a1709068a4e00b007402450d69amr10280483ejc.523.1662738558491; Fri, 09 Sep 2022 08:49:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662738558; cv=none; d=google.com; s=arc-20160816; b=gemKBykw0kGnAyCrcCD6tKp/3XPnN6YPba6v2kNnWfctw9B7aYHOmsQVByDCkkKmCl +3zttOyK18XCfPA/i+GspsDcTT6J+sL3WAHi47Bid+sPtuksfhiHySDm1xOsm2HEr0j1 j6g3a4RmZ9n0mDvioSVqhDcZRT1yMfOB5sLtg7x+lwOacWWrkX/8nVaDeO4vkBtX3ybx W5zz8Sgk3IpoocOL4yo+9j2WmfDY6aNE1s8hvASiHa04SfLk60UgJtUy9912Cty+Jdao 0apmluD4NK/lUqQC+BWFbgq8Ryn9sjxfFC0AoWK4bjV+fz5uqaiRAS/vtuLnW69AOs4a lTDw== 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=ONZBQHtoJvrfNV/QO568SnsxRZmyZnJQQeRezT+R7iE=; b=cJC7xUAobQ0+MPrXWhAOaTGH+vnB0mloMnHQRnUIJBzvzkwXzHeNlzp+PoRYpE5Joh Wz3PFY9NvoLfTLdNNdVrV8cKZy0gUBqMWo+Nh7pWSaTURiub4aw0srSyq0pQaoFqOrSx QYyR1mc/LiY8DbfJwPOZ2svvmdJ15yfAQ99nM2JWTR4Tli7RbtZLHIZCAUEb2TfH5lB9 5Kq1Lr9F/yDkHhEdpcMFp7zhqQiQJLCDOw+pmGZjOoXnnVYKArNfuBBpe4BUO2U4iVtH 0gzH6MXixkNaaPnDiVCKaehzBvlGZ9jPJRdL+DDpvDrzJDNH+QAB6sZqFwcQIzdXUP1J Zzwg== 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 hd20-20020a170907969400b00710487d3a4fsi826246ejc.67.2022.09.09.08.49.18; Fri, 09 Sep 2022 08:49:18 -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 91B4068BB0A; Fri, 9 Sep 2022 18:49: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 EA4D168BAFE for ; Fri, 9 Sep 2022 18:48:59 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id A4C8BC00AF for ; Fri, 9 Sep 2022 18:48:59 +0300 (EEST) From: remi@remlab.net To: ffmpeg-devel@ffmpeg.org Date: Fri, 9 Sep 2022 18:48:44 +0300 Message-Id: <20220909154859.68954-3-remi@remlab.net> X-Mailer: git-send-email 2.37.2 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: NkWqi1pJKuof 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