With 128-bit vectors, this is mostly pointless but also harmless. Performance gains should be more noticeable with larger vector sizes. neg_odd_64_c: 76.2 neg_odd_64_rvv_i64: 74.7
Showing the changes to libavcodec (2 of 2 files). Show all
Unified · Split
| @@ -25,6 +25,7 @@ · 24 unmodified lines | |||
| 25 | 25 | ||
| 26 | void ff_sbr_sum64x5_rvv(float *z); | 26 | void ff_sbr_sum64x5_rvv(float *z); |
| 27 | float ff_sbr_sum_square_rvv(float (*x)[2], int n); | 27 | float ff_sbr_sum_square_rvv(float (*x)[2], int n); |
| 28 | void ff_sbr_neg_odd_64_rvv(float *x); | ||
| 28 | 29 | ||
| 29 | av_cold void ff_sbrdsp_init_riscv(SBRDSPContext *c) | 30 | av_cold void ff_sbrdsp_init_riscv(SBRDSPContext *c) |
| 30 | { | 31 | { |
| @@ -35,5 +36,9 @@ av_cold void ff_sbrdsp_init_riscv(SBRDSPContext *c) · 4 unmodified lines | |||
| 35 | c->sum64x5 = ff_sbr_sum64x5_rvv; | 36 | c->sum64x5 = ff_sbr_sum64x5_rvv; |
| 36 | c->sum_square = ff_sbr_sum_square_rvv; | 37 | c->sum_square = ff_sbr_sum_square_rvv; |
| 37 | } | 38 | } |
| 39 | #if __riscv_xlen >= 64 | ||
| 40 | if ((flags & AV_CPU_FLAG_RVV_I64) && (flags & AV_CPU_FLAG_RVB_ADDR)) | ||
| 41 | c->neg_odd_64 = ff_sbr_neg_odd_64_rvv; | ||
| 42 | #endif | ||
| 38 | #endif | 43 | #endif |
| 39 | } | 44 | } |
| @@ -67,3 +67,20 @@ func ff_sbr_sum_square_rvv, zve32f · 66 unmodified lines | |||
| 67 | NOHWF fmv.x.w a0, fa0 | 67 | NOHWF fmv.x.w a0, fa0 |
| 68 | ret | 68 | ret |
| 69 | endfunc | 69 | endfunc |
| 70 | |||
| 71 | #if __riscv_xlen >= 64 | ||
| 72 | func ff_sbr_neg_odd_64_rvv, zve64x | ||
| 73 | li a1, 32 | ||
| 74 | li t1, 1 << 63 | ||
| 75 | 1: | ||
| 76 | vsetvli t0, a1, e64, m8, ta, ma | ||
| 77 | vle64.v v8, (a0) | ||
| 78 | sub a1, a1, t0 | ||
| 79 | vxor.vx v8, v8, t1 | ||
| 80 | vse64.v v8, (a0) | ||
| 81 | sh3add a0, t0, a0 | ||
| 82 | bnez t0, 1b | ||
| 83 | |||
| 84 | ret | ||
| 85 | endfunc | ||
| 86 | #endif | ||