[FFmpeg-devel] [PATCH 2/6] lavu/riscv: add forward-edge CFI landing pads

Rémi Denis-Courmont remi at remlab.net
Mon Jul 22 22:38:14 EEST 2024


---
 libavutil/riscv/fixed_dsp_rvv.S |  6 ++++++
 libavutil/riscv/float_dsp_rvv.S | 12 ++++++++++++
 libavutil/riscv/lls_rvv.S       |  1 +
 3 files changed, 19 insertions(+)

diff --git a/libavutil/riscv/fixed_dsp_rvv.S b/libavutil/riscv/fixed_dsp_rvv.S
index 6bac5813b8..7a872f7763 100644
--- a/libavutil/riscv/fixed_dsp_rvv.S
+++ b/libavutil/riscv/fixed_dsp_rvv.S
@@ -21,6 +21,7 @@
 #include "asm.S"
 
 func ff_vector_fmul_window_scaled_rvv, zve64x
+        lpad    0
         csrwi   vxrm, 0
         vsetvli t0, zero, e16, m1, ta, ma
         sh2add  a2, a4, a2
@@ -69,6 +70,7 @@ func ff_vector_fmul_window_scaled_rvv, zve64x
 endfunc
 
 func ff_vector_fmul_window_fixed_rvv, zve64x
+        lpad    0
         csrwi   vxrm, 0
         vsetvli t0, zero, e16, m1, ta, ma
         sh2add  a2, a4, a2
@@ -113,6 +115,7 @@ func ff_vector_fmul_window_fixed_rvv, zve64x
 endfunc
 
 func ff_vector_fmul_fixed_rvv, zve32x
+        lpad    0
         csrwi   vxrm, 0
 1:
         vsetvli t0, a3, e32, m4, ta, ma
@@ -156,6 +159,7 @@ func ff_vector_fmul_reverse_fixed_rvv, zve32x
 endfunc
 
 func ff_vector_fmul_add_fixed_rvv, zve32x
+        lpad    0
         csrwi   vxrm, 0
 1:
         vsetvli t0, a4, e32, m8, ta, ma
@@ -176,6 +180,7 @@ func ff_vector_fmul_add_fixed_rvv, zve32x
 endfunc
 
 func ff_scalarproduct_fixed_rvv, zve64x
+        lpad    0
         li      t1, 1 << 30
         vsetvli t0, zero, e64, m8, ta, ma
         vmv.v.x v8, zero
@@ -199,6 +204,7 @@ endfunc
 
 // (a0) = (a0) + (a1), (a1) = (a0) - (a1) [0..a2-1]
 func ff_butterflies_fixed_rvv, zve32x
+        lpad    0
 1:
         vsetvli t0, a2, e32, m4, ta, ma
         vle32.v v16, (a0)
diff --git a/libavutil/riscv/float_dsp_rvv.S b/libavutil/riscv/float_dsp_rvv.S
index 2f0ade6db6..e738268549 100644
--- a/libavutil/riscv/float_dsp_rvv.S
+++ b/libavutil/riscv/float_dsp_rvv.S
@@ -22,6 +22,7 @@
 
 // (a0) = (a1) * (a2) [0..a3-1]
 func ff_vector_fmul_rvv, zve32f
+        lpad    0
 1:
         vsetvli  t0, a3, e32, m8, ta, ma
         vle32.v  v16, (a1)
@@ -39,6 +40,7 @@ endfunc
 
 // (a0) += (a1) * fa0 [0..a2-1]
 func ff_vector_fmac_scalar_rvv, zve32f
+        lpad    0
 NOHWF   fmv.w.x   fa0, a2
 NOHWF   mv        a2, a3
 1:
@@ -58,6 +60,7 @@ endfunc
 
 // (a0) = (a1) * fa0 [0..a2-1]
 func ff_vector_fmul_scalar_rvv, zve32f
+        lpad    0
 NOHWF   fmv.w.x  fa0, a2
 NOHWF   mv       a2, a3
 1:
@@ -74,6 +77,7 @@ NOHWF   mv       a2, a3
 endfunc
 
 func ff_vector_fmul_window_rvv, zve32f
+        lpad    0
         // a0: dst, a1: src0, a2: src1, a3: window, a4: length
         // e16/m2 and e32/m4 are possible but slower due to gather.
         vsetvli    t0, zero, e16, m1, ta, ma
@@ -114,6 +118,7 @@ endfunc
 
 // (a0) = (a1) * (a2) + (a3) [0..a4-1]
 func ff_vector_fmul_add_rvv, zve32f
+        lpad    0
 1:
         vsetvli   t0, a4, e32, m8, ta, ma
         vle32.v   v8, (a1)
@@ -134,6 +139,7 @@ endfunc
 // TODO factor vrsub, separate last iteration?
 // (a0) = (a1) * reverse(a2) [0..a3-1]
 func ff_vector_fmul_reverse_rvv, zve32f
+        lpad    0
         // e16/m4 and e32/m8 are possible but slower due to gather.
         vsetvli  t0, zero, e16, m1, ta, ma
         sh2add   a2, a3, a2
@@ -160,6 +166,7 @@ endfunc
 
 // (a0) = (a0) + (a1), (a1) = (a0) - (a1) [0..a2-1]
 func ff_butterflies_float_rvv, zve32f
+        lpad    0
 1:
         vsetvli  t0, a2, e32, m8, ta, ma
         vle32.v  v16, (a0)
@@ -178,6 +185,7 @@ endfunc
 
 // a0 = (a0).(a1) [0..a2-1]
 func ff_scalarproduct_float_rvv, zve32f
+        lpad    0
         vsetvli      t0, zero, e32, m8, ta, ma
         vmv.v.x      v8, zero
         vmv.s.x      v0, zero
@@ -200,6 +208,7 @@ endfunc
 
 // (a0) = (a1) * (a2) [0..a3-1]
 func ff_vector_dmul_rvv, zve64d
+        lpad    0
 1:
         vsetvli  t0, a3, e64, m8, ta, ma
         vle64.v  v16, (a1)
@@ -217,6 +226,7 @@ endfunc
 
 // (a0) += (a1) * fa0 [0..a2-1]
 func ff_vector_dmac_scalar_rvv, zve64d
+        lpad    0
 NOHWD   fmv.d.x   fa0, a2
 NOHWD   mv        a2, a3
 1:
@@ -235,6 +245,7 @@ endfunc
 
 // (a0) = (a1) * fa0 [0..a2-1]
 func ff_vector_dmul_scalar_rvv, zve64d
+        lpad    0
 NOHWD   fmv.d.x  fa0, a2
 NOHWD   mv       a2, a3
 1:
@@ -251,6 +262,7 @@ NOHWD   mv       a2, a3
 endfunc
 
 func ff_scalarproduct_double_rvv, zve64f
+        lpad    0
         vsetvli      t0, zero, e64, m8, ta, ma
         vmv.v.x      v8, zero
         vmv.s.x      v0, zero
diff --git a/libavutil/riscv/lls_rvv.S b/libavutil/riscv/lls_rvv.S
index a36055bd7a..bd9f74ee5f 100644
--- a/libavutil/riscv/lls_rvv.S
+++ b/libavutil/riscv/lls_rvv.S
@@ -21,6 +21,7 @@
 #include "asm.S"
 
 func ff_lls_update_covariance_rvv, zve64d, zbb
+        lpad    0
         vtype_vli     t0, a2, t1, e64, ta, ma
         vsetvl        zero, a2, t0
         vle64.v       v8, (a1)
-- 
2.45.2



More information about the ffmpeg-devel mailing list