1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

riscv: test for assembler support

This should fix the build on LLVM 16 and earlier, at the cost of turning
all non-RVV optimisations off.

Signed-off-by: Brad Smith <brad@comstyle.com>
This commit is contained in:
Rémi Denis-Courmont 2023-12-05 17:54:26 +02:00 committed by Brad Smith
parent 769c36b013
commit b98349b205
9 changed files with 24 additions and 11 deletions

View File

@ -91,10 +91,10 @@ ffbuild/.config: $(CONFIGURABLE_COMPONENTS)
SUBDIR_VARS := CLEANFILES FFLIBS HOSTPROGS TESTPROGS TOOLS \
HEADERS ARCH_HEADERS BUILT_HEADERS SKIPHEADERS \
ARMV5TE-OBJS ARMV6-OBJS ARMV8-OBJS VFP-OBJS NEON-OBJS \
ALTIVEC-OBJS VSX-OBJS RVV-OBJS MMX-OBJS X86ASM-OBJS \
ALTIVEC-OBJS VSX-OBJS MMX-OBJS X86ASM-OBJS \
MIPSFPU-OBJS MIPSDSPR2-OBJS MIPSDSP-OBJS MSA-OBJS \
MMI-OBJS LSX-OBJS LASX-OBJS OBJS SLIBOBJS SHLIBOBJS \
STLIBOBJS HOSTOBJS TESTOBJS
MMI-OBJS LSX-OBJS LASX-OBJS RV-OBJS RVV-OBJS \
OBJS SLIBOBJS SHLIBOBJS STLIBOBJS HOSTOBJS TESTOBJS
define RESET
$(1) :=

3
configure vendored
View File

@ -2114,6 +2114,7 @@ ARCH_EXT_LIST_PPC="
"
ARCH_EXT_LIST_RISCV="
rv
rvv
"
@ -2634,6 +2635,7 @@ ppc4xx_deps="ppc"
vsx_deps="altivec"
power8_deps="vsx"
rv_deps="riscv"
rvv_deps="riscv"
loongson2_deps="mips"
@ -6121,6 +6123,7 @@ elif enabled ppc; then
elif enabled riscv; then
enabled rv && check_inline_asm rv '".option arch, +zbb\nrev8 t0, t1"'
enabled rvv && check_inline_asm rvv '".option arch, +v\nvsetivli zero, 0, e8, m1, ta, ma"'
elif enabled x86; then

View File

@ -15,6 +15,7 @@ OBJS-$(HAVE_LASX) += $(LASX-OBJS) $(LASX-OBJS-yes)
OBJS-$(HAVE_ALTIVEC) += $(ALTIVEC-OBJS) $(ALTIVEC-OBJS-yes)
OBJS-$(HAVE_VSX) += $(VSX-OBJS) $(VSX-OBJS-yes)
OBJS-$(HAVE_RV) += $(RV-OBJS) $(RV-OBJS-yes)
OBJS-$(HAVE_RVV) += $(RVV-OBJS) $(RVV-OBJS-yes)
OBJS-$(HAVE_MMX) += $(MMX-OBJS) $(MMX-OBJS-yes)

View File

@ -2,11 +2,11 @@ OBJS-$(CONFIG_AAC_DECODER) += riscv/aacpsdsp_init.o
RVV-OBJS-$(CONFIG_AAC_DECODER) += riscv/aacpsdsp_rvv.o
OBJS-$(CONFIG_ALAC_DECODER) += riscv/alacdsp_init.o
RVV-OBJS-$(CONFIG_ALAC_DECODER) += riscv/alacdsp_rvv.o
OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_init.o \
riscv/audiodsp_rvf.o
OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_init.o
RV-OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_rvf.o
RVV-OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_rvv.o
OBJS-$(CONFIG_BSWAPDSP) += riscv/bswapdsp_init.o \
riscv/bswapdsp_rvb.o
OBJS-$(CONFIG_BSWAPDSP) += riscv/bswapdsp_init.o
RV-OBJS-$(CONFIG_BSWAPDSP) += riscv/bswapdsp_rvb.o
RVV-OBJS-$(CONFIG_BSWAPDSP) += riscv/bswapdsp_rvv.o
OBJS-$(CONFIG_FMTCONVERT) += riscv/fmtconvert_init.o
RVV-OBJS-$(CONFIG_FMTCONVERT) += riscv/fmtconvert_rvv.o
@ -14,8 +14,8 @@ OBJS-$(CONFIG_IDCTDSP) += riscv/idctdsp_init.o
RVV-OBJS-$(CONFIG_IDCTDSP) += riscv/idctdsp_rvv.o
OBJS-$(CONFIG_OPUS_DECODER) += riscv/opusdsp_init.o
RVV-OBJS-$(CONFIG_OPUS_DECODER) += riscv/opusdsp_rvv.o
OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_init.o \
riscv/pixblockdsp_rvi.o
OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_init.o
RV-OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_rvi.o
RVV-OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_rvv.o
OBJS-$(CONFIG_VORBIS_DECODER) += riscv/vorbisdsp_init.o
RVV-OBJS-$(CONFIG_VORBIS_DECODER) += riscv/vorbisdsp_rvv.o

View File

@ -33,6 +33,7 @@ void ff_vector_clipf_rvv(float *dst, const float *src, int len, float min, float
av_cold void ff_audiodsp_init_riscv(AudioDSPContext *c)
{
#if HAVE_RV
int flags = av_get_cpu_flags();
if (flags & AV_CPU_FLAG_RVF)
@ -45,4 +46,5 @@ av_cold void ff_audiodsp_init_riscv(AudioDSPContext *c)
if (flags & AV_CPU_FLAG_RVV_F32)
c->vector_clipf = ff_vector_clipf_rvv;
#endif
#endif
}

View File

@ -31,6 +31,7 @@ void ff_bswap16_buf_rvv(uint16_t *dst, const uint16_t *src, int len);
av_cold void ff_bswapdsp_init_riscv(BswapDSPContext *c)
{
#if HAVE_RV
int cpu_flags = av_get_cpu_flags();
#if (__riscv_xlen >= 64)
@ -43,4 +44,5 @@ av_cold void ff_bswapdsp_init_riscv(BswapDSPContext *c)
c->bswap16_buf = ff_bswap16_buf_rvv;
}
#endif
#endif
}

View File

@ -43,6 +43,7 @@ av_cold void ff_pixblockdsp_init_riscv(PixblockDSPContext *c,
AVCodecContext *avctx,
unsigned high_bit_depth)
{
#if HAVE_RV
int cpu_flags = av_get_cpu_flags();
if (cpu_flags & AV_CPU_FLAG_RVI) {
@ -62,4 +63,5 @@ av_cold void ff_pixblockdsp_init_riscv(PixblockDSPContext *c,
c->diff_pixels_unaligned = c->diff_pixels = ff_diff_pixels_rvv;
}
#endif
#endif
}

View File

@ -64,7 +64,7 @@ CHECKASMOBJS-$(CONFIG_AVUTIL) += $(AVUTILOBJS)
CHECKASMOBJS-$(ARCH_AARCH64) += aarch64/checkasm.o
CHECKASMOBJS-$(HAVE_ARMV5TE_EXTERNAL) += arm/checkasm.o
CHECKASMOBJS-$(ARCH_RISCV) += riscv/checkasm.o
CHECKASMOBJS-$(HAVE_RV) += riscv/checkasm.o
CHECKASMOBJS-$(HAVE_X86ASM) += x86/checkasm.o
CHECKASMOBJS += $(CHECKASMOBJS-yes) checkasm.o

View File

@ -208,11 +208,14 @@ void checkasm_checked_call(void *func, ...);
void checkasm_set_function(void *);
void *checkasm_get_wrapper(void);
#if (__riscv_xlen == 64) && defined (__riscv_d)
#if HAVE_RV && (__riscv_xlen == 64) && defined (__riscv_d)
#define declare_new(ret, ...) \
ret (*checked_call)(__VA_ARGS__) = checkasm_get_wrapper();
#define call_new(...) \
(checkasm_set_function(func_new), checked_call(__VA_ARGS__))
#else
#define declare_new(ret, ...)
#define call_new(...) ((func_type *)func_new)(__VA_ARGS__)
#endif
#else
#define declare_new(ret, ...)