1 /****************************************************************************
3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 ** This file is part of the QtGui module of the Qt Toolkit.
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** GNU Lesser General Public License Usage
11 ** This file may be used under the terms of the GNU Lesser General Public
12 ** License version 2.1 as published by the Free Software Foundation and
13 ** appearing in the file LICENSE.LGPL included in the packaging of this
14 ** file. Please review the following information to ensure the GNU Lesser
15 ** General Public License version 2.1 requirements will be met:
16 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 ** In addition, as a special exception, Nokia gives you certain additional
19 ** rights. These rights are described in the Nokia Qt LGPL Exception
20 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 ** GNU General Public License Usage
23 ** Alternatively, this file may be used under the terms of the GNU General
24 ** Public License version 3.0 as published by the Free Software Foundation
25 ** and appearing in the file LICENSE.GPL included in the packaging of this
26 ** file. Please review the following information to ensure the GNU General
27 ** Public License version 3.0 requirements will be met:
28 ** http://www.gnu.org/copyleft/gpl.html.
31 ** Alternatively, this file may be used in accordance with the terms and
32 ** conditions contained in a signed written agreement between you and Nokia.
40 ****************************************************************************/
42 /* Prevent the stack from becoming executable for no reason... */
43 #if defined(__linux__) && defined(__ELF__)
44 .section .note.GNU-stack,"",%progbits
52 /* void blend_8_pixels_argb32_on_rgb16_neon(quint16 *dst, const quint32 *src, int const_alpha) */
54 .func blend_8_pixels_argb32_on_rgb16_neon
55 .global blend_8_pixels_argb32_on_rgb16_neon
56 /* For ELF format also set function visibility to hidden */
58 .hidden blend_8_pixels_argb32_on_rgb16_neon
59 .type blend_8_pixels_argb32_on_rgb16_neon, %function
61 blend_8_pixels_argb32_on_rgb16_neon:
62 vld4.8 { d0, d1, d2, d3 }, [r1]
63 vld1.16 { d4, d5 }, [r0]
70 /* multiply by const_alpha */
82 /* convert 8 r5g6b5 pixel data from {d4, d5} to planar 8-bit format
83 and put data into d6 - red, d7 - green, d30 - blue */
94 /* now do alpha blending, storing results in 8-bit planar format
95 into d16 - red, d19 - green, d18 - blue */
99 vrshr.u16 q13, q10, #8
100 vrshr.u16 q3, q11, #8
101 vrshr.u16 q15, q12, #8
102 vraddhn.u16 d20, q10, q13
103 vraddhn.u16 d23, q11, q3
104 vraddhn.u16 d22, q12, q15
105 vqadd.u8 d16, d2, d20
107 /* convert the result to r5g6b5 and store it into {d28, d29} */
108 vshll.u8 q14, d16, #8
112 vsri.u16 q14, q9, #11
114 vst1.16 { d28, d29 }, [r0]
120 /* void blend_8_pixels_rgb16_on_rgb16_neon(quint16 *dst, const quint16 *src, int const_alpha) */
122 .func blend_8_pixels_rgb16_on_rgb16_neon
123 .global blend_8_pixels_rgb16_on_rgb16_neon
124 /* For ELF format also set function visibility to hidden */
126 .hidden blend_8_pixels_rgb16_on_rgb16_neon
127 .type blend_8_pixels_rgb16_on_rgb16_neon, %function
129 blend_8_pixels_rgb16_on_rgb16_neon:
130 vld1.16 { d0, d1 }, [r0]
131 vld1.16 { d2, d3 }, [r1]
137 /* convert 8 r5g6b5 pixel data from {d0, d1} to planar 8-bit format
138 and put data into d6 - red, d7 - green, d30 - blue */
144 vshrn.u16 d30, q0, #2
146 /* same from {d2, d3} into {d26, d27, d28} */
147 vshrn.u16 d26, q1, #8
148 vshrn.u16 d27, q1, #3
152 vshrn.u16 d28, q1, #2
154 /* multiply dst by inv const_alpha */
157 vmull.u8 q12, d5, d30
159 vshrn.u16 d6, q10, #8
160 vshrn.u16 d7, q11, #8
161 vshrn.u16 d30, q12, #8
163 /* multiply src by const_alpha */
164 vmull.u8 q10, d4, d26
165 vmull.u8 q11, d4, d27
166 vmull.u8 q12, d4, d28
168 vshrn.u16 d26, q10, #8
169 vshrn.u16 d27, q11, #8
170 vshrn.u16 d28, q12, #8
172 /* preload dst + 128 */
175 /* add components, storing results in 8-bit planar format
176 into d16 - red, d19 - green, d18 - blue */
179 vadd.u8 d18, d28, d30
181 /* convert the result to r5g6b5 and store it into {d28, d29} */
182 vshll.u8 q14, d16, #8
186 vsri.u16 q14, q9, #11
188 vst1.16 { d28, d29 }, [r0]
194 /* void qt_rotate90_16_neon(quint16 *dst, const quint16 *src, int sstride, int dstride, int count) */
195 .func qt_rotate90_16_neon
196 .global qt_rotate90_16_neon
197 /* For ELF format also set function visibility to hidden */
199 .hidden qt_rotate90_16_neon
200 .type qt_rotate90_16_neon, %function
206 /* The preloads are the key to getting good performance */
227 beq .rotate90_16_tail
230 vld1.16 { q8 }, [r1], r2
234 vld1.16 { q9 }, [r1], r2
235 vld1.16 { q10 }, [r1], r2
236 vld1.16 { q11 }, [r1], r2
240 /* Could have used four quad-word zips instead,
241 but those take three cycles as opposed to one. */
259 vst1.16 { d23 }, [r0]!
260 vst1.16 { d21 }, [r6]!
261 vst1.16 { d19 }, [r7]!
262 vst1.16 { d17 }, [r8]!
263 vst1.16 { d22 }, [r9]!
264 vst1.16 { d20 }, [r10]!
265 vst1.16 { d18 }, [r11]!
266 vst1.16 { d16 }, [r3]!
270 bne .rotate90_16_loop
273 .rotate90_16_tail_loop:
276 vld1.16 { q8 }, [r1], r2
277 vld1.16 { q9 }, [r1], r2
282 vst1.32 { d19[1] }, [r0]!
283 vst1.32 { d19[0] }, [r6]!
284 vst1.32 { d17[1] }, [r7]!
285 vst1.32 { d17[0] }, [r8]!
286 vst1.32 { d18[1] }, [r9]!
287 vst1.32 { d18[0] }, [r10]!
288 vst1.32 { d16[1] }, [r11]!
289 vst1.32 { d16[0] }, [r3]!
293 bgt .rotate90_16_tail_loop