History

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.

Rémi Denis-Courmont committed 2 years ago

Commit b3825bb1 parent 0b9d00913 files · +33 −16Browse files

Unified · Split

13 files
  1. Makefile +3 −3
  2. configure +4 −1
  3. ffbuild/arch.mak +1 −0
  4. libavcodec/riscv/Makefile +8 −8
  5. libavcodec/riscv/ac3dsp_init.c +2 −0
  6. libavcodec/riscv/audiodsp_init.c +2 −0
  7. libavcodec/riscv/bswapdsp_init.c +2 −0
  8. libavcodec/riscv/pixblockdsp_init.c +2 −0
  9. libswscale/riscv/Makefile +1 −1
  10. libswscale/riscv/rgb2rgb.c +2 −0
  11. tests/checkasm/Makefile +1 −1
  12. tests/checkasm/checkasm.c +1 −1
  13. tests/checkasm/checkasm.h +4 −1
Makefile+3−3
@@ -93,10 +93,10 @@ ffbuild/.config: $(CONFIGURABLE_COMPONENTS) · 92 unmodified lines
9393 SUBDIR_VARS := CLEANFILES FFLIBS HOSTPROGS TESTPROGS TOOLS \
9494 HEADERS ARCH_HEADERS BUILT_HEADERS SKIPHEADERS \
9595 ARMV5TE-OBJS ARMV6-OBJS ARMV8-OBJS VFP-OBJS NEON-OBJS \
96− ALTIVEC-OBJS VSX-OBJS RVV-OBJS MMX-OBJS X86ASM-OBJS \
96+ ALTIVEC-OBJS VSX-OBJS MMX-OBJS X86ASM-OBJS \
9797 MIPSFPU-OBJS MIPSDSPR2-OBJS MIPSDSP-OBJS MSA-OBJS \
98− MMI-OBJS LSX-OBJS LASX-OBJS OBJS SLIBOBJS SHLIBOBJS \
99− STLIBOBJS HOSTOBJS TESTOBJS
98+ MMI-OBJS LSX-OBJS LASX-OBJS RV-OBJS RVV-OBJS \
99+ OBJS SLIBOBJS SHLIBOBJS STLIBOBJS HOSTOBJS TESTOBJS
100100
101101 define RESET
102102 $(1) :=
configure+4−1
@@ -2154,6 +2154,7 @@ ARCH_EXT_LIST_PPC=" · 2153 unmodified lines
21542154 "
21552155
21562156 ARCH_EXT_LIST_RISCV="
2157+ rv
21572158 rvv
21582159 "
21592160
@@ -2679,7 +2680,8 @@ ppc4xx_deps="ppc" · 519 unmodified lines
26792680 vsx_deps="altivec"
26802681 power8_deps="vsx"
26812682
2682−rvv_deps="riscv"
2683+rv_deps="riscv"
2684+rvv_deps="rv"
26832685
26842686 loongson2_deps="mips"
26852687 loongson3_deps="mips"
@@ -6243,6 +6245,7 @@ elif enabled ppc; then · 3557 unmodified lines
62436245
62446246 elif enabled riscv; then
62456247
6248+ enabled rv && check_inline_asm rv '".option arch, +zbb\nrev8 t0, t1"'
62466249 enabled rvv && check_inline_asm rvv '".option arch, +v\nvsetivli zero, 0, e8, m1, ta, ma"'
62476250
62486251 elif enabled x86; then
ffbuild/arch.mak+1−0
@@ -15,6 +15,7 @@ OBJS-$(HAVE_LASX) += $(LASX-OBJS) $(LASX-OBJS-yes) · 14 unmodified lines
1515 OBJS-$(HAVE_ALTIVEC) += $(ALTIVEC-OBJS) $(ALTIVEC-OBJS-yes)
1616 OBJS-$(HAVE_VSX) += $(VSX-OBJS) $(VSX-OBJS-yes)
1717
18+OBJS-$(HAVE_RV) += $(RV-OBJS) $(RV-OBJS-yes)
1819 OBJS-$(HAVE_RVV) += $(RVV-OBJS) $(RVV-OBJS-yes)
1920
2021 OBJS-$(HAVE_MMX) += $(MMX-OBJS) $(MMX-OBJS-yes)
libavcodec/riscv/Makefile+8−8
@@ -1,15 +1,15 @@
11 OBJS-$(CONFIG_AAC_DECODER) += riscv/aacpsdsp_init.o riscv/sbrdsp_init.o
22 RVV-OBJS-$(CONFIG_AAC_DECODER) += riscv/aacpsdsp_rvv.o riscv/sbrdsp_rvv.o
3−OBJS-$(CONFIG_AC3DSP) += riscv/ac3dsp_init.o \
4− riscv/ac3dsp_rvb.o
3+OBJS-$(CONFIG_AC3DSP) += riscv/ac3dsp_init.o
4+RV-OBJS-$(CONFIG_AC3DSP) += riscv/ac3dsp_rvb.o
55 RVV-OBJS-$(CONFIG_AC3DSP) += riscv/ac3dsp_rvv.o
66 OBJS-$(CONFIG_ALAC_DECODER) += riscv/alacdsp_init.o
77 RVV-OBJS-$(CONFIG_ALAC_DECODER) += riscv/alacdsp_rvv.o
8−OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_init.o \
9− riscv/audiodsp_rvf.o
8+OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_init.o
9+RV-OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_rvf.o
1010 RVV-OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_rvv.o
11−OBJS-$(CONFIG_BSWAPDSP) += riscv/bswapdsp_init.o \
12− riscv/bswapdsp_rvb.o
11+OBJS-$(CONFIG_BSWAPDSP) += riscv/bswapdsp_init.o
12+RV-OBJS-$(CONFIG_BSWAPDSP) += riscv/bswapdsp_rvb.o
1313 RVV-OBJS-$(CONFIG_BSWAPDSP) += riscv/bswapdsp_rvv.o
1414 OBJS-$(CONFIG_EXR_DECODER) += riscv/exrdsp_init.o
1515 RVV-OBJS-$(CONFIG_EXR_DECODER) += riscv/exrdsp_rvv.o
@@ -35,8 +35,8 @@ OBJS-$(CONFIG_LLVIDENCDSP) += riscv/llvidencdsp_init.o · 19 unmodified lines
3535 RVV-OBJS-$(CONFIG_LLVIDENCDSP) += riscv/llvidencdsp_rvv.o
3636 OBJS-$(CONFIG_OPUS_DECODER) += riscv/opusdsp_init.o
3737 RVV-OBJS-$(CONFIG_OPUS_DECODER) += riscv/opusdsp_rvv.o
38−OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_init.o \
39− riscv/pixblockdsp_rvi.o
38+OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_init.o
39+RV-OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_rvi.o
4040 RVV-OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_rvv.o
4141 OBJS-$(CONFIG_UTVIDEO_DECODER) += riscv/utvideodsp_init.o
4242 RVV-OBJS-$(CONFIG_UTVIDEO_DECODER) += riscv/utvideodsp_rvv.o
libavcodec/riscv/ac3dsp_init.c+2−0
@@ -31,6 +31,7 @@ void ff_float_to_fixed24_rvv(int32_t *dst, const float *src, size_t len); · 30 unmodified lines
3131
3232 av_cold void ff_ac3dsp_init_riscv(AC3DSPContext *c)
3333 {
34+#if HAVE_RV
3435 int flags = av_get_cpu_flags();
3536
3637 if (flags & AV_CPU_FLAG_RVB_ADDR) {
@@ -39,4 +40,5 @@ av_cold void ff_ac3dsp_init_riscv(AC3DSPContext *c) · 2 unmodified lines
3940 if (flags & AV_CPU_FLAG_RVV_F32)
4041 c->float_to_fixed24 = ff_float_to_fixed24_rvv;
4142 }
43+#endif
4244 }
libavcodec/riscv/audiodsp_init.c+2−0
@@ -33,6 +33,7 @@ void ff_vector_clipf_rvv(float *dst, const float *src, int len, float min, float · 32 unmodified lines
3333
3434 av_cold void ff_audiodsp_init_riscv(AudioDSPContext *c)
3535 {
36+#if HAVE_RV
3637 int flags = av_get_cpu_flags();
3738
3839 if (flags & AV_CPU_FLAG_RVF)
@@ -47,4 +48,5 @@ av_cold void ff_audiodsp_init_riscv(AudioDSPContext *c) · 8 unmodified lines
4748 c->vector_clipf = ff_vector_clipf_rvv;
4849 }
4950 #endif
51+#endif
5052 }
libavcodec/riscv/bswapdsp_init.c+2−0
@@ -30,6 +30,7 @@ void ff_bswap16_buf_rvv(uint16_t *dst, const uint16_t *src, int len); · 29 unmodified lines
3030
3131 av_cold void ff_bswapdsp_init_riscv(BswapDSPContext *c)
3232 {
33+#if HAVE_RV
3334 int flags = av_get_cpu_flags();
3435
3536 if (flags & AV_CPU_FLAG_RVB_ADDR) {
@@ -42,4 +43,5 @@ av_cold void ff_bswapdsp_init_riscv(BswapDSPContext *c) · 6 unmodified lines
4243 c->bswap16_buf = ff_bswap16_buf_rvv;
4344 #endif
4445 }
46+#endif
4547 }
libavcodec/riscv/pixblockdsp_init.c+2−0
@@ -45,6 +45,7 @@ av_cold void ff_pixblockdsp_init_riscv(PixblockDSPContext *c, · 44 unmodified lines
4545 AVCodecContext *avctx,
4646 unsigned high_bit_depth)
4747 {
48+#if HAVE_RV
4849 int cpu_flags = av_get_cpu_flags();
4950
5051 if (cpu_flags & AV_CPU_FLAG_RVI) {
@@ -69,4 +70,5 @@ av_cold void ff_pixblockdsp_init_riscv(PixblockDSPContext *c, · 18 unmodified lines
6970 c->diff_pixels = ff_diff_pixels_rvv;
7071 }
7172 #endif
73+#endif
7274 }
libswscale/riscv/Makefile+1−1
@@ -1,3 +1,3 @@
11 OBJS += riscv/rgb2rgb.o
2−OBJS += riscv/rgb2rgb_rvb.o
2+RV-OBJS += riscv/rgb2rgb_rvb.o
33 RVV-OBJS += riscv/rgb2rgb_rvv.o
libswscale/riscv/rgb2rgb.c+2−0
@@ -42,6 +42,7 @@ void ff_yuyvtoyuv422_rvv(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, · 41 unmodified lines
4242
4343 av_cold void rgb2rgb_init_riscv(void)
4444 {
45+#if HAVE_RV
4546 int flags = av_get_cpu_flags();
4647
4748 #if (__riscv_xlen == 64)
@@ -61,4 +62,5 @@ av_cold void rgb2rgb_init_riscv(void) · 13 unmodified lines
6162 }
6263 }
6364 #endif
65+#endif
6466 }
tests/checkasm/Makefile+1−1
@@ -68,7 +68,7 @@ CHECKASMOBJS-$(CONFIG_AVUTIL) += $(AVUTILOBJS) · 67 unmodified lines
6868
6969 CHECKASMOBJS-$(ARCH_AARCH64) += aarch64/checkasm.o
7070 CHECKASMOBJS-$(HAVE_ARMV5TE_EXTERNAL) += arm/checkasm.o
71−CHECKASMOBJS-$(ARCH_RISCV) += riscv/checkasm.o
71+CHECKASMOBJS-$(HAVE_RV) += riscv/checkasm.o
7272 CHECKASMOBJS-$(HAVE_X86ASM) += x86/checkasm.o
7373
7474 CHECKASMOBJS += $(CHECKASMOBJS-yes) checkasm.o
tests/checkasm/checkasm.c+1−1
@@ -738,7 +738,7 @@ int main(int argc, char *argv[]) · 737 unmodified lines
738738 if (have_vfp(av_get_cpu_flags()) || have_neon(av_get_cpu_flags()))
739739 checkasm_checked_call = checkasm_checked_call_vfp;
740740 #endif
741−#if ARCH_RISCV
741+#if ARCH_RISCV && HAVE_RV
742742 struct sigaction act = {
743743 .sa_handler = checkasm_handle_signal,
744744 .sa_flags = 0,
tests/checkasm/checkasm.h+4−1
@@ -217,7 +217,7 @@ void checkasm_set_function(void *, sigjmp_buf); · 216 unmodified lines
217217 void *checkasm_get_wrapper(void);
218218 void checkasm_handle_signal(int signum);
219219
220−#if (__riscv_xlen == 64) && defined (__riscv_d)
220+#if HAVE_RV && (__riscv_xlen == 64) && defined (__riscv_d)
221221 #define declare_new(ret, ...) \
222222 int checked_call_signum = 0; \
223223 sigjmp_buf checked_call_jb; \
@@ -227,6 +227,9 @@ void checkasm_handle_signal(int signum); · 3 unmodified lines
227227 (checked_call_signum = sigsetjmp(checked_call_jb, 1)) == 0 \
228228 ? checked_call(__VA_ARGS__) \
229229 : (checkasm_fail_signal(checked_call_signum), 0))
230+#else
231+#define declare_new(ret, ...)
232+#define call_new(...) ((func_type *)func_new)(__VA_ARGS__)
230233 #endif
231234 #else
232235 #define declare_new(ret, ...)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t