PR #21251 opened by Rémi Denis-Courmont (Courmisch)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21251
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21251.patch

On riscv32, the result must be narrowed from 63 to 32 bit before being
moved to the scalar side.


From 7da8dd7859a11a8ce7cd0ba1e3c61eead89a8dd9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= <[email protected]>
Date: Sun, 21 Dec 2025 11:58:08 +0200
Subject: [PATCH] lavu/fixed_dsp: fix scalarproduct on riscv32

On riscv32, the result must be narrowed from 63 to 32 bit before being
moved to the scalar side.
---
 libavutil/riscv/fixed_dsp_rvv.S | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavutil/riscv/fixed_dsp_rvv.S b/libavutil/riscv/fixed_dsp_rvv.S
index e60ee8cad5..9424470bad 100644
--- a/libavutil/riscv/fixed_dsp_rvv.S
+++ b/libavutil/riscv/fixed_dsp_rvv.S
@@ -197,8 +197,14 @@ func ff_scalarproduct_fixed_rvv, zve64x, zba
 
         vsetvli t0, zero, e64, m8, ta, ma
         vredsum.vs v0, v8, v0
+#if __riscv_xlen >= 64
         vmv.x.s a0, v0
         srai    a0, a0, 31
+#else
+        vsetivli    zero, 1, e32, mf2, ta, ma
+        vnsra.wi    v1, v0, 31
+        vmv.x.s a0, v1
+#endif
         ret
 endfunc
 
-- 
2.49.1

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to