From patchwork Fri May 26 08:03:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Storsj=C3=B6?= X-Patchwork-Id: 41832 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:c51c:b0:10c:5e6f:955f with SMTP id gm28csp1145005pzb; Fri, 26 May 2023 01:03:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6dOEvOgsqWMJ7xH9xYJGchWiFmiE9gDjO1Eir0FnDQ9bmQC2pLZ7KEyIjIs8UvhswtLZIm X-Received: by 2002:a17:907:7daa:b0:96f:d04c:1d84 with SMTP id oz42-20020a1709077daa00b0096fd04c1d84mr754369ejc.12.1685088210235; Fri, 26 May 2023 01:03:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685088210; cv=none; d=google.com; s=arc-20160816; b=lb0IZ1wuPZ6E2ApQvuT1g0QmusE8w7aMAJK4Ca0jt0X5TM6i9LeGmarVkxFY61ozft ewSbnXyBghbkwfBq1FbcqOlKFk8r98/ZFYtm9P9NHOluKQKWP3MWTIQjrc4ZIybAq+/2 Rh3VY7qjV+cNwPc6DReDdFEy8GPJeYJNlxY7tw6jUs+xoThvckqbN0CgLJ+/oL16G/uC ZkFJNVc8kakP2+043JpY/g37N2fbwwIZMli2vkiGfFnes9n7QWYfu3uy767WIFQdDA0a 5sPAfkxB0PEWNEWQipxpSY3lI8ALbwkIw+ADJUf55GmiKPAp86y5Wj9mHbIWyelY6gaq /CIw== 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 :dkim-signature:delivered-to; bh=SJgUB53rDJO7B9VfWbwO2ui9Rb47c6NHg8fW6qYU8C0=; b=QVSA6pHIxGeDgsbOQ2Gx7DUpvqWiOlm/jyh4JaFST6E2K3yReD04rSHPOCV8iLOpT3 BRTyr45StO7fjFlw2lFec7RIclYYzy4O8J12eY6nJ5oibwtufRWprsmy1g5W12kFyLOI msqwSTDCL5HMecQU8fppek2DFV8qMrX7tJ/SbCnzyjdfXPiQobpbayAbsM7jKnLcAPr+ sFyrY6Oyk81zBokjHG6TYWCE3beq93TEh0CWlTflKMQ+4WBF4UyaB72rGp844vLESoGx QZufRPTVckZbSQu3JDhymYfME95Md3Y4wfDpobOQtGjBZ47kwKfis6BHkdakVS758DUH crNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@martin-st.20221208.gappssmtp.com header.s=20221208 header.b=gqbRh9qN; 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 z13-20020a1709060acd00b009662223f515si405273ejf.665.2023.05.26.01.03.29; Fri, 26 May 2023 01:03:30 -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; dkim=neutral (body hash did not verify) header.i=@martin-st.20221208.gappssmtp.com header.s=20221208 header.b=gqbRh9qN; 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 729A168C07D; Fri, 26 May 2023 11:03:24 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6ECC468C091 for ; Fri, 26 May 2023 11:03:17 +0300 (EEST) Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-4f3a611b3ddso2269881e87.0 for ; Fri, 26 May 2023 01:03:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=martin-st.20221208.gappssmtp.com; s=20221208; t=1685088196; x=1687680196; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=acagDSYhdq7056Wg6SktGzB/auJImajSYlFtr1r6ZlQ=; b=gqbRh9qNOW2J4Ex63gMIT6jLFlfQPLj3gFy7K8lVvKotVCLQhno7DcPwC8cUM3e44n G8MnmMo2kdkjg5YSbEdq6eqsWRWCK2iKW7SpjlaviC5hkwp3P3l+dU27UmnCs+WrN7pS 0x3RlPRoIqeLiOuxjvjphWI6uExxzIvvLOsvSyzLBk6xjjlE+3WXTmW73l/wjmC2/AZc bpPl5PyZlwermUZNDZvQWvAwpGJK5FiqFEpr/RGhqxjCXwwZS8Cd1gb/Rdpxc9HEOH/+ vPA5QrXgzm9pZ/IsofkTM/BoQfxP0qISMDeCMw8xtXfpbZ/0IMeSUM29MAywtqybYJvp be5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685088196; x=1687680196; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=acagDSYhdq7056Wg6SktGzB/auJImajSYlFtr1r6ZlQ=; b=JcA2g0S4EvZVZ7DFdFkYb1qBHre15wZkfWU/TTGNq5lnoaJcMGEN9MY27ZeAaPybw2 6aQW9yA0UBIeAvmI/sMgQ3SARtF1sdo6RL3EjPCni3a5DlM3Q5KBf8A98wlY8pYBRx8/ e69b+goAZcWoAH25tBFNrm5gd7n0/KtNF11Z1HETKh16tHkqIIbjoAhnfAC9EiWhg2AO UoyisHOR7h0qDGSE6cP3K2+IXpxQ8uqgS3SM+V4FPFQqje6gfXtedNQXiM80S/WYUbaj uFXLf2nfnktg6Xjz67Cn+6gEkIUrF1sd6wvxdrYJ/CgkS5tLI9WZaKlfxVj0KRwiaA3H 3Uvg== X-Gm-Message-State: AC+VfDwJ1t15HwkgCsuGW5WRxSyofFMOWyTTBBuokI9M+2NYHiRKIveo YvCeHPUCegINMmJ64yOJi3WgMHnLPL0mKtPLki1wOw== X-Received: by 2002:ac2:446d:0:b0:4f3:b9c8:5da with SMTP id y13-20020ac2446d000000b004f3b9c805damr343203lfl.33.1685088196113; Fri, 26 May 2023 01:03:16 -0700 (PDT) Received: from localhost (dsl-tkubng21-58c01c-243.dhcp.inet.fi. [88.192.28.243]) by smtp.gmail.com with ESMTPSA id u2-20020a056512040200b004f4c3feb9f1sm517251lfk.62.2023.05.26.01.03.15 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 26 May 2023 01:03:15 -0700 (PDT) From: =?utf-8?q?Martin_Storsj=C3=B6?= To: ffmpeg-devel@ffmpeg.org Date: Fri, 26 May 2023 11:03:12 +0300 Message-Id: <20230526080315.83424-1-martin@martin.st> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/4] configure: aarch64: Support assembling the dotprod and i8mm arch extensions 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: Bsbu8s+vaA8A These are available since ARMv8.4-a and ARMv8.6-a respectively, but can also be available optionally since ARMv8.2-a. Check if these are available for use unconditionally (e.g. if compiling with -march=armv8.6-a), or if they can be enabled with specific assembler directives. Use ".arch_extension " for enabling a specific extension in assembly; the same can also be achieved with ".arch armv8.2-a+", but with .arch_extension is easier to combine multiple separate features. Enabling these extensions requires setting a base architecture level of armv8.2-a with .arch. Don't add ".arch armv8.2-a" unless necessary; if the base level is high enough (which might unlock other extensions without .arch_extension), we don't want to lower it. Only add .arch/.arch_extension if needed, e.g. current clang fails to recognize the dotprod and i8mm features in .arch_extension, but can successfully assemble these instructions if part of the baseline set with -march. --- configure | 77 ++++++++++++++++++++++++++++++++++++++++- libavutil/aarch64/asm.S | 13 +++++++ 2 files changed, 89 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 87f7afc2e1..3c7473efb2 100755 --- a/configure +++ b/configure @@ -454,6 +454,8 @@ Optimization options (experts only): --disable-armv6t2 disable armv6t2 optimizations --disable-vfp disable VFP optimizations --disable-neon disable NEON optimizations + --disable-dotprod disable DOTPROD optimizations + --disable-i8mm disable I8MM optimizations --disable-inline-asm disable use of inline assembly --disable-x86asm disable use of standalone x86 assembly --disable-mipsdsp disable MIPS DSP ASE R1 optimizations @@ -1154,6 +1156,41 @@ check_insn(){ check_as ${1}_external "$2" } +check_archext_insn(){ + log check_archext_insn "$@" + feature="$1" + base_arch="$2" + archext="$3" + instr="$4" + # Check if the assembly is accepted unconditionally in either inline or + # external assembly. + check_inline_asm ${feature}_inline "\"$instr\"" + check_as ${feature}_external "$instr" + + enabled_any ${feature}_inline ${feature}_external || disable ${feature} + + if disabled ${feature}_external; then + # If not accepted unconditionally, check if we can assemble it + # with a suitable .arch_extension directive. + test_as <