From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id A173444304 for ; Thu, 6 Oct 2022 18:46:22 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B8B0968BBBF; Thu, 6 Oct 2022 21:46:19 +0300 (EEST) Received: from ursule.remlab.net (vps-a2bccee9.vps.ovh.net [51.75.19.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D968168B3A2 for ; Thu, 6 Oct 2022 21:46:13 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id DD9D6C0072 for ; Thu, 6 Oct 2022 21:46:12 +0300 (EEST) From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Thu, 6 Oct 2022 21:46:12 +0300 Message-Id: <20221006184612.51719-1-remi@remlab.net> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] lavc/aacpsdsp: fix clobber on RISC-V LP64D/ILP32D X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Although the DSP function only uses single precision from RISC-V F, the caller may leave double precision values in the spilled registers if the calling convention supports double precision hardware floats. Then, we need to save and restore FS registers as double precision. Conversely, we do not need to save anything at all if an integer calling convention is in use. However we can assume that single precision floats are supported, since the Zve32f extension implies the F extension. So for the sake of simplicity, we always save at least single precision values. In theory, we should even save quadruple precision values if the LP64Q ABI is in use. I have yet to see a compiler that supports it though. --- libavcodec/riscv/aacpsdsp_rvv.S | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libavcodec/riscv/aacpsdsp_rvv.S b/libavcodec/riscv/aacpsdsp_rvv.S index 1d6e73fd2d..80bd19f6ad 100644 --- a/libavcodec/riscv/aacpsdsp_rvv.S +++ b/libavcodec/riscv/aacpsdsp_rvv.S @@ -55,9 +55,10 @@ endfunc func ff_ps_hybrid_analysis_rvv, zve32f /* We need 26 FP registers, for 20 scratch ones. Spill fs0-fs5. */ - addi sp, sp, -32 + addi sp, sp, -48 .irp n, 0, 1, 2, 3, 4, 5 - fsw fs\n, (4 * \n)(sp) +HWD fsd fs\n, (8 * \n)(sp) +NOHWD fsw fs\n, (4 * \n)(sp) .endr .macro input, j, fd0, fd1, fd2, fd3 @@ -142,9 +143,10 @@ func ff_ps_hybrid_analysis_rvv, zve32f bnez a4, 1b .irp n, 5, 4, 3, 2, 1, 0 - flw fs\n, (4 * \n)(sp) +HWD fld fs\n, (8 * \n)(sp) +NOHWD flw fs\n, (4 * \n)(sp) .endr - addi sp, sp, 32 + addi sp, sp, 48 ret .purgem input .purgem filter -- 2.37.2 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".