[FFmpeg-devel] [PATCH 07/31] lavu/riscv: fallback macros for SH{1, 2, 3}ADD

remi at remlab.net remi at remlab.net
Sun Sep 25 17:25:55 EEST 2022


From: Rémi Denis-Courmont <remi at remlab.net>

Those mnemonics require the very latest binutils release at the time of
writing. These macros provide seamless backward compatibility.
---
 libavutil/riscv/asm.S | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/libavutil/riscv/asm.S b/libavutil/riscv/asm.S
index dbd97f40a4..de5e1ad0a6 100644
--- a/libavutil/riscv/asm.S
+++ b/libavutil/riscv/asm.S
@@ -75,3 +75,22 @@
                 .purgem endconst
             .endm
         .endm
+
+#if !defined (__riscv_zba)
+        /* SH{1,2,3}ADD definitions for pre-Zba assemblers */
+        .macro  shnadd n, rd, rs1, rs2
+        .insn r OP, 2 * \n, 16, \rd, \rs1, \rs2
+        .endm
+
+        .macro  sh1add rd, rs1, rs2
+        shnadd  1, \rd, \rs1, \rs2
+        .endm
+
+        .macro  sh2add rd, rs1, rs2
+        shnadd  2, \rd, \rs1, \rs2
+        .endm
+
+        .macro  sh3add rd, rs1, rs2
+        shnadd  3, \rd, \rs1, \rs2
+        .endm
+#endif
-- 
2.37.2



More information about the ffmpeg-devel mailing list