Debian Codegraph @

src/libmpg123/synth_neon64.S

raw
1 /*
2 synth_neon64: NEON optimized synth for AArch64
3
4 copyright 1995-2014 by the mpg123 project - free software under the terms of the LGPL 2.1
5 see COPYING and AUTHORS files in distribution or http://mpg123.org
6 initially written by Taihei Monma
7 */
8
9 #include "aarch64_defs.h"
10 #include "mangle.h"
11
12 RODATA
13 ALIGN16
14 maxmin_s16:
15 .word 32767
16 .word -32768
17 .text
18 ALIGN4
19 .globl ASM_NAME(INT123_synth_1to1_neon64_asm)
20 #ifdef __ELF__
21 .type ASM_NAME(INT123_synth_1to1_neon64_asm), %function
22 #endif
23 ASM_NAME(INT123_synth_1to1_neon64_asm):
24 add x0, x0, #32
25 sub x0, x0, x3, lsl #1
26 eor v31.16b, v31.16b, v31.16b
27 adrp x5, AARCH64_PCREL_HI(maxmin_s16)
28 add x5, x5, AARCH64_PCREL_LO(maxmin_s16)
29 ld2r {v28.4s,v29.4s}, [x5]
30
31 mov w4, #4
32 mov x5, #64
33 1:
34 ld1 {v0.8h,v1.8h}, [x0], x5
35 ld1 {v2.8h,v3.8h}, [x0], x5
36 ld1 {v4.8h,v5.8h}, [x0], x5
37 ld1 {v6.8h,v7.8h}, [x0], x5
38 ld1 {v16.8h,v17.8h,v18.8h,v19.8h}, [x1], #64
39 ld1 {v20.8h,v21.8h,v22.8h,v23.8h}, [x1], #64
40
41 smull v24.4s, v0.4h, v16.4h
42 smull v25.4s, v2.4h, v18.4h
43 smull v26.4s, v4.4h, v20.4h
44 smull v27.4s, v6.4h, v22.4h
45 smlal2 v24.4s, v0.8h, v16.8h
46 smlal2 v25.4s, v2.8h, v18.8h
47 smlal2 v26.4s, v4.8h, v20.8h
48 smlal2 v27.4s, v6.8h, v22.8h
49 smlal v24.4s, v1.4h, v17.4h
50 smlal v25.4s, v3.4h, v19.4h
51 smlal v26.4s, v5.4h, v21.4h
52 smlal v27.4s, v7.4h, v23.4h
53 smlal2 v24.4s, v1.8h, v17.8h
54 smlal2 v25.4s, v3.8h, v19.8h
55 smlal2 v26.4s, v5.8h, v21.8h
56 smlal2 v27.4s, v7.8h, v23.8h
57
58 addp v0.4s, v24.4s, v25.4s
59 addp v1.4s, v26.4s, v27.4s
60 addp v0.4s, v0.4s, v1.4s
61 ld2 {v4.4h,v5.4h}, [x2]
62 sqrshrn v4.4h, v0.4s, #13
63 cmgt v2.4s, v0.4s, v28.4s
64 cmgt v3.4s, v29.4s, v0.4s
65 add v2.4s, v2.4s, v3.4s
66 add v31.4s, v31.4s, v2.4s
67 st2 {v4.4h,v5.4h}, [x2], #16
68
69 subs w4, w4, #1
70 b.ne 1b
71
72 mov w4, #4
73 mov x6, #-32
74 2:
75 ld1 {v0.8h,v1.8h}, [x0], x5
76 ld1 {v2.8h,v3.8h}, [x0], x5
77 ld1 {v4.8h,v5.8h}, [x0], x5
78 ld1 {v6.8h,v7.8h}, [x0], x5
79 ld1 {v16.8h,v17.8h}, [x1], x6
80 ld1 {v18.8h,v19.8h}, [x1], x6
81 ld1 {v20.8h,v21.8h}, [x1], x6
82 ld1 {v22.8h,v23.8h}, [x1], x6
83
84 smull v24.4s, v0.4h, v16.4h
85 smull v25.4s, v2.4h, v18.4h
86 smull v26.4s, v4.4h, v20.4h
87 smull v27.4s, v6.4h, v22.4h
88 smlal2 v24.4s, v0.8h, v16.8h
89 smlal2 v25.4s, v2.8h, v18.8h
90 smlal2 v26.4s, v4.8h, v20.8h
91 smlal2 v27.4s, v6.8h, v22.8h
92 smlal v24.4s, v1.4h, v17.4h
93 smlal v25.4s, v3.4h, v19.4h
94 smlal v26.4s, v5.4h, v21.4h
95 smlal v27.4s, v7.4h, v23.4h
96 smlal2 v24.4s, v1.8h, v17.8h
97 smlal2 v25.4s, v3.8h, v19.8h
98 smlal2 v26.4s, v5.8h, v21.8h
99 smlal2 v27.4s, v7.8h, v23.8h
100
101 addp v0.4s, v24.4s, v25.4s
102 addp v1.4s, v26.4s, v27.4s
103 addp v0.4s, v0.4s, v1.4s
104 ld2 {v4.4h,v5.4h}, [x2]
105 sqrshrn v4.4h, v0.4s, #13
106 cmgt v2.4s, v0.4s, v28.4s
107 cmgt v3.4s, v29.4s, v0.4s
108 add v2.4s, v2.4s, v3.4s
109 add v31.4s, v31.4s, v2.4s
110 st2 {v4.4h,v5.4h}, [x2], #16
111
112 subs w4, w4, #1
113 b.ne 2b
114
115 AARCH64_DUP_2D(v0, v31, 1)
116 add v0.4s, v0.4s, v31.4s
117 AARCH64_DUP_4S(v1, v0, 1)
118 add v0.4s, v0.4s, v1.4s
119 umov w0, v0.s[0]
120 neg w0, w0
121
122 ret
123
124 NONEXEC_STACK