r200 driver, brought over by Jon Smirl
[mesa.git] / src / mesa / drivers / dri / r200 / r200_vtxtmp_x86.S
1 /* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_vtxtmp_x86.S,v 1.1 2002/10/30 12:51:53 alanh Exp $ */
2 /**************************************************************************
3
4 Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas.
5
6 All Rights Reserved.
7
8 Permission is hereby granted, free of charge, to any person obtaining a
9 copy of this software and associated documentation files (the "Software"),
10 to deal in the Software without restriction, including without limitation
11 on the rights to use, copy, modify, merge, publish, distribute, sub
12 license, and/or sell copies of the Software, and to permit persons to whom
13 the Software is furnished to do so, subject to the following conditions:
14
15 The above copyright notice and this permission notice (including the next
16 paragraph) shall be included in all copies or substantial portions of the
17 Software.
18
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
22 ATI, TUNGSTEN GRAPHICS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
23 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24 OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
25 USE OR OTHER DEALINGS IN THE SOFTWARE.
26
27 **************************************************************************/
28
29 #define GLOBL( x ) \
30 .globl x; \
31 x:
32
33 .data
34 .align 4
35 GLOBL( _x86_Normal3fv)
36 movl 4(%esp), %eax /* load 'v' off stack */
37 movl (%eax), %ecx /* load v[0] */
38 movl 4(%eax), %edx /* load v[1] */
39 movl 8(%eax), %eax /* load v[2] */
40 movl %ecx, 0 /* store v[0] to current vertex */
41 movl %edx, 4 /* store v[1] to current vertex */
42 movl %eax, 8 /* store v[2] to current vertex */
43 ret
44 GLOBL ( _x86_Normal3fv_end )
45
46 /*
47 vertex 3f vertex size 4
48 */
49
50 GLOBL ( _x86_Vertex3f_4 )
51 movl (0), %ecx
52 movl 4(%esp), %eax
53 movl 8(%esp), %edx
54 movl %eax, (%ecx)
55 movl %edx, 4(%ecx)
56 movl 12(%esp), %eax
57 movl (0), %edx
58 movl %eax, 8(%ecx)
59 movl %edx, 12(%ecx)
60 movl (0), %eax
61 addl $16, %ecx
62 dec %eax
63 movl %ecx, (0)
64 movl %eax, (0)
65 je .1
66 ret
67 .1: jmp *0
68
69 GLOBL ( _x86_Vertex3f_4_end )
70
71 /*
72 vertex 3f vertex size 6
73 */
74 GLOBL ( _x86_Vertex3f_6 )
75 push %edi
76 movl (0), %edi
77 movl 8(%esp), %eax
78 movl 12(%esp), %edx
79 movl 16(%esp), %ecx
80 movl %eax, (%edi)
81 movl %edx, 4(%edi)
82 movl %ecx, 8(%edi)
83 movl (0), %eax
84 movl (0), %edx
85 movl (0), %ecx
86 movl %eax, 12(%edi)
87 movl %edx, 16(%edi)
88 movl %ecx, 20(%edi)
89 addl $24, %edi
90 movl (0), %eax
91 movl %edi, (0)
92 dec %eax
93 pop %edi
94 movl %eax, (0)
95 je .2
96 ret
97 .2: jmp *0
98 GLOBL ( _x86_Vertex3f_6_end )
99 /*
100 vertex 3f generic size
101 */
102 GLOBL ( _x86_Vertex3f )
103 push %edi
104 push %esi
105 movl $0, %esi
106 movl (0), %edi
107 movl 12(%esp), %eax
108 movl 16(%esp), %edx
109 movl 20(%esp), %ecx
110 movl %eax, (%edi)
111 movl %edx, 4(%edi)
112 movl %ecx, 8(%edi)
113 addl $12, %edi
114 movl $0, %ecx
115 repz
116 movsl %ds:(%esi), %es:(%edi)
117 movl (0), %eax
118 movl %edi, (0)
119 dec %eax
120 movl %eax, (0)
121 pop %esi
122 pop %edi
123 je .3
124 ret
125 .3: jmp *0
126
127 GLOBL ( _x86_Vertex3f_end )
128
129 /*
130 Vertex 3fv vertex size 6
131 */
132 GLOBL ( _x86_Vertex3fv_6 )
133 movl (0), %eax
134 movl 4(%esp), %ecx
135 movl (%ecx), %edx
136 movl %edx, (%eax)
137 movl 4(%ecx), %edx
138 movl 8(%ecx), %ecx
139 movl %edx, 4(%eax)
140 movl %ecx, 8(%eax)
141 movl (28), %edx
142 movl (32), %ecx
143 movl %edx, 12(%eax)
144 movl %ecx, 16(%eax)
145 movl (36), %edx
146 movl %edx, 20(%eax)
147 addl $24, %eax
148 movl %eax, 0
149 movl 4, %eax
150 dec %eax
151 movl %eax, 4
152 je .4
153 ret
154 .4: jmp *8
155
156 GLOBL ( _x86_Vertex3fv_6_end )
157
158 /*
159 Vertex 3fv vertex size 8
160 */
161 GLOBL ( _x86_Vertex3fv_8 )
162 movl (0), %eax
163 movl 4(%esp), %ecx
164 movl (%ecx), %edx
165 movl %edx ,(%eax)
166 movl 4(%ecx) ,%edx
167 movl 8(%ecx) ,%ecx
168 movl %edx, 4(%eax)
169 movl %ecx, 8(%eax)
170 movl (28), %edx
171 movl (32), %ecx
172 movl %edx, 12(%eax)
173 movl %ecx, 16(%eax)
174 movl (28), %edx
175 movl (32), %ecx
176 movl %edx, 20(%eax)
177 movl %ecx, 24(%eax)
178 movl (36), %edx
179 movl %edx, 28(%eax)
180 addl $32, %eax
181 movl %eax, (0)
182 movl 4, %eax
183 dec %eax
184 movl %eax, (4)
185 je .5
186 ret
187 .5: jmp *8
188
189 GLOBL ( _x86_Vertex3fv_8_end )
190
191 /*
192 Vertex 3fv generic vertex size
193 */
194 GLOBL ( _x86_Vertex3fv )
195 movl 4(%esp), %edx
196 push %edi
197 push %esi
198 movl (0x1010101), %edi
199 movl (%edx), %eax
200 movl 4(%edx), %ecx
201 movl 8(%edx), %esi
202 movl %eax, (%edi)
203 movl %ecx, 4(%edi)
204 movl %esi, 8(%edi)
205 addl $12, %edi
206 movl $6, %ecx
207 movl $0x58, %esi
208 repz
209 movsl %ds:(%esi), %es:(%edi)
210 movl %edi, (0x1010101)
211 movl (0x2020202), %eax
212 pop %esi
213 pop %edi
214 dec %eax
215 movl %eax, (0x2020202)
216 je .6
217 ret
218 .6: jmp *0
219 GLOBL ( _x86_Vertex3fv_end )
220
221 /*
222 Normal 3f
223 */
224 GLOBL ( _x86_Normal3f )
225 movl $0x12345678, %edx
226 movl 4(%esp), %eax
227 movl %eax, (%edx)
228 movl 8(%esp), %eax
229 movl %eax, 4(%edx)
230 movl 12(%esp), %eax
231 movl %eax, 8(%edx)
232 ret
233 GLOBL ( _x86_Normal3f_end )
234
235 /*
236 Color 4ubv_ub
237 */
238 GLOBL ( _x86_Color4ubv_ub )
239 movl 4(%esp), %eax
240 movl $0x12345678, %edx
241 movl (%eax), %eax
242 movl %eax, (%edx)
243 ret
244 GLOBL ( _x86_Color4ubv_ub_end )
245
246 /*
247 Color 4ubv 4f
248 */
249 GLOBL ( _x86_Color4ubv_4f )
250 push %ebx
251 movl $0, %edx
252 xor %eax, %eax
253 xor %ecx, %ecx
254 movl 8(%esp), %ebx
255 movl (%ebx), %ebx
256 mov %bl, %al
257 mov %bh, %cl
258 movl (%edx,%eax,4),%eax
259 movl (%edx,%ecx,4),%ecx
260 movl %eax, (0xdeadbeaf)
261 movl %ecx, (0xdeadbeaf)
262 xor %eax, %eax
263 xor %ecx, %ecx
264 shr $16, %ebx
265 mov %bl, %al
266 mov %bh, %cl
267 movl (%edx,%eax,4), %eax
268 movl (%edx,%ecx,4), %ecx
269 movl %eax, (0xdeadbeaf)
270 movl %ecx, (0xdeadbeaf)
271 pop %ebx
272 ret
273 GLOBL ( _x86_Color4ubv_4f_end )
274
275 /*
276
277 Color4ub_ub
278 */
279 GLOBL( _x86_Color4ub_ub )
280 push %ebx
281 movl 8(%esp), %eax
282 movl 12(%esp), %edx
283 movl 16(%esp), %ecx
284 movl 20(%esp), %ebx
285 mov %al, (0)
286 mov %dl, (0)
287 mov %cl, (0)
288 mov %bl, (0)
289 pop %ebx
290 ret
291 GLOBL( _x86_Color4ub_ub_end )
292
293 /*
294 Color3fv_3f
295 */
296 GLOBL( _x86_Color3fv_3f )
297 movl 4(%esp), %eax
298 movl $0, %edx
299 movl (%eax), %ecx
300 movl %ecx, (%edx)
301 movl 4(%eax), %ecx
302 movl %ecx, 4(%edx)
303 movl 8(%eax), %ecx
304 movl %ecx, 8(%edx)
305 ret
306 GLOBL( _x86_Color3fv_3f_end )
307
308 /*
309 Color3f_3f
310 */
311 GLOBL( _x86_Color3f_3f )
312 movl $0x12345678, %edx
313 movl 4(%esp), %eax
314 movl %eax, (%edx)
315 movl 8(%esp,1), %eax
316 movl %eax, 4(%edx)
317 movl 12(%esp), %eax
318 movl %eax, 8(%edx)
319 ret
320 GLOBL( _x86_Color3f_3f_end )
321
322 /*
323 TexCoord2fv
324 */
325
326 GLOBL( _x86_TexCoord2fv )
327 movl 4(%esp), %eax
328 movl $0x12345678, %edx
329 movl (%eax), %ecx
330 movl 4(%eax), %eax
331 movl %ecx, (%edx)
332 movl %eax, 4(%edx)
333 ret
334
335 GLOBL( _x86_TexCoord2fv_end )
336 /*
337 TexCoord2f
338 */
339 GLOBL( _x86_TexCoord2f )
340 movl $0x12345678, %edx
341 movl 4(%esp), %eax
342 movl 8(%esp), %ecx
343 movl %eax, (%edx)
344 movl %ecx, 4(%edx)
345 ret
346 GLOBL( _x86_TexCoord2f_end )
347
348 /*
349 MultiTexCoord2fvARB st0/st1
350 */
351 GLOBL( _x86_MultiTexCoord2fvARB )
352
353 movl 4(%esp), %eax
354 movl 8(%esp), %ecx
355 sub $0x84c0, %eax
356 and $1, %eax
357 movl (%ecx), %edx
358 shl $3, %eax
359 movl 4(%ecx), %ecx
360 movl %edx, 0xdeadbeef(%eax)
361 movl %ecx, 0xdeadbeef(%eax)
362 ret
363 GLOBL( _x86_MultiTexCoord2fvARB_end )
364 /*
365 MultiTexCoord2fvARB
366 */
367
368 GLOBL( _x86_MultiTexCoord2fvARB_2 )
369 movl 4(%esp,1), %eax
370 movl 8(%esp,1), %ecx
371 sub $0x84c0, %eax
372 and $0x1, %eax
373 movl 0(,%eax,4), %edx
374 movl (%ecx), %eax
375 movl %eax, (%edx)
376 movl 4(%ecx), %eax
377 movl %eax, 4(%edx)
378 ret
379
380 GLOBL( _x86_MultiTexCoord2fvARB_2_end )
381
382 /*
383 MultiTexCoord2fARB st0/st1
384 */
385 GLOBL( _x86_MultiTexCoord2fARB )
386 movl 4(%esp), %eax
387 movl 8(%esp), %edx
388 sub $0x84c0, %eax
389 movl 12(%esp), %ecx
390 and $1, %eax
391 shl $3, %eax
392 movl %edx, 0xdeadbeef(%eax)
393 movl %ecx, 0xdeadbeef(%eax)
394 ret
395 GLOBL( _x86_MultiTexCoord2fARB_end )
396
397 /*
398 MultiTexCoord2fARB
399 */
400 GLOBL( _x86_MultiTexCoord2fARB_2 )
401 movl 4(%esp), %eax
402 movl 8(%esp), %edx
403 sub $0x84c0, %eax
404 movl 12(%esp,1), %ecx
405 and $1,%eax
406 movl 0(,%eax,4), %eax
407 movl %edx, (%eax)
408 movl %ecx, 4(%eax)
409 ret
410 GLOBL( _x86_MultiTexCoord2fARB_2_end )