[FFmpeg-devel] [PATCH 1/2] lavu/riscv: assembler macros for VTYPE fields

Rémi Denis-Courmont remi at remlab.net
Tue May 14 22:35:56 EEST 2024


---
 libavutil/riscv/asm.S | 48 +++++++++++++++++++++++++++++--------------
 1 file changed, 33 insertions(+), 15 deletions(-)

diff --git a/libavutil/riscv/asm.S b/libavutil/riscv/asm.S
index 14be5055f5..ecf3081e61 100644
--- a/libavutil/riscv/asm.S
+++ b/libavutil/riscv/asm.S
@@ -96,20 +96,38 @@
         .endm
 #endif
 
+#define VTYPE_E8   000
+#define VTYPE_E16  010
+#define VTYPE_E32  020
+#define VTYPE_E64  030
+
+#define VTYPE_MF8   05
+#define VTYPE_MF4   06
+#define VTYPE_MF2   07
+#define VTYPE_M1    00
+#define VTYPE_M2    01
+#define VTYPE_M4    02
+#define VTYPE_M8    03
+
+#define VTYPE_TU  0000
+#define VTYPE_TA  0100
+#define VTYPE_MU  0000
+#define VTYPE_MA  0200
+
         /* Convenience macro to load a Vector type (vtype) as immediate */
         .macro  lvtypei rd, e, m=m1, tp=tu, mp=mu
 
         .ifc \e,e8
-        .equ ei, 0
+        .equ ei, VTYPE_E8
         .else
         .ifc \e,e16
-        .equ ei, 8
+        .equ ei, VTYPE_E16
         .else
         .ifc \e,e32
-        .equ ei, 16
+        .equ ei, VTYPE_E32
         .else
         .ifc \e,e64
-        .equ ei, 24
+        .equ ei, VTYPE_E64
         .else
         .error "Unknown element type"
         .endif
@@ -118,25 +136,25 @@
         .endif
 
         .ifc \m,m1
-        .equ mi, 0
+        .equ mi, VTYPE_M1
         .else
         .ifc \m,m2
-        .equ mi, 1
+        .equ mi, VTYPE_M2
         .else
         .ifc \m,m4
-        .equ mi, 2
+        .equ mi, VTYPE_M4
         .else
         .ifc \m,m8
-        .equ mi, 3
+        .equ mi, VTYPE_M8
         .else
         .ifc \m,mf8
-        .equ mi, 5
+        .equ mi, VTYPE_MF8
         .else
         .ifc \m,mf4
-        .equ mi, 6
+        .equ mi, VTYPE_MF4
         .else
         .ifc \m,mf2
-        .equ mi, 7
+        .equ mi, VTYPE_MF2
         .else
         .error "Unknown multiplier"
         .equ mi, 3
@@ -149,20 +167,20 @@
         .endif
 
         .ifc \tp,tu
-        .equ tpi, 0
+        .equ tpi, VTYPE_TU
         .else
         .ifc \tp,ta
-        .equ tpi, 64
+        .equ tpi, VTYPE_TA
         .else
         .error "Unknown tail policy"
         .endif
         .endif
 
         .ifc \mp,mu
-        .equ mpi, 0
+        .equ mpi, VTYPE_MU
         .else
         .ifc \mp,ma
-        .equ mpi, 128
+        .equ mpi, VTYPE_MA
         .else
         .error "Unknown mask policy"
         .endif
-- 
2.43.0



More information about the ffmpeg-devel mailing list