aarch64: Print the SVE vector length in libavutil/tests/cpu.c

This makes this aspect more visible in test logs.

Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
Martin Storsjö 2023-12-05 00:09:07 +02:00
parent e6eabb7ce7
commit b1ee2af843
4 changed files with 43 additions and 0 deletions

View File

@ -4,3 +4,5 @@ OBJS += aarch64/cpu.o \
NEON-OBJS += aarch64/float_dsp_neon.o \
aarch64/tx_float_neon.o \
SVE-OBJS += aarch64/cpu_sve.o \

View File

@ -30,4 +30,8 @@
#define have_sve(flags) CPUEXT(flags, SVE)
#define have_sve2(flags) CPUEXT(flags, SVE2)
#if HAVE_SVE
int ff_aarch64_sve_length(void);
#endif
#endif /* AVUTIL_AARCH64_CPU_H */

View File

@ -0,0 +1,29 @@
/*
* Copyright (c) 2023 Martin Storsjo
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "config.h"
#include "asm.S"
ENABLE_SVE
function ff_aarch64_sve_length, export=1
cntb x0
ret
endfunc

View File

@ -23,6 +23,10 @@
#include "libavutil/cpu.h"
#include "libavutil/avstring.h"
#if ARCH_AARCH64
#include "libavutil/aarch64/cpu.h"
#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
@ -161,6 +165,10 @@ int main(int argc, char **argv)
print_cpu_flags(cpu_flags_raw, "raw");
print_cpu_flags(cpu_flags_eff, "effective");
printf("threads = %s (cpu_count = %d)\n", threads, cpu_count);
#if ARCH_AARCH64
if (cpu_flags_raw & AV_CPU_FLAG_SVE)
printf("sve_vector_length = %d\n", 8 * ff_aarch64_sve_length());
#endif
return 0;
}