From: remi@remlab.net To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH 2/3] lavu/riscv: helper macro for VTYPE encoding Date: Sat, 1 Oct 2022 15:32:38 +0300 Message-ID: <20221001123239.33042-2-remi@remlab.net> (raw) In-Reply-To: <5606030.DvuYhMxLoT@basile.remlab.net> From: Rémi Denis-Courmont <remi@remlab.net> On most cases, the vector type (VTYPE) for the RISC-V Vector extension is supplied as an immediate value, with either of the VSETVLI or VSETIVLI instructions. There is however a third instruction VSETVL which takes the vector type from a general purpose register. That is so the type can be selected at run-time. This introduces a macro to load a (valid) vector type into a register. The syntax follows that of VSETVLI and VSETIVLI, with element size, group multiplier, then tail and mask policies. --- libavutil/riscv/asm.S | 75 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/libavutil/riscv/asm.S b/libavutil/riscv/asm.S index de5e1ad0a6..f8c9f6749b 100644 --- a/libavutil/riscv/asm.S +++ b/libavutil/riscv/asm.S @@ -94,3 +94,78 @@ shnadd 3, \rd, \rs1, \rs2 .endm #endif + + /* 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 + .else + .ifc \e,e16 + .equ ei, 8 + .else + .ifc \e,e32 + .equ ei, 16 + .else + .ifc \e,e64 + .equ ei, 24 + .else + .error "Unknown element type" + .endif + .endif + .endif + .endif + + .ifc \m,m1 + .equ mi, 0 + .else + .ifc \m,m2 + .equ mi, 1 + .else + .ifc \m,m4 + .equ mi, 2 + .else + .ifc \m,m8 + .equ mi, 3 + .else + .ifc \m,mf8 + .equ mi, 5 + .else + .ifc \m,mf4 + .equ mi, 6 + .else + .ifc \m,mf2 + .equ mi, 7 + .else + .error "Unknown multiplier" + .equ mi, 3 + .endif + .endif + .endif + .endif + .endif + .endif + .endif + + .ifc \tp,tu + .equ tpi, 0 + .else + .ifc \tp,ta + .equ tpi, 64 + .else + .error "Unknown tail policy" + .endif + .endif + + .ifc \mp,mu + .equ mpi, 0 + .else + .ifc \mp,ma + .equ mpi, 128 + .else + .error "Unknown mask policy" + .endif + .endif + + li \rd, (ei | mi | tpi | mpi) + .endm -- 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".
next prev parent reply other threads:[~2022-10-01 12:32 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-10-01 12:32 [FFmpeg-devel] [PATCH 0/3] RISC-V V Opus post-filter Rémi Denis-Courmont 2022-10-01 12:32 ` [FFmpeg-devel] [PATCH 1/3] lavc/opusdsp: RISC-V V postfilter remi 2022-10-04 21:46 ` Lynne 2022-10-01 12:32 ` remi [this message] 2022-10-01 12:32 ` [FFmpeg-devel] [PATCH 3/3] lavc/opusdsp: RISC-V V (256-bit vectors) postfilter remi
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20221001123239.33042-2-remi@remlab.net \ --to=remi@remlab.net \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git