* [FFmpeg-devel] [PATCH] configure: Check for the AArch64 CRC extension (PR #20682)
@ 2025-10-09 11:52 Martin Storsjö via ffmpeg-devel
0 siblings, 0 replies; only message in thread
From: Martin Storsjö via ffmpeg-devel @ 2025-10-09 11:52 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Martin Storsjö
PR #20682 opened by Martin Storsjö (mstorsjo)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20682
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20682.patch
This does preparatory work for #20654.
From 2aa17941996502c1a4837bbef5c47b26df2c6fdd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Tue, 7 Oct 2025 15:28:36 +0300
Subject: [PATCH 1/2] configure: Use a different aarch64 feature in Clang
workaround
We use a dummy aarch64 feature to work around an issue in older
Clang, where an .arch line such as ".arch armv8.2-a" doesn't take
effect immediately, while one like ".arch armv8.2-a+feature" works.
Previously, we used "crc" for this dummy feature to add (as an
old feature that would be supported widely by old toolchains).
But as we may want to actually use crc features and detect whether
they are supported, we may want to switch to another feature.
Use the "fp" feature instead, for the purposes of this extra
feature in the .arch lines. (The "fp" feature indicates floating
point support, which is implicitly part of the baseline feature
set anyway.)
---
configure | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index 7828381b5d..4677bd0a1d 100755
--- a/configure
+++ b/configure
@@ -6427,10 +6427,10 @@ if enabled aarch64; then
# also had a bug (https://github.com/llvm/llvm-project/issues/32220)
# causing a plain ".arch <level>" to not have any effect unless it
# had an extra "+<feature>" included - but it was activated on the next
- # ".arch_extension" directive. Check if we can include "+crc" as dummy
+ # ".arch_extension" directive. Check if we can include "+fp" as dummy
# feature to make the .arch directive behave as expected and take
# effect right away.
- check_arch_level "${as_arch_level}+crc"
+ check_arch_level "${as_arch_level}+fp"
fi
enabled armv8 && check_insn armv8 'prfm pldl1strm, [x0]'
--
2.49.1
From 20054ff4c481c9411a3636dea35ef6fbb3d711cd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Tue, 7 Oct 2025 15:33:37 +0300
Subject: [PATCH 2/2] configure: Check for the AArch64 CRC extension
Handle this in the same way as other optional aarch64 extensions
like dotprod and i8mm.
---
configure | 7 ++++++-
libavutil/aarch64/asm.S | 9 +++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/configure b/configure
index 4677bd0a1d..19b91d17cd 100755
--- a/configure
+++ b/configure
@@ -475,6 +475,7 @@ Optimization options (experts only):
--disable-armv6t2 disable armv6t2 optimizations
--disable-vfp disable VFP optimizations
--disable-neon disable NEON optimizations
+ --disable-crc disable AArch64 CRC optimizations
--disable-dotprod disable DOTPROD optimizations
--disable-i8mm disable I8MM optimizations
--disable-sve disable SVE optimizations
@@ -2216,6 +2217,7 @@ ARCH_EXT_LIST_ARM="
armv6
armv6t2
armv8
+ crc
dotprod
i8mm
neon
@@ -2488,6 +2490,7 @@ SYSTEM_LIBRARIES="
TOOLCHAIN_FEATURES="
as_arch_directive
+ as_archext_crc_directive
as_archext_dotprod_directive
as_archext_i8mm_directive
as_archext_sve_directive
@@ -2820,6 +2823,7 @@ intrinsics_sse2_deps="sse2"
vfp_deps="arm"
vfpv3_deps="vfp"
setend_deps="arm"
+crc_deps="aarch64"
dotprod_deps="aarch64 neon"
i8mm_deps="aarch64 neon"
sve_deps="aarch64 neon"
@@ -6437,7 +6441,8 @@ if enabled aarch64; then
# internal assembler in clang 3.3 does not support this instruction
enabled neon && check_insn neon 'ext v0.8B, v0.8B, v1.8B, #1'
- archext_list="dotprod i8mm sve sve2"
+ archext_list="crc dotprod i8mm sve sve2"
+ enabled crc && check_archext_insn crc 'crc32x w0, w0, x0'
enabled dotprod && check_archext_insn dotprod 'udot v0.4s, v0.16b, v0.16b'
enabled i8mm && check_archext_insn i8mm 'usdot v0.4s, v0.16b, v0.16b'
enabled sve && check_archext_insn sve 'whilelt p0.s, x0, x1'
diff --git a/libavutil/aarch64/asm.S b/libavutil/aarch64/asm.S
index 2e4e451ec2..46c51debaa 100644
--- a/libavutil/aarch64/asm.S
+++ b/libavutil/aarch64/asm.S
@@ -40,6 +40,14 @@
.arch AS_ARCH_LEVEL
#endif
+#if HAVE_AS_ARCHEXT_CRC_DIRECTIVE
+#define ENABLE_CRC .arch_extension crc
+#define DISABLE_CRC .arch_extension nocrc
+#else
+#define ENABLE_CRC
+#define DISABLE_CRC
+#endif
+
#if HAVE_AS_ARCHEXT_DOTPROD_DIRECTIVE
#define ENABLE_DOTPROD .arch_extension dotprod
#define DISABLE_DOTPROD .arch_extension nodotprod
@@ -72,6 +80,7 @@
#define DISABLE_SVE2
#endif
+DISABLE_CRC
DISABLE_DOTPROD
DISABLE_I8MM
DISABLE_SVE
--
2.49.1
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-10-09 11:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-09 11:52 [FFmpeg-devel] [PATCH] configure: Check for the AArch64 CRC extension (PR #20682) Martin Storsjö via ffmpeg-devel
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ http://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git