frontend: change nub_adjust ranges
[pcsx_rearmed.git] / plugins / gpulib / cspace_neon.s
CommitLineData
a327967e 1/*
2 * (C) GraÅžvydas "notaz" Ignotas, 2010
3 *
69af03a2 4 * This work is licensed under the terms of any of these licenses
5 * (at your option):
6 * - GNU GPL, version 2 or later.
7 * - GNU LGPL, version 2.1 or later.
a327967e 8 * See the COPYING file in the top-level directory.
9 */
10
11.text
12.align 2
13
14.global bgr555_to_rgb565
15bgr555_to_rgb565:
30f6e5ed 16 pld [r1]
d352cde2 17 mov r3, #0x07c0
a327967e 18 vdup.16 q15, r3
69f0df9c 19 subs r2, r2, #64
20 blt btr16_end64
a327967e 210:
30f6e5ed 22 pld [r1, #64*2]
a327967e 23 vldmia r1!, {q0-q3}
d352cde2 24 vshl.u16 q4, q0, #11
25 vshl.u16 q5, q1, #11
26 vshl.u16 q6, q2, #11
27 vshl.u16 q7, q3, #11
28 vsri.u16 q4, q0, #10
29 vsri.u16 q5, q1, #10
30 vsri.u16 q6, q2, #10
31 vsri.u16 q7, q3, #10
a327967e 32 vshl.u16 q0, q0, #1
33 vshl.u16 q1, q1, #1
34 vshl.u16 q2, q2, #1
35 vshl.u16 q3, q3, #1
d352cde2 36 vbit q4, q0, q15
37 vbit q5, q1, q15
38 vbit q6, q2, q15
39 vbit q7, q3, q15
40 vstmia r0!, {q4-q7}
41 subs r2, r2, #64
42 bge 0b
43
69f0df9c 44btr16_end64:
d352cde2 45 adds r2, r2, #64
46 bxeq lr
69f0df9c 47 subs r2, r2, #16
48 blt btr16_end16
d352cde2 49
69f0df9c 50 @ handle the remainder (reasonably rare)
d352cde2 510:
69f0df9c 52 vld1.16 {q0}, [r1]!
d352cde2 53 vshl.u16 q1, q0, #11
54 vshl.u16 q2, q0, #1
55 vsri.u16 q1, q0, #10
56 vbit q1, q2, q15
57 subs r2, r2, #16
69f0df9c 58 vst1.16 {q1}, [r0]!
59 bge 0b
60
61btr16_end16:
62 adds r2, r2, #16
63 bxeq lr
64 subs r2, r2, #8
65 bxlt lr
a327967e 66
69f0df9c 67 @ very rare
68 vld1.16 d0, [r1]!
69 vshl.u16 d1, d0, #11
70 vshl.u16 d2, d0, #1
71 vsri.u16 d1, d0, #10
72 vbit d1, d2, d30
73 vst1.16 d1, [r0]!
a327967e 74 bx lr
75
1972732a 76
77.global bgr888_to_rgb888
78bgr888_to_rgb888:
30f6e5ed 79 pld [r1]
1972732a 80 @ r2 /= 48
81 mov r2, r2, lsr #4
82 movw r3, #0x5556
83 movt r3, #0x5555
84 umull r12,r2, r3, r2
850:
30f6e5ed 86 pld [r1, #48*3]
1972732a 87 vld3.8 {d0-d2}, [r1, :64]!
88 vld3.8 {d3-d5}, [r1, :64]!
89 vswp d0, d2
90 vswp d3, d5
91 vst3.8 {d0-d2}, [r0, :64]!
92 vst3.8 {d3-d5}, [r0, :64]!
93 subs r2, r2, #1
94 bne 0b
95
96 bx lr
97
98
f3a63e25 99.global bgr888_to_rgb565
100bgr888_to_rgb565:
30f6e5ed 101 pld [r1]
f3a63e25 102 @ r2 /= 48
103 mov r2, r2, lsr #4
104 movw r3, #0x5556
105 movt r3, #0x5555
106 umull r12,r2, r3, r2
107
108 mov r3, #0x07e0
109 vdup.16 q15, r3
1100:
30f6e5ed 111 pld [r1, #48*3]
f3a63e25 112 vld3.8 {d1-d3}, [r1, :64]!
113 vld3.8 {d5-d7}, [r1, :64]!
114
115 vshll.u8 q8, d2, #3 @ g
116 vshll.u8 q9, d6, #3
117 vshr.u8 d0, d3, #3 @ b
118 vshr.u8 d4, d7, #3
119 vzip.8 d0, d1 @ rb
120 vzip.8 d4, d5
121 vbit q0, q8, q15
122 vbit q2, q9, q15
123
124 vstmia r0!, {d0,d1}
125 vstmia r0!, {d4,d5}
126 subs r2, r2, #1
127 bne 0b
128
129 bx lr
130
131
00a5d459 132.global rgb888_to_rgb565
133rgb888_to_rgb565:
134 pld [r1]
135 @ r2 /= 48
136 mov r2, r2, lsr #4
137 movw r3, #0x5556
138 movt r3, #0x5555
139 umull r12,r2, r3, r2
140
141 mov r3, #0x07e0
142 vdup.16 q15, r3
1430:
144 pld [r1, #48*3]
145 vld3.8 {d1-d3}, [r1, :64]!
146 vld3.8 {d5-d7}, [r1, :64]!
147
148 vshll.u8 q8, d2, #3 @ g
149 vshll.u8 q9, d6, #3
150 vshr.u8 d2, d1, #3 @ b
151 vshr.u8 d6, d5, #3
152 vzip.8 d2, d3 @ rb
153 vzip.8 d6, d7
154 vbit q1, q8, q15
155 vbit q3, q9, q15
156
157 vstmia r0!, {d2,d3}
158 vstmia r0!, {d6,d7}
159 subs r2, r2, #1
160 bne 0b
161
162 bx lr
163
164
a327967e 165@ vim:filetype=armasm