From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id D17F946681 for ; Tue, 30 May 2023 12:30:55 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6DFF268C20B; Tue, 30 May 2023 15:30:52 +0300 (EEST) Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 647DB68C033 for ; Tue, 30 May 2023 15:30:45 +0300 (EEST) Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-4f4e71a09a7so4883754e87.1 for ; Tue, 30 May 2023 05:30:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=martin-st.20221208.gappssmtp.com; s=20221208; t=1685449844; x=1688041844; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=flfg/l3g4m7HFSKYXQZiF5SeKw07UNZYyRlgRM9O4Vg=; b=kqfIt0LF3hxJrBKE3did21hKXFH+A0h439XcQ+jlL5GHAjPaE0Tdb+oUdr4e0UQlF1 9GpcWtmKZasHAhMS2yE67JqVJ6SfM3ZB3Tg2Po1uX1hyCXE9dCsOOoY+Id5pOO4I8PwL oRiStMa8j3T3vr1a76Ib9+mzmaDn8GxK0D3qOTguP37BSQiIl93NtEpKSY/1aZfK8xWh qAqWRITpn4XyS+TLQx7qL9amasnA0pMyyIx2lfHHm8nCTh9XmypnAsUdfs2Iyidydifd ixrlIlzIjjakfeZdABANnY/Ffi5Msb5XsmYamF7nUOApR6aRJIYFTFZxG7oN3e0X0Mnd HiXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685449844; x=1688041844; 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=flfg/l3g4m7HFSKYXQZiF5SeKw07UNZYyRlgRM9O4Vg=; b=X0v/07kSnOLkkNDrYtf1ui+ojK1Yyt98g7eUvDbMnbsvZVb8miIyS6aHmUOs42yQPM 0a/FEKkOxT54DhRKfrvJKGdJwKbRofbXDUeQzCTH3D7wOfc3cCZtETMENBL9yM9V3jLK mhlsw3p7rbP5TCX//3erd9cE2iJYLlrOqOezvnmu6zpe+cdhk/8NwnKDVgf1GHMys4ab QF79+N1LA+z/xcwzw0JmcVg/+yoWJpHTNOtmiZWRfIclS6ABe+wj7Ue0rpkfFXIi2cJt TC6r4EHOFk6zLqRrHbjeHsepLNLc0G9kOR+SGjGZQL7J+f91MbDC4pwbQO5agaOYn6mU SkqQ== X-Gm-Message-State: AC+VfDzOTWhKX0/9gyrbxqMfpt7zciCvyHubDoqKG2J13kXEn0Emw4Eb XjN4BGaE2F6tQtJVfG5oq+McaBQah33dUacC0G4YQw== X-Google-Smtp-Source: ACHHUZ77yTRJLx/SWiktjpaQrhtR3tgDf0GBuPtb2Y48EmhCk4G4rptIhKR9VLX4T+UNSk2hND52AQ== X-Received: by 2002:ac2:4464:0:b0:4eb:3cac:23b9 with SMTP id y4-20020ac24464000000b004eb3cac23b9mr737085lfl.9.1685449844417; Tue, 30 May 2023 05:30:44 -0700 (PDT) Received: from localhost (dsl-tkubng21-58c01c-243.dhcp.inet.fi. [88.192.28.243]) by smtp.gmail.com with ESMTPSA id q20-20020ac25294000000b004f3945751b2sm331029lfm.43.2023.05.30.05.30.43 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 30 May 2023 05:30:43 -0700 (PDT) From: =?UTF-8?q?Martin=20Storsj=C3=B6?= To: ffmpeg-devel@ffmpeg.org Date: Tue, 30 May 2023 15:30:39 +0300 Message-Id: <20230530123043.52940-1-martin@martin.st> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 1/5] 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: These are available since ARMv8.4-a and ARMv8.6-a respectively, but can also be available optionally since ARMv8.2-a. Check if ".arch armv8.2-a" and ".arch_extension {dotprod,i8mm}" are supported, and check if the instructions can be assembled. Current clang versions fail to support the dotprod and i8mm features in the .arch_extension directive, but do support them if enabled with -march=armv8.4-a on the command line. (Curiously, lowering the arch level with ".arch armv8.2-a" doesn't make the extensions unavailable if they were enabled with -march; if that changes, Clang should also learn to support these extensions via .arch_extension for them to remain usable here.) --- Simplified the detection logic somewhat; check if ".arch armv8.2-a" and ".arch_extension {dotprod,i8mm}" are available, then check if the instruction can be assembled. This way, we check exactly the same thing as we are going to assemble in the end, so there shouldn't be any risk of build breakage due to testing and building subtly different things. --- configure | 81 ++++++++++++++++++++++++++++++++++++++++- libavutil/aarch64/asm.S | 11 ++++++ 2 files changed, 91 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 495493aa0e..50eb27ba0e 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,43 @@ check_insn(){ check_as ${1}_external "$2" } +check_arch_level(){ + log check_arch_level "$@" + level="$1" + check_as tested_arch_level ".arch $level" + enabled tested_arch_level && as_arch_level="$level" +} + +check_archext_insn(){ + log check_archext_insn "$@" + feature="$1" + instr="$2" + # Check if the assembly is accepted in inline assembly. + check_inline_asm ${feature}_inline "\"$instr\"" + # We don't check if the instruction is supported out of the box by the + # external assembler (we don't try to set ${feature}_external) as we don't + # need to use these instructions in non-runtime detected codepaths. + + disable $feature + + enabled as_arch_directive && arch_directive=".arch $as_arch_level" || arch_directive="" + + # Test if the assembler supports the .arch_extension $feature directive. + arch_extension_directive=".arch_extension $feature" + test_as <>$TMPH +enabled aarch64 && + echo "#define AS_ARCH_LEVEL $as_arch_level" >>$TMPH + if enabled x86asm; then append config_files $TMPASM cat > $TMPASM <