Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] avutil/aarch64/tx_float_neon.S: clean up FFT4_X2
@ 2025-02-25 20:45 Krzysztof Pyrkosz via ffmpeg-devel
  2025-02-28 12:43 ` Lynne
  0 siblings, 1 reply; 2+ messages in thread
From: Krzysztof Pyrkosz via ffmpeg-devel @ 2025-02-25 20:45 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Krzysztof Pyrkosz

---
This patch rids the code from two tbl instructions and the shuffle
table. There's no fneg v0.s[3] instruction unfortunately, so I negate
the whole vector and copy the last element only.

It's tricky to benchmark this little change but on average it seems to
be beneficial.

Krzysztof

 libavutil/aarch64/tx_float_neon.S | 32 ++++++++-----------------------
 1 file changed, 8 insertions(+), 24 deletions(-)

diff --git a/libavutil/aarch64/tx_float_neon.S b/libavutil/aarch64/tx_float_neon.S
index 78e4876d6c..d00b3f9684 100644
--- a/libavutil/aarch64/tx_float_neon.S
+++ b/libavutil/aarch64/tx_float_neon.S
@@ -119,13 +119,6 @@ endconst
 .endif
 .endm
 
-const shuf_4pt_x2, align=4
-        .byte   24, 25, 26, 27 // reg2, 3
-        .byte   12, 13, 14, 15 // reg1, 4
-        .byte    8,  9, 10, 11 // reg1, 3
-        .byte   28, 29, 30, 31 // reg2, 4
-endconst
-
 // Identical to FFT4, but does 2 transforms in parallel, with no deinterleaving
 .macro FFT4_X2 e0, o0, e1, o1, \
                t0=v16, t1=v17, t2=v18, t3=v19, t4=v20, t5=v21, t6=v22
@@ -135,18 +128,17 @@ endconst
         fsub            \e0\().4s, \e0\().4s, \o0\().4s                     // t1234
         fsub            \e1\().4s, \e1\().4s, \o1\().4s                     // t1234
 
-        movrel          x5, shuf_4pt_x2
-
         rev64           \t4\().4s, \e0\().4s
         rev64           \t5\().4s, \e1\().4s
 
-        zip2            \o0\().2d, \t0\().2d, \e0\().2d                     // t3,4 r3,4
-        zip2            \o1\().2d, \t2\().2d, \e1\().2d                     // t3,4 r3,4
+        zip2            \o0\().2d, \t0\().2d, \t4\().2d                     // t3,4 r3,4
+        zip2            \o1\().2d, \t2\().2d, \t5\().2d                     // t3,4 r3,4
 
-        ld1             { \t6\().16b }, [x5]
+        fneg            \t3\().4s, \t4\().4s
+        fneg            \t4\().4s, \t5\().4s
 
-        mov             \o0\().d[1], \t4\().d[1]
-        mov             \o1\().d[1], \t5\().d[1]
+        mov             \o0\().s[3], \t3\().s[3]
+        mov             \o1\().s[3], \t4\().s[3]
 
         zip1            \t1\().2d, \t0\().2d, \e0\().2d                     // t1,2 r1,2
         zip1            \t3\().2d, \t2\().2d, \e1\().2d                     // t1,2 r1,2
@@ -156,18 +148,10 @@ endconst
         fsub            \t2\().4s, \t3\().4s, \o1\().4s                     // a34 b32
         fadd            \t3\().4s, \t3\().4s, \o1\().4s                     // a12 b14
 
-        // TODO: experiment with movs instead of tables here
-        tbl             \o0\().16b, { \t4\().16b, \t5\().16b }, \t6\().16b  // b1234
-        tbl             \o1\().16b, { \t2\().16b, \t3\().16b }, \t6\().16b  // b1234
-
         zip1            \e0\().2d, \t5\().2d, \t4\().2d                     // a1234
-//        zip2            \o0\().2d, \t5\().2d, \t4\().2d                     // b1432
+        zip2            \o0\().2d, \t5\().2d, \t4\().2d                     // b1432
         zip1            \e1\().2d, \t3\().2d, \t2\().2d                     // a1234
-//        zip2            \o1\().2d, \t3\().2d, \t2\().2d                     // b1432
-//        rev64           \o0\().4s, \o0\().4s                                // b4123
-//        rev64           \o1\().4s, \o1\().4s                                // b4123
-//        ext             \o0\().16b, \o0\().16b, \o0\().16b, #4              // b1234
-//        ext             \o1\().16b, \o1\().16b, \o1\().16b, #4              // b1234
+        zip2            \o1\().2d, \t3\().2d, \t2\().2d                     // b1432
 .endm
 
 const tab_8pt, align=4
-- 
2.47.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".

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avutil/aarch64/tx_float_neon.S: clean up FFT4_X2
  2025-02-25 20:45 [FFmpeg-devel] [PATCH] avutil/aarch64/tx_float_neon.S: clean up FFT4_X2 Krzysztof Pyrkosz via ffmpeg-devel
@ 2025-02-28 12:43 ` Lynne
  0 siblings, 0 replies; 2+ messages in thread
From: Lynne @ 2025-02-28 12:43 UTC (permalink / raw)
  To: ffmpeg-devel


[-- Attachment #1.1.1.1: Type: text/plain, Size: 3973 bytes --]

On 25/02/2025 21:45, Krzysztof Pyrkosz via ffmpeg-devel wrote:
> ---
> This patch rids the code from two tbl instructions and the shuffle
> table. There's no fneg v0.s[3] instruction unfortunately, so I negate
> the whole vector and copy the last element only.
> 
> It's tricky to benchmark this little change but on average it seems to
> be beneficial.
> 
> Krzysztof
> 
>   libavutil/aarch64/tx_float_neon.S | 32 ++++++++-----------------------
>   1 file changed, 8 insertions(+), 24 deletions(-)
> 
> diff --git a/libavutil/aarch64/tx_float_neon.S b/libavutil/aarch64/tx_float_neon.S
> index 78e4876d6c..d00b3f9684 100644
> --- a/libavutil/aarch64/tx_float_neon.S
> +++ b/libavutil/aarch64/tx_float_neon.S
> @@ -119,13 +119,6 @@ endconst
>   .endif
>   .endm
>   
> -const shuf_4pt_x2, align=4
> -        .byte   24, 25, 26, 27 // reg2, 3
> -        .byte   12, 13, 14, 15 // reg1, 4
> -        .byte    8,  9, 10, 11 // reg1, 3
> -        .byte   28, 29, 30, 31 // reg2, 4
> -endconst
> -
>   // Identical to FFT4, but does 2 transforms in parallel, with no deinterleaving
>   .macro FFT4_X2 e0, o0, e1, o1, \
>                  t0=v16, t1=v17, t2=v18, t3=v19, t4=v20, t5=v21, t6=v22
> @@ -135,18 +128,17 @@ endconst
>           fsub            \e0\().4s, \e0\().4s, \o0\().4s                     // t1234
>           fsub            \e1\().4s, \e1\().4s, \o1\().4s                     // t1234
>   
> -        movrel          x5, shuf_4pt_x2
> -
>           rev64           \t4\().4s, \e0\().4s
>           rev64           \t5\().4s, \e1\().4s
>   
> -        zip2            \o0\().2d, \t0\().2d, \e0\().2d                     // t3,4 r3,4
> -        zip2            \o1\().2d, \t2\().2d, \e1\().2d                     // t3,4 r3,4
> +        zip2            \o0\().2d, \t0\().2d, \t4\().2d                     // t3,4 r3,4
> +        zip2            \o1\().2d, \t2\().2d, \t5\().2d                     // t3,4 r3,4
>   
> -        ld1             { \t6\().16b }, [x5]
> +        fneg            \t3\().4s, \t4\().4s
> +        fneg            \t4\().4s, \t5\().4s
>   
> -        mov             \o0\().d[1], \t4\().d[1]
> -        mov             \o1\().d[1], \t5\().d[1]
> +        mov             \o0\().s[3], \t3\().s[3]
> +        mov             \o1\().s[3], \t4\().s[3]
>   
>           zip1            \t1\().2d, \t0\().2d, \e0\().2d                     // t1,2 r1,2
>           zip1            \t3\().2d, \t2\().2d, \e1\().2d                     // t1,2 r1,2
> @@ -156,18 +148,10 @@ endconst
>           fsub            \t2\().4s, \t3\().4s, \o1\().4s                     // a34 b32
>           fadd            \t3\().4s, \t3\().4s, \o1\().4s                     // a12 b14
>   
> -        // TODO: experiment with movs instead of tables here
> -        tbl             \o0\().16b, { \t4\().16b, \t5\().16b }, \t6\().16b  // b1234
> -        tbl             \o1\().16b, { \t2\().16b, \t3\().16b }, \t6\().16b  // b1234
> -
>           zip1            \e0\().2d, \t5\().2d, \t4\().2d                     // a1234
> -//        zip2            \o0\().2d, \t5\().2d, \t4\().2d                     // b1432
> +        zip2            \o0\().2d, \t5\().2d, \t4\().2d                     // b1432
>           zip1            \e1\().2d, \t3\().2d, \t2\().2d                     // a1234
> -//        zip2            \o1\().2d, \t3\().2d, \t2\().2d                     // b1432
> -//        rev64           \o0\().4s, \o0\().4s                                // b4123
> -//        rev64           \o1\().4s, \o1\().4s                                // b4123
> -//        ext             \o0\().16b, \o0\().16b, \o0\().16b, #4              // b1234
> -//        ext             \o1\().16b, \o1\().16b, \o1\().16b, #4              // b1234
> +        zip2            \o1\().2d, \t3\().2d, \t2\().2d                     // b1432
>   .endm
>   
>   const tab_8pt, align=4

Thanks, pushed.

[-- Attachment #1.1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 637 bytes --]

[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-02-28 12:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-25 20:45 [FFmpeg-devel] [PATCH] avutil/aarch64/tx_float_neon.S: clean up FFT4_X2 Krzysztof Pyrkosz via ffmpeg-devel
2025-02-28 12:43 ` Lynne

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