This removes the dependency on Zba at essentially zero cost.
Unified · Split
| @@ -33,15 +33,15 @@ av_cold void ff_bswapdsp_init_riscv(BswapDSPContext *c) · 32 unmodified lines | |||
| 33 | #if HAVE_RV | 33 | #if HAVE_RV |
| 34 | int flags = av_get_cpu_flags(); | 34 | int flags = av_get_cpu_flags(); |
| 35 | 35 | ||
| 36 | if (flags & AV_CPU_FLAG_RVB_ADDR) { | ||
| 37 | #if (__riscv_xlen >= 64) | 36 | #if (__riscv_xlen >= 64) |
| 38 | if (flags & AV_CPU_FLAG_RVB_BASIC) | 37 | if (flags & AV_CPU_FLAG_RVB_BASIC) |
| 39 | c->bswap_buf = ff_bswap32_buf_rvb; | 38 | c->bswap_buf = ff_bswap32_buf_rvb; |
| 40 | #endif | 39 | #endif |
| 41 | #if HAVE_RVV | 40 | #if HAVE_RVV |
| 41 | if (flags & AV_CPU_FLAG_RVB_ADDR) { | ||
| 42 | if (flags & AV_CPU_FLAG_RVV_I32) | 42 | if (flags & AV_CPU_FLAG_RVV_I32) |
| 43 | c->bswap16_buf = ff_bswap16_buf_rvv; | 43 | c->bswap16_buf = ff_bswap16_buf_rvv; |
| 44 | #endif | ||
| 45 | } | 44 | } |
| 46 | #endif | 45 | #endif |
| 46 | #endif | ||
| 47 | } | 47 | } |
| @@ -23,8 +23,9 @@ · 22 unmodified lines | |||
| 23 | #include "libavutil/riscv/bswap_rvb.S" | 23 | #include "libavutil/riscv/bswap_rvb.S" |
| 24 | 24 | ||
| 25 | #if (__riscv_xlen >= 64) | 25 | #if (__riscv_xlen >= 64) |
| 26 | func ff_bswap32_buf_rvb, zba, zbb | 26 | func ff_bswap32_buf_rvb, zbb |
| 27 | lpad 0 | 27 | lpad 0 |
| 28 | slli a2, a2, 2 | ||
| 28 | bswap32_rvb a0, a1, a2 | 29 | bswap32_rvb a0, a1, a2 |
| 29 | endfunc | 30 | endfunc |
| 30 | #endif | 31 | #endif |
| @@ -20,21 +20,21 @@ · 19 unmodified lines | |||
| 20 | 20 | ||
| 21 | #if (__riscv_xlen >= 64) | 21 | #if (__riscv_xlen >= 64) |
| 22 | .macro bswap32_rvb out, in, count | 22 | .macro bswap32_rvb out, in, count |
| 23 | andi t0, \count, 4 | 23 | andi t0, \count, 1 |
| 24 | beqz t0, 1f | 24 | beqz t0, 1f |
| 25 | /* Align input to 64-bit */ | 25 | /* Align input to 64-bit */ |
| 26 | lwu t0, (\in) | 26 | lwu t0, (\in) |
| 27 | addi \out, \out, 4 | 27 | addi \out, \out, 4 |
| 28 | rev8 t0, t0 | 28 | rev8 t0, t0 |
| 29 | addi \count, \count, -1 | 29 | addi \count, \count, -4 |
| 30 | srli t0, t0, __riscv_xlen - 32 | 30 | srli t0, t0, __riscv_xlen - 32 |
| 31 | addi \in, \in, 4 | 31 | addi \in, \in, 4 |
| 32 | sw t0, -4(\out) | 32 | sw t0, -4(\out) |
| 33 | 1: | 33 | 1: |
| 34 | andi t3, \count, -2 | 34 | andi t3, \count, -8 |
| 35 | sh2add \count, \count, \out | 35 | add \count, \count, \out |
| 36 | beqz t3, 3f | 36 | beqz t3, 3f |
| 37 | sh2add t3, t3, \out | 37 | add t3, t3, \out |
| 38 | 2: /* 2 elements (64 bits) at a time on a 64-bit boundary */ | 38 | 2: /* 2 elements (64 bits) at a time on a 64-bit boundary */ |
| 39 | ld t0, (\in) | 39 | ld t0, (\in) |
| 40 | addi \out, \out, 8 | 40 | addi \out, \out, 8 |
| @@ -46,7 +46,7 @@ av_cold void rgb2rgb_init_riscv(void) · 45 unmodified lines | |||
| 46 | int flags = av_get_cpu_flags(); | 46 | int flags = av_get_cpu_flags(); |
| 47 | 47 | ||
| 48 | #if (__riscv_xlen == 64) | 48 | #if (__riscv_xlen == 64) |
| 49 | if ((flags & AV_CPU_FLAG_RVB_BASIC) && (flags & AV_CPU_FLAG_RVB_ADDR)) | 49 | if (flags & AV_CPU_FLAG_RVB_BASIC) |
| 50 | shuffle_bytes_3210 = ff_shuffle_bytes_3210_rvb; | 50 | shuffle_bytes_3210 = ff_shuffle_bytes_3210_rvb; |
| 51 | #endif | 51 | #endif |
| 52 | #if HAVE_RVV | 52 | #if HAVE_RVV |
| @@ -23,9 +23,8 @@ · 22 unmodified lines | |||
| 23 | #include "libavutil/riscv/bswap_rvb.S" | 23 | #include "libavutil/riscv/bswap_rvb.S" |
| 24 | 24 | ||
| 25 | #if (__riscv_xlen >= 64) | 25 | #if (__riscv_xlen >= 64) |
| 26 | func ff_shuffle_bytes_3210_rvb, zba, zbb | 26 | func ff_shuffle_bytes_3210_rvb, zbb |
| 27 | lpad 0 | 27 | lpad 0 |
| 28 | srli a2, a2, 2 | ||
| 29 | bswap32_rvb a1, a0, a2 | 28 | bswap32_rvb a1, a0, a2 |
| 30 | endfunc | 29 | endfunc |
| 31 | #endif | 30 | #endif |