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
93SUBDIR_VARS := CLEANFILES FFLIBS HOSTPROGS TESTPROGS TOOLS \93SUBDIR_VARS := CLEANFILES FFLIBS HOSTPROGS TESTPROGS TOOLS \
94 HEADERS ARCH_HEADERS BUILT_HEADERS SKIPHEADERS \94 HEADERS ARCH_HEADERS BUILT_HEADERS SKIPHEADERS \
95 ARMV5TE-OBJS ARMV6-OBJS ARMV8-OBJS VFP-OBJS NEON-OBJS \95 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 \
97 MIPSFPU-OBJS MIPSDSPR2-OBJS MIPSDSP-OBJS MSA-OBJS \97 MIPSFPU-OBJS MIPSDSPR2-OBJS MIPSDSP-OBJS MSA-OBJS \
98 MMI-OBJS LSX-OBJS LASX-OBJS OBJS SLIBOBJS SHLIBOBJS \98 MMI-OBJS LSX-OBJS LASX-OBJS RV-OBJS RVV-OBJS \
99 STLIBOBJS HOSTOBJS TESTOBJS99 OBJS SLIBOBJS SHLIBOBJS STLIBOBJS HOSTOBJS TESTOBJS
100 100
101define RESET101define RESET
102$(1) :=102$(1) :=
configure+4−1
@@ -2154,6 +2154,7 @@ ARCH_EXT_LIST_PPC=" · 2153 unmodified lines
2154"2154"
2155 2155
2156ARCH_EXT_LIST_RISCV="2156ARCH_EXT_LIST_RISCV="
2157 rv
2157 rvv2158 rvv
2158"2159"
2159 2160
@@ -2679,7 +2680,8 @@ ppc4xx_deps="ppc" · 519 unmodified lines
2679vsx_deps="altivec"2680vsx_deps="altivec"
2680power8_deps="vsx"2681power8_deps="vsx"
2681 2682
2682rvv_deps="riscv"2683rv_deps="riscv"
2684rvv_deps="rv"
2683 2685
2684loongson2_deps="mips"2686loongson2_deps="mips"
2685loongson3_deps="mips"2687loongson3_deps="mips"
@@ -6243,6 +6245,7 @@ elif enabled ppc; then · 3557 unmodified lines
6243 6245
6244elif enabled riscv; then6246elif enabled riscv; then
6245 6247
6248 enabled rv && check_inline_asm rv '".option arch, +zbb\nrev8 t0, t1"'
6246 enabled rvv && check_inline_asm rvv '".option arch, +v\nvsetivli zero, 0, e8, m1, ta, ma"'6249 enabled rvv && check_inline_asm rvv '".option arch, +v\nvsetivli zero, 0, e8, m1, ta, ma"'
6247 6250
6248elif enabled x86; then6251elif enabled x86; then
ffbuild/arch.mak+1−0
@@ -15,6 +15,7 @@ OBJS-$(HAVE_LASX) += $(LASX-OBJS) $(LASX-OBJS-yes) · 14 unmodified lines
15OBJS-$(HAVE_ALTIVEC) += $(ALTIVEC-OBJS) $(ALTIVEC-OBJS-yes)15OBJS-$(HAVE_ALTIVEC) += $(ALTIVEC-OBJS) $(ALTIVEC-OBJS-yes)
16OBJS-$(HAVE_VSX) += $(VSX-OBJS) $(VSX-OBJS-yes)16OBJS-$(HAVE_VSX) += $(VSX-OBJS) $(VSX-OBJS-yes)
17 17
18OBJS-$(HAVE_RV) += $(RV-OBJS) $(RV-OBJS-yes)
18OBJS-$(HAVE_RVV) += $(RVV-OBJS) $(RVV-OBJS-yes)19OBJS-$(HAVE_RVV) += $(RVV-OBJS) $(RVV-OBJS-yes)
19 20
20OBJS-$(HAVE_MMX) += $(MMX-OBJS) $(MMX-OBJS-yes)21OBJS-$(HAVE_MMX) += $(MMX-OBJS) $(MMX-OBJS-yes)
libavcodec/riscv/Makefile+8−8
@@ -1,15 +1,15 @@
1OBJS-$(CONFIG_AAC_DECODER) += riscv/aacpsdsp_init.o riscv/sbrdsp_init.o1OBJS-$(CONFIG_AAC_DECODER) += riscv/aacpsdsp_init.o riscv/sbrdsp_init.o
2RVV-OBJS-$(CONFIG_AAC_DECODER) += riscv/aacpsdsp_rvv.o riscv/sbrdsp_rvv.o2RVV-OBJS-$(CONFIG_AAC_DECODER) += riscv/aacpsdsp_rvv.o riscv/sbrdsp_rvv.o
3OBJS-$(CONFIG_AC3DSP) += riscv/ac3dsp_init.o \3OBJS-$(CONFIG_AC3DSP) += riscv/ac3dsp_init.o
4 riscv/ac3dsp_rvb.o4RV-OBJS-$(CONFIG_AC3DSP) += riscv/ac3dsp_rvb.o
5RVV-OBJS-$(CONFIG_AC3DSP) += riscv/ac3dsp_rvv.o5RVV-OBJS-$(CONFIG_AC3DSP) += riscv/ac3dsp_rvv.o
6OBJS-$(CONFIG_ALAC_DECODER) += riscv/alacdsp_init.o6OBJS-$(CONFIG_ALAC_DECODER) += riscv/alacdsp_init.o
7RVV-OBJS-$(CONFIG_ALAC_DECODER) += riscv/alacdsp_rvv.o7RVV-OBJS-$(CONFIG_ALAC_DECODER) += riscv/alacdsp_rvv.o
8OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_init.o \8OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_init.o
9 riscv/audiodsp_rvf.o9RV-OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_rvf.o
10RVV-OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_rvv.o10RVV-OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_rvv.o
11OBJS-$(CONFIG_BSWAPDSP) += riscv/bswapdsp_init.o \11OBJS-$(CONFIG_BSWAPDSP) += riscv/bswapdsp_init.o
12 riscv/bswapdsp_rvb.o12RV-OBJS-$(CONFIG_BSWAPDSP) += riscv/bswapdsp_rvb.o
13RVV-OBJS-$(CONFIG_BSWAPDSP) += riscv/bswapdsp_rvv.o13RVV-OBJS-$(CONFIG_BSWAPDSP) += riscv/bswapdsp_rvv.o
14OBJS-$(CONFIG_EXR_DECODER) += riscv/exrdsp_init.o14OBJS-$(CONFIG_EXR_DECODER) += riscv/exrdsp_init.o
15RVV-OBJS-$(CONFIG_EXR_DECODER) += riscv/exrdsp_rvv.o15RVV-OBJS-$(CONFIG_EXR_DECODER) += riscv/exrdsp_rvv.o
@@ -35,8 +35,8 @@ OBJS-$(CONFIG_LLVIDENCDSP) += riscv/llvidencdsp_init.o · 19 unmodified lines
35RVV-OBJS-$(CONFIG_LLVIDENCDSP) += riscv/llvidencdsp_rvv.o35RVV-OBJS-$(CONFIG_LLVIDENCDSP) += riscv/llvidencdsp_rvv.o
36OBJS-$(CONFIG_OPUS_DECODER) += riscv/opusdsp_init.o36OBJS-$(CONFIG_OPUS_DECODER) += riscv/opusdsp_init.o
37RVV-OBJS-$(CONFIG_OPUS_DECODER) += riscv/opusdsp_rvv.o37RVV-OBJS-$(CONFIG_OPUS_DECODER) += riscv/opusdsp_rvv.o
38OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_init.o \38OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_init.o
39 riscv/pixblockdsp_rvi.o39RV-OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_rvi.o
40RVV-OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_rvv.o40RVV-OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_rvv.o
41OBJS-$(CONFIG_UTVIDEO_DECODER) += riscv/utvideodsp_init.o41OBJS-$(CONFIG_UTVIDEO_DECODER) += riscv/utvideodsp_init.o
42RVV-OBJS-$(CONFIG_UTVIDEO_DECODER) += riscv/utvideodsp_rvv.o42RVV-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
31 31
32av_cold void ff_ac3dsp_init_riscv(AC3DSPContext *c)32av_cold void ff_ac3dsp_init_riscv(AC3DSPContext *c)
33{33{
34#if HAVE_RV
34 int flags = av_get_cpu_flags();35 int flags = av_get_cpu_flags();
35 36
36 if (flags & AV_CPU_FLAG_RVB_ADDR) {37 if (flags & AV_CPU_FLAG_RVB_ADDR) {
@@ -39,4 +40,5 @@ av_cold void ff_ac3dsp_init_riscv(AC3DSPContext *c) · 2 unmodified lines
39 if (flags & AV_CPU_FLAG_RVV_F32)40 if (flags & AV_CPU_FLAG_RVV_F32)
40 c->float_to_fixed24 = ff_float_to_fixed24_rvv;41 c->float_to_fixed24 = ff_float_to_fixed24_rvv;
41 }42 }
43#endif
42}44}
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
33 33
34av_cold void ff_audiodsp_init_riscv(AudioDSPContext *c)34av_cold void ff_audiodsp_init_riscv(AudioDSPContext *c)
35{35{
36#if HAVE_RV
36 int flags = av_get_cpu_flags();37 int flags = av_get_cpu_flags();
37 38
38 if (flags & AV_CPU_FLAG_RVF)39 if (flags & AV_CPU_FLAG_RVF)
@@ -47,4 +48,5 @@ av_cold void ff_audiodsp_init_riscv(AudioDSPContext *c) · 8 unmodified lines
47 c->vector_clipf = ff_vector_clipf_rvv;48 c->vector_clipf = ff_vector_clipf_rvv;
48 }49 }
49#endif50#endif
51#endif
50}52}
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
30 30
31av_cold void ff_bswapdsp_init_riscv(BswapDSPContext *c)31av_cold void ff_bswapdsp_init_riscv(BswapDSPContext *c)
32{32{
33#if HAVE_RV
33 int flags = av_get_cpu_flags();34 int flags = av_get_cpu_flags();
34 35
35 if (flags & AV_CPU_FLAG_RVB_ADDR) {36 if (flags & AV_CPU_FLAG_RVB_ADDR) {
@@ -42,4 +43,5 @@ av_cold void ff_bswapdsp_init_riscv(BswapDSPContext *c) · 6 unmodified lines
42 c->bswap16_buf = ff_bswap16_buf_rvv;43 c->bswap16_buf = ff_bswap16_buf_rvv;
43#endif44#endif
44 }45 }
46#endif
45}47}
libavcodec/riscv/pixblockdsp_init.c+2−0
@@ -45,6 +45,7 @@ av_cold void ff_pixblockdsp_init_riscv(PixblockDSPContext *c, · 44 unmodified lines
45 AVCodecContext *avctx,45 AVCodecContext *avctx,
46 unsigned high_bit_depth)46 unsigned high_bit_depth)
47{47{
48#if HAVE_RV
48 int cpu_flags = av_get_cpu_flags();49 int cpu_flags = av_get_cpu_flags();
49 50
50 if (cpu_flags & AV_CPU_FLAG_RVI) {51 if (cpu_flags & AV_CPU_FLAG_RVI) {
@@ -69,4 +70,5 @@ av_cold void ff_pixblockdsp_init_riscv(PixblockDSPContext *c, · 18 unmodified lines
69 c->diff_pixels = ff_diff_pixels_rvv;70 c->diff_pixels = ff_diff_pixels_rvv;
70 }71 }
71#endif72#endif
73#endif
72}74}
libswscale/riscv/Makefile+1−1
@@ -1,3 +1,3 @@
1OBJS += riscv/rgb2rgb.o1OBJS += riscv/rgb2rgb.o
2OBJS += riscv/rgb2rgb_rvb.o2RV-OBJS += riscv/rgb2rgb_rvb.o
3RVV-OBJS += riscv/rgb2rgb_rvv.o3RVV-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
42 42
43av_cold void rgb2rgb_init_riscv(void)43av_cold void rgb2rgb_init_riscv(void)
44{44{
45#if HAVE_RV
45 int flags = av_get_cpu_flags();46 int flags = av_get_cpu_flags();
46 47
47#if (__riscv_xlen == 64)48#if (__riscv_xlen == 64)
@@ -61,4 +62,5 @@ av_cold void rgb2rgb_init_riscv(void) · 13 unmodified lines
61 }62 }
62 }63 }
63#endif64#endif
65#endif
64}66}
tests/checkasm/Makefile+1−1
@@ -68,7 +68,7 @@ CHECKASMOBJS-$(CONFIG_AVUTIL) += $(AVUTILOBJS) · 67 unmodified lines
68 68
69CHECKASMOBJS-$(ARCH_AARCH64) += aarch64/checkasm.o69CHECKASMOBJS-$(ARCH_AARCH64) += aarch64/checkasm.o
70CHECKASMOBJS-$(HAVE_ARMV5TE_EXTERNAL) += arm/checkasm.o70CHECKASMOBJS-$(HAVE_ARMV5TE_EXTERNAL) += arm/checkasm.o
71CHECKASMOBJS-$(ARCH_RISCV) += riscv/checkasm.o71CHECKASMOBJS-$(HAVE_RV) += riscv/checkasm.o
72CHECKASMOBJS-$(HAVE_X86ASM) += x86/checkasm.o72CHECKASMOBJS-$(HAVE_X86ASM) += x86/checkasm.o
73 73
74CHECKASMOBJS += $(CHECKASMOBJS-yes) checkasm.o74CHECKASMOBJS += $(CHECKASMOBJS-yes) checkasm.o
tests/checkasm/checkasm.c+1−1
@@ -738,7 +738,7 @@ int main(int argc, char *argv[]) · 737 unmodified lines
738 if (have_vfp(av_get_cpu_flags()) || have_neon(av_get_cpu_flags()))738 if (have_vfp(av_get_cpu_flags()) || have_neon(av_get_cpu_flags()))
739 checkasm_checked_call = checkasm_checked_call_vfp;739 checkasm_checked_call = checkasm_checked_call_vfp;
740#endif740#endif
741#if ARCH_RISCV741#if ARCH_RISCV && HAVE_RV
742 struct sigaction act = {742 struct sigaction act = {
743 .sa_handler = checkasm_handle_signal,743 .sa_handler = checkasm_handle_signal,
744 .sa_flags = 0,744 .sa_flags = 0,
tests/checkasm/checkasm.h+4−1
@@ -217,7 +217,7 @@ void checkasm_set_function(void *, sigjmp_buf); · 216 unmodified lines
217void *checkasm_get_wrapper(void);217void *checkasm_get_wrapper(void);
218void checkasm_handle_signal(int signum);218void checkasm_handle_signal(int signum);
219 219
220#if (__riscv_xlen == 64) && defined (__riscv_d)220#if HAVE_RV && (__riscv_xlen == 64) && defined (__riscv_d)
221#define declare_new(ret, ...) \221#define declare_new(ret, ...) \
222 int checked_call_signum = 0; \222 int checked_call_signum = 0; \
223 sigjmp_buf checked_call_jb; \223 sigjmp_buf checked_call_jb; \
@@ -227,6 +227,9 @@ void checkasm_handle_signal(int signum); · 3 unmodified lines
227 (checked_call_signum = sigsetjmp(checked_call_jb, 1)) == 0 \227 (checked_call_signum = sigsetjmp(checked_call_jb, 1)) == 0 \
228 ? checked_call(__VA_ARGS__) \228 ? checked_call(__VA_ARGS__) \
229 : (checkasm_fail_signal(checked_call_signum), 0))229 : (checkasm_fail_signal(checked_call_signum), 0))
230#else
231#define declare_new(ret, ...)
232#define call_new(...) ((func_type *)func_new)(__VA_ARGS__)
230#endif233#endif
231#else234#else
232#define declare_new(ret, ...)235#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