]> Pileus Git - ~andy/gtk/blob - gdk-pixbuf/pixops/composite_line_22_4a4_mmx.S
[quartz] Delete the typedef of GdkDevicePrivate
[~andy/gtk] / gdk-pixbuf / pixops / composite_line_22_4a4_mmx.S
1 /*
2  * Copyright (C) 2000 Red Hat, Inc
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19         .file   "composite_line_22_4a4_mmx.S"
20         .version        "01.01"
21 gcc2_compiled.:
22 .text
23         .align 16
24
25 #if !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(__INTERIX)        
26         
27 /* Magic indicating no need for an executable stack */
28 #if !defined __powerpc64__ && !defined __ia64__
29 .section .note.GNU-stack;  .previous
30 #endif
31         
32 .globl _pixops_composite_line_22_4a4_mmx
33         .type    _pixops_composite_line_22_4a4_mmx,@function
34 _pixops_composite_line_22_4a4_mmx:
35         
36 #else
37         
38 .globl __pixops_composite_line_22_4a4_mmx
39 __pixops_composite_line_22_4a4_mmx:
40         
41 #endif
42 /*
43  * Arguments
44  *              
45  * weights:      8(%ebp)
46  * p:           12(%ebp)        %esi
47  * q1:          16(%ebp)        
48  * q2:          20(%ebp)        
49  * xstep:       24(%ebp)        
50  * p_end:       28(%ebp)
51  * xinit:       32(%ebp)
52  *      
53 */
54 /*
55  * Function call entry
56  */
57         pushl %ebp
58         movl %esp,%ebp
59         subl $28,%esp
60         pushl %edi
61         pushl %esi
62         pushl %ebx
63 /* Locals:      
64  * int x                      %ebx
65  * int x_scaled             -24(%ebp)
66  */
67
68 /*
69  * Setup
70  */
71 /* Initialize variables */      
72         movl 32(%ebp),%ebx
73         movl 32(%ebp),%edx
74         sarl $16,%edx
75         movl 12(%ebp),%esi
76
77         movl %edx,-24(%ebp)
78
79         cmpl 28(%ebp),%esi
80         jnb  .out
81
82 /* Load initial values into %mm1, %mm3 */
83         shll $2, %edx
84
85         pxor %mm4, %mm4
86         
87         movl 16(%ebp),%edi
88         movl (%edi, %edx), %eax
89         movd (%edi, %edx), %mm5
90         punpcklbw %mm4, %mm5
91         shrl $24, %eax
92         movl $0x010101, %ecx
93         mull %ecx
94         orl  $0xff000000, %eax
95         movd %eax, %mm1
96         punpcklbw %mm4, %mm1
97         pmullw %mm5,%mm1
98
99         movl -24(%ebp),%edx
100         shll $2, %edx
101                 
102         movl 20(%ebp),%edi
103         movl (%edi, %edx), %eax
104         movd (%edi, %edx), %mm5
105         punpcklbw %mm4, %mm5
106         shrl $24, %eax
107         movl $0x010101, %ecx
108         mull %ecx
109         orl  $0xff000000, %eax
110         movd %eax, %mm3
111         punpcklbw %mm4, %mm3
112         pmullw %mm5,%mm3
113
114         psrlw $8,%mm1
115         psrlw $8,%mm3
116
117         addl $65536,%ebx
118         movl %ebx,%edx
119         sarl $16,%edx
120
121         jmp .newx
122         .p2align 4,,7
123 .loop:
124 /* int x_index = (x & 0xf000) >> 12 */
125         movl %ebx,%eax
126         andl $0xf000,%eax
127         shrl $7,%eax
128
129         movq (%edi,%eax),%mm4
130         pmullw %mm0,%mm4
131         movq 8(%edi,%eax),%mm5
132         pmullw %mm1,%mm5
133         movq 16(%edi,%eax),%mm6
134         movq 24(%edi,%eax),%mm7
135         pmullw %mm2,%mm6
136         pmullw %mm3,%mm7
137         paddw %mm4, %mm5
138         paddw %mm6, %mm7
139         paddw %mm5, %mm7
140
141         movl $0xffff,%ecx
142         movd %ecx,%mm4
143         psllq $48,%mm4
144         movq %mm4,%mm6
145         psubw %mm7,%mm4
146         pand %mm6,%mm4
147         
148         movq %mm4,%mm5
149         psrlq $16,%mm4
150         por %mm4,%mm5
151         psrlq $32,%mm5
152         por %mm4,%mm5
153         
154         psrlw $8,%mm5
155
156         movd (%esi),%mm7
157         pxor %mm4,%mm4
158         punpcklbw %mm4, %mm7
159                 
160         pmullw %mm7,%mm5
161
162 /* x += x_step; */
163         addl 24(%ebp),%ebx
164 /* x_scale = x >> 16; */
165         movl %ebx,%edx
166         sarl $16,%edx
167
168         paddw %mm5,%mm6
169
170         psrlw $8,%mm6
171         packuswb %mm6, %mm6 
172         movd %mm6,(%esi)
173
174         addl $4, %esi
175                 
176         cmpl %esi,28(%ebp)
177         je   .out
178
179         cmpl %edx,-24(%ebp)
180         je   .loop
181
182 .newx:
183         movl %edx,-24(%ebp)
184 /*
185  * Load the two new values into %mm1, %mm3, move old values into %mm0, %mm2
186  */
187         movq %mm1, %mm0
188         movq %mm3, %mm2
189
190         shll $2, %edx
191
192 #       %mm4 will always be already clear here  
193 #       pxor %mm4, %mm4
194
195         movl 16(%ebp),%edi
196         movl (%edi, %edx), %eax
197         movd (%edi, %edx), %mm5
198         punpcklbw %mm4, %mm5
199         shrl $24, %eax
200         movl $0x010101, %ecx
201         mull %ecx
202 /* 
203  *      mull destroyed %edx, need to reconstitute 
204  */
205         movl -24(%ebp),%edx
206         shll $2, %edx
207
208         orl  $0xff000000, %eax
209         movd %eax, %mm1
210         punpcklbw %mm4, %mm1
211         pmullw %mm5,%mm1
212                 
213         movl 20(%ebp),%edi
214         movl (%edi, %edx), %eax
215         movd (%edi, %edx), %mm5
216         punpcklbw %mm4, %mm5
217         shrl $24, %eax
218         movl $0x010101, %ecx
219         mull %ecx
220         orl  $0xff000000, %eax
221         movd %eax, %mm3
222         punpcklbw %mm4, %mm3
223         pmullw %mm5,%mm3
224         
225         psrlw $8,%mm1
226         psrlw $8,%mm3
227
228         movl 8(%ebp),%edi
229         
230         jmp .loop
231
232 .out:
233         movl %esi,%eax
234         emms
235         leal -40(%ebp),%esp
236         popl %ebx
237         popl %esi
238         popl %edi
239         movl %ebp,%esp
240         popl %ebp
241         ret