History

lavc/bswapdsp: purge RISC-V V bswap32

This cannot beat the Zbb implementation, and it is unlikely that a real meaningful CPU design would support V and not Zbb. The best loop rewrite that I could come up with (4 shifts, 2 ands, 3 ors) is still ~40% slower than Zbb. A proper faster vector implementation should be feasible with the cryptographic vector extensions, but that is a story for another time.

Rémi Denis-Courmont committed 3 years ago

Commit 61e5ca41 parent 5de1db52 files · +1 −27Browse files

Showing the changes to libavcodec (2 of 2 files). Show all

Unified · Split

2 files
  1. libavcodec/riscv/bswapdsp_init.c +1 −4
  2. libavcodec/riscv/bswapdsp_rvv.S +0 −23
libavcodec/riscv/bswapdsp_init.c+1−4
@@ -26,7 +26,6 @@ · 25 unmodified lines
26#include "libavcodec/bswapdsp.h"26#include "libavcodec/bswapdsp.h"
27 27
28void ff_bswap32_buf_rvb(uint32_t *dst, const uint32_t *src, int len);28void ff_bswap32_buf_rvb(uint32_t *dst, const uint32_t *src, int len);
29void ff_bswap32_buf_rvv(uint32_t *dst, const uint32_t *src, int len);
30void ff_bswap16_buf_rvv(uint16_t *dst, const uint16_t *src, int len);29void ff_bswap16_buf_rvv(uint16_t *dst, const uint16_t *src, int len);
31 30
32av_cold void ff_bswapdsp_init_riscv(BswapDSPContext *c)31av_cold void ff_bswapdsp_init_riscv(BswapDSPContext *c)
@@ -39,10 +38,8 @@ av_cold void ff_bswapdsp_init_riscv(BswapDSPContext *c) · 6 unmodified lines
39 c->bswap_buf = ff_bswap32_buf_rvb;38 c->bswap_buf = ff_bswap32_buf_rvb;
40#endif39#endif
41#if HAVE_RVV40#if HAVE_RVV
42 if (flags & AV_CPU_FLAG_RVV_I32) {41 if (flags & AV_CPU_FLAG_RVV_I32)
43 c->bswap_buf = ff_bswap32_buf_rvv;
44 c->bswap16_buf = ff_bswap16_buf_rvv;42 c->bswap16_buf = ff_bswap16_buf_rvv;
45 }
46#endif43#endif
47 }44 }
48}45}
libavcodec/riscv/bswapdsp_rvv.S+0−23
@@ -21,29 +21,6 @@ · 20 unmodified lines
21#include "config.h"21#include "config.h"
22#include "libavutil/riscv/asm.S"22#include "libavutil/riscv/asm.S"
23 23
24func ff_bswap32_buf_rvv, zve32x
25 li t4, 4
26 addi t1, a0, 1
27 addi t2, a0, 2
28 addi t3, a0, 3
291:
30 vsetvli t0, a2, e8, m1, ta, ma
31 vlseg4e8.v v8, (a1)
32 sub a2, a2, t0
33 sh2add a1, t0, a1
34 vsse8.v v8, (t3), t4
35 sh2add t3, t0, t3
36 vsse8.v v9, (t2), t4
37 sh2add t2, t0, t2
38 vsse8.v v10, (t1), t4
39 sh2add t1, t0, t1
40 vsse8.v v11, (a0), t4
41 sh2add a0, t0, a0
42 bnez a2, 1b
43
44 ret
45endfunc
46
47func ff_bswap16_buf_rvv, zve32x24func ff_bswap16_buf_rvv, zve32x
481:251:
49 vsetvli t0, a2, e16, m8, ta, ma26 vsetvli t0, a2, e16, m8, ta, ma

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