riscv: asm: Move lx and sx macros to asm.S

The lx and sx macros provide XLEN-dependent aliases for load and store
instructions and are currently duplicated in several assembly files.

Move the common definitions to asm.S and reuse them from there to avoid
duplicating the same macros across multiple files.

Signed-off-by: daichengrong <daichengrong@iscas.ac.cn>
This commit is contained in:
daichengrong authored and michaelni committed 2026-09-20 11:16:50 +00:00
1 parent 7d3ace8cb2
commit 7d472b7777
5 files changed
+18 -50

No files matched your search

-10
View File
@@ -26,16 +26,6 @@
#include "libavutil/riscv/asm.S"
.macro sx rd, addr
#if (__riscv_xlen == 32)
sw \rd, \addr
#elif (__riscv_xlen == 64)
sd \rd, \addr
#else
sq \rd, \addr
#endif
.endm
func ff_h264_add_pixels4_8_rvv, zve32x
lpad 0
vsetivli zero, 4, e8, mf4, ta, ma
-10
View File
@@ -29,16 +29,6 @@
#include "libavutil/riscv/asm.S"
.macro sx rd, addr
#if (__riscv_xlen == 32)
sw \rd, \addr
#elif (__riscv_xlen == 64)
sd \rd, \addr
#else
sq \rd, \addr
#endif
.endm
.variant_cc ff_h264_idct4_rvv
func ff_h264_idct4_rvv, zve32x
vsra.vi v5, v1, 1
-20
View File
@@ -28,26 +28,6 @@
#include "libavutil/riscv/asm.S"
.macro lx rd, addr
#if (__riscv_xlen == 32)
lw \rd, \addr
#elif (__riscv_xlen == 64)
ld \rd, \addr
#else
lq \rd, \addr
#endif
.endm
.macro sx rd, addr
#if (__riscv_xlen == 32)
sw \rd, \addr
#elif (__riscv_xlen == 64)
sd \rd, \addr
#else
sq \rd, \addr
#endif
.endm
#define XSZ (__riscv_xlen / 8)
#define STACK_ALIGN(x) (((x) + 15) & ~15)
-10
View File
@@ -26,16 +26,6 @@
#include "libavutil/riscv/asm.S"
.macro lx rd, addr
#if (__riscv_xlen == 32)
lw \rd, \addr
#elif (__riscv_xlen == 64)
ld \rd, \addr
#else
lq \rd, \addr
#endif
.endm
func ff_startcode_find_candidate_rvb, zbb
lpad 0
add a1, a0, a1
+18
View File
@@ -237,3 +237,21 @@
.macro vntypei rd, rs, n=1
vwtypei \rd, \rs, -(\n)
.endm
#if (__riscv_xlen == 32)
.macro lx rd, addr
lw \rd, \addr
.endm
.macro sx rs, addr
sw \rs, \addr
.endm
#elif (__riscv_xlen == 64)
.macro lx rd, addr
ld \rd, \addr
.endm
.macro sx rs, addr
sd \rs, \addr
.endm
#endif