configure: add detection of SME-I16I64 extension

This commit is contained in:
Georgii Zagoruiko
2026-03-02 21:33:27 +00:00
committed by Martin Storsjö
parent 70691bbb27
commit 905348df9d
8 changed files with 36 additions and 2 deletions

11
configure vendored
View File

@@ -485,6 +485,7 @@ Optimization options (experts only):
--disable-sve disable SVE optimizations
--disable-sve2 disable SVE2 optimizations
--disable-sme disable SME optimizations
--disable-sme-i16i64 disable SME-I16I64 optimizations
--disable-sme2 disable SME2 optimizations
--disable-inline-asm disable use of inline assembly
--disable-x86asm disable use of standalone x86 assembly
@@ -1238,6 +1239,7 @@ check_archext_name_insn(){
log check_archext_name_insn "$@"
feature="$1"
archext="$2"
archextdir=$(printf '%s' "$2" | tr '-' '_')
instr="$3"
instr2="$4"
# Check if the assembly is accepted in inline assembly.
@@ -1252,7 +1254,7 @@ check_archext_name_insn(){
# Test if the assembler supports the .arch_extension $archext directive.
arch_extension_directive=".arch_extension $archext"
test_as <<EOF && enable as_archext_${archext}_directive || arch_extension_directive=""
test_as <<EOF && enable as_archext_${archextdir}_directive || arch_extension_directive=""
$arch_directive
$arch_extension_directive
EOF
@@ -2304,6 +2306,7 @@ ARCH_EXT_LIST_ARM="
sve
sve2
sme
sme_i16i64
sme2
"
@@ -2575,6 +2578,7 @@ TOOLCHAIN_FEATURES="
as_archext_sve_directive
as_archext_sve2_directive
as_archext_sme_directive
as_archext_sme_i16i64_directive
as_archext_sme2_directive
as_dn_directive
as_fpu_directive
@@ -2917,6 +2921,7 @@ i8mm_deps="aarch64 neon"
sve_deps="aarch64 neon"
sve2_deps="aarch64 neon sve"
sme_deps="aarch64 neon sve sve2"
sme_i16i64_deps="aarch64 neon sve sve2 sme"
sme2_deps="aarch64 neon sve sve2 sme"
map 'eval ${v}_inline_deps=inline_asm' $ARCH_EXT_LIST_ARM
@@ -6555,13 +6560,14 @@ 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="arm_crc dotprod i8mm sve sve2 sme sme2"
archext_list="arm_crc dotprod i8mm sve sve2 sme sme_i16i64 sme2"
enabled arm_crc && check_archext_name_insn arm_crc 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'
enabled sve2 && check_archext_insn sve2 'sqrdmulh z0.s, z0.s, z0.s'
enabled sme && check_archext_insn sme 'smstart' 'cntb x0'
enabled sme_i16i64 && check_archext_name_insn sme_i16i64 sme-i16i64 'smstart' 'smopa za0.d, p0/m, p0/m, z0.h, z1.h'
enabled sme2 && check_archext_insn sme2 'smstart' 'sdot za.s[w10, 0], {z0.b-z3.b}, {z4.b-z7.b}'
# Disable the main feature (e.g. HAVE_NEON) if neither inline nor external
@@ -8392,6 +8398,7 @@ if enabled aarch64; then
echo "SVE enabled ${sve-no}"
echo "SVE2 enabled ${sve2-no}"
echo "SME enabled ${sme-no}"
echo "SME-I16I64 enabled ${sme_i16i64-no}"
echo "SME2 enabled ${sme2-no}"
fi
if enabled arm; then

View File

@@ -88,6 +88,14 @@
#define DISABLE_SME
#endif
#if HAVE_AS_ARCHEXT_SME_I16I64_DIRECTIVE
#define ENABLE_SME_I16I64 .arch_extension sme-i16i64
#define DISABLE_SME_I16I64 .arch_extension nosme-i16i64
#else
#define ENABLE_SME_I16I64
#define DISABLE_SME_I16I64
#endif
#if HAVE_AS_ARCHEXT_SME2_DIRECTIVE
#define ENABLE_SME2 .arch_extension sme2
#define DISABLE_SME2 .arch_extension nosme2
@@ -102,6 +110,7 @@ DISABLE_I8MM
DISABLE_SVE
DISABLE_SVE2
DISABLE_SME
DISABLE_SME_I16I64
DISABLE_SME2

View File

@@ -30,6 +30,7 @@
#define HWCAP2_AARCH64_SVE2 (1 << 1)
#define HWCAP2_AARCH64_I8MM (1 << 13)
#define HWCAP2_AARCH64_SME (1 << 23)
#define HWCAP2_AARCH64_SME_I16I64 (1 << 24)
#define HWCAP2_AARCH64_SME2 (1ULL << 37)
static int detect_flags(void)
@@ -51,6 +52,8 @@ static int detect_flags(void)
flags |= AV_CPU_FLAG_I8MM;
if (hwcap2 & HWCAP2_AARCH64_SME)
flags |= AV_CPU_FLAG_SME;
if (hwcap2 & HWCAP2_AARCH64_SME_I16I64)
flags |= AV_CPU_FLAG_SME_I16I64;
if (hwcap2 & HWCAP2_AARCH64_SME2)
flags |= AV_CPU_FLAG_SME2;
@@ -78,6 +81,8 @@ static int detect_flags(void)
flags |= AV_CPU_FLAG_I8MM;
if (have_feature("hw.optional.arm.FEAT_SME"))
flags |= AV_CPU_FLAG_SME;
if (have_feature("hw.optional.arm.FEAT_SME_I16I64"))
flags |= AV_CPU_FLAG_SME_I16I64;
if (have_feature("hw.optional.armv8_crc32"))
flags |= AV_CPU_FLAG_ARM_CRC;
if (have_feature("hw.optional.arm.FEAT_SME2"))
@@ -156,6 +161,10 @@ static int detect_flags(void)
if (IsProcessorFeaturePresent(PF_ARM_SME_INSTRUCTIONS_AVAILABLE))
flags |= AV_CPU_FLAG_SME;
#endif
#ifdef PF_ARM_SME_I16I64_INSTRUCTIONS_AVAILABLE
if (IsProcessorFeaturePresent(PF_ARM_SME_I16I64_INSTRUCTIONS_AVAILABLE))
flags |= AV_CPU_FLAG_SME_I16I64;
#endif
#ifdef PF_ARM_SME2_INSTRUCTIONS_AVAILABLE
if (IsProcessorFeaturePresent(PF_ARM_SME2_INSTRUCTIONS_AVAILABLE))
flags |= AV_CPU_FLAG_SME2;
@@ -194,6 +203,9 @@ int ff_get_cpu_flags_aarch64(void)
#ifdef __ARM_FEATURE_CRC32
flags |= AV_CPU_FLAG_ARM_CRC;
#endif
#ifdef __ARM_FEATURE_SME_I16I64
flags |= AV_CPU_FLAG_SME_I16I64;
#endif
#ifdef __ARM_FEATURE_SME2
flags |= AV_CPU_FLAG_SME2;
#endif

View File

@@ -31,6 +31,7 @@
#define have_sve(flags) CPUEXT(flags, SVE)
#define have_sve2(flags) CPUEXT(flags, SVE2)
#define have_sme(flags) CPUEXT(flags, SME)
#define have_sme_i16i64(flags) CPUEXT(flags, SME_I16I64)
#define have_sme2(flags) CPUEXT(flags, SME2)
#if HAVE_SVE

View File

@@ -189,6 +189,8 @@ int av_parse_cpu_caps(unsigned *flags, const char *s)
{ "sve2", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_SVE2 }, .unit = "flags" },
{ "sme", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_SME }, .unit = "flags" },
{ "crc", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ARM_CRC }, .unit = "flags" },
{ "sme_i16i64", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_SME_I16I64 }, .unit = "flags" },
{ "sme2", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_SME2 }, .unit = "flags" },
#elif ARCH_MIPS
{ "mmi", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_MMI }, .unit = "flags" },

View File

@@ -80,6 +80,7 @@
#define AV_CPU_FLAG_SME (1 <<12)
#define AV_CPU_FLAG_ARM_CRC (1 <<13)
#define AV_CPU_FLAG_SME2 (1 <<14)
#define AV_CPU_FLAG_SME_I16I64 (1 <<15)
#define AV_CPU_FLAG_SETEND (1 <<16)
#define AV_CPU_FLAG_MMI (1 << 0)

View File

@@ -49,6 +49,7 @@ static const struct {
{ AV_CPU_FLAG_SVE, "sve" },
{ AV_CPU_FLAG_SVE2, "sve2" },
{ AV_CPU_FLAG_SME, "sme" },
{ AV_CPU_FLAG_SME_I16I64, "sme_i16i64" },
{ AV_CPU_FLAG_ARM_CRC, "crc" },
{ AV_CPU_FLAG_SME2, "sme2" },
#elif ARCH_ARM

View File

@@ -377,6 +377,7 @@ static const struct {
{ "SVE", "sve", AV_CPU_FLAG_SVE },
{ "SVE2", "sve2", AV_CPU_FLAG_SVE2 },
{ "SME", "sme", AV_CPU_FLAG_SME },
{ "SME-I16I64", "sme_i16i64", AV_CPU_FLAG_SME_I16I64 },
{ "CRC", "crc", AV_CPU_FLAG_ARM_CRC },
{ "SME2", "sme2", AV_CPU_FLAG_SME2 },
#elif ARCH_ARM