driCheckDriDdxDrmVersion uses a function that is not available to
[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.2 2002/11/07 18:31:59 tsi 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
36 /*
37 vertex 3f vertex size 4
38 */
39
40 GLOBL ( _x86_Vertex3f_4 )
41 movl (0), %ecx
42 movl 4(%esp), %eax
43 movl 8(%esp), %edx
44 movl %eax, (%ecx)
45 movl %edx, 4(%ecx)
46 movl 12(%esp), %eax
47 movl (0), %edx
48 movl %eax, 8(%ecx)
49 movl %edx, 12(%ecx)
50 movl (0), %eax
51 addl $16, %ecx
52 dec %eax
53 movl %ecx, (0)
54 movl %eax, (0)
55 je .1
56 ret
57 .1: jmp *0
58
59 GLOBL ( _x86_Vertex3f_4_end )
60
61 /*
62 vertex 3f vertex size 6
63 */
64 GLOBL ( _x86_Vertex3f_6 )
65 push %edi
66 movl (0), %edi
67 movl 8(%esp), %eax
68 movl 12(%esp), %edx
69 movl 16(%esp), %ecx
70 movl %eax, (%edi)
71 movl %edx, 4(%edi)
72 movl %ecx, 8(%edi)
73 movl (0), %eax
74 movl (0), %edx
75 movl (0), %ecx
76 movl %eax, 12(%edi)
77 movl %edx, 16(%edi)
78 movl %ecx, 20(%edi)
79 addl $24, %edi
80 movl (0), %eax
81 movl %edi, (0)
82 dec %eax
83 pop %edi
84 movl %eax, (0)
85 je .2
86 ret
87 .2: jmp *0
88 GLOBL ( _x86_Vertex3f_6_end )
89 /*
90 vertex 3f generic size
91 */
92 GLOBL ( _x86_Vertex3f )
93 push %edi
94 push %esi
95 movl $0, %esi
96 movl (0), %edi
97 movl 12(%esp), %eax
98 movl 16(%esp), %edx
99 movl 20(%esp), %ecx
100 movl %eax, (%edi)
101 movl %edx, 4(%edi)
102 movl %ecx, 8(%edi)
103 addl $12, %edi
104 movl $0, %ecx
105 repz
106 movsl %ds:(%esi), %es:(%edi)
107 movl (0), %eax
108 movl %edi, (0)
109 dec %eax
110 movl %eax, (0)
111 pop %esi
112 pop %edi
113 je .3
114 ret
115 .3: jmp *0
116
117 GLOBL ( _x86_Vertex3f_end )
118
119 /*
120 Vertex 3fv vertex size 6
121 */
122 GLOBL ( _x86_Vertex3fv_6 )
123 movl (0), %eax
124 movl 4(%esp), %ecx
125 movl (%ecx), %edx
126 movl %edx, (%eax)
127 movl 4(%ecx), %edx
128 movl 8(%ecx), %ecx
129 movl %edx, 4(%eax)
130 movl %ecx, 8(%eax)
131 movl (28), %edx
132 movl (32), %ecx
133 movl %edx, 12(%eax)
134 movl %ecx, 16(%eax)
135 movl (36), %edx
136 movl %edx, 20(%eax)
137 addl $24, %eax
138 movl %eax, 0
139 movl 4, %eax
140 dec %eax
141 movl %eax, 4
142 je .4
143 ret
144 .4: jmp *8
145
146 GLOBL ( _x86_Vertex3fv_6_end )
147
148 /*
149 Vertex 3fv vertex size 8
150 */
151 GLOBL ( _x86_Vertex3fv_8 )
152 movl (0), %eax
153 movl 4(%esp), %ecx
154 movl (%ecx), %edx
155 movl %edx ,(%eax)
156 movl 4(%ecx) ,%edx
157 movl 8(%ecx) ,%ecx
158 movl %edx, 4(%eax)
159 movl %ecx, 8(%eax)
160 movl (28), %edx
161 movl (32), %ecx
162 movl %edx, 12(%eax)
163 movl %ecx, 16(%eax)
164 movl (28), %edx
165 movl (32), %ecx
166 movl %edx, 20(%eax)
167 movl %ecx, 24(%eax)
168 movl (36), %edx
169 movl %edx, 28(%eax)
170 addl $32, %eax
171 movl %eax, (0)
172 movl 4, %eax
173 dec %eax
174 movl %eax, (4)
175 je .5
176 ret
177 .5: jmp *8
178
179 GLOBL ( _x86_Vertex3fv_8_end )
180
181 /*
182 Vertex 3fv generic vertex size
183 */
184 GLOBL ( _x86_Vertex3fv )
185 movl 4(%esp), %edx
186 push %edi
187 push %esi
188 movl (0x1010101), %edi
189 movl (%edx), %eax
190 movl 4(%edx), %ecx
191 movl 8(%edx), %esi
192 movl %eax, (%edi)
193 movl %ecx, 4(%edi)
194 movl %esi, 8(%edi)
195 addl $12, %edi
196 movl $6, %ecx
197 movl $0x58, %esi
198 repz
199 movsl %ds:(%esi), %es:(%edi)
200 movl %edi, (0x1010101)
201 movl (0x2020202), %eax
202 pop %esi
203 pop %edi
204 dec %eax
205 movl %eax, (0x2020202)
206 je .6
207 ret
208 .6: jmp *0
209 GLOBL ( _x86_Vertex3fv_end )
210
211
212 /**
213 * Generic handler for 2 float format data. This can be used for
214 * TexCoord2f and possibly other functions.
215 */
216
217 GLOBL ( _x86_Attribute2f )
218 movl $0x0, %edx
219 movl 4(%esp), %eax
220 movl 8(%esp), %ecx
221 movl %eax, (%edx)
222 movl %ecx, 4(%edx)
223 ret
224 GLOBL ( _x86_Attribute2f_end )
225
226
227 /**
228 * Generic handler for 2 float vector format data. This can be used for
229 * TexCoord2fv and possibly other functions.
230 */
231
232 GLOBL( _x86_Attribute2fv)
233 movl 4(%esp), %eax /* load 'v' off stack */
234 movl (%eax), %ecx /* load v[0] */
235 movl 4(%eax), %eax /* load v[1] */
236 movl %ecx, 0 /* store v[0] to current vertex */
237 movl %eax, 4 /* store v[1] to current vertex */
238 ret
239 GLOBL ( _x86_Attribute2fv_end )
240
241
242 /**
243 * Generic handler for 3 float format data. This can be used for
244 * Normal3f, Color3f (when the color target is also float), or
245 * TexCoord3f.
246 */
247
248 GLOBL ( _x86_Attribute3f )
249 movl 4(%esp), %ecx
250 movl 8(%esp), %edx
251 movl 12(%esp), %eax
252 movl %ecx, 0
253 movl %edx, 4
254 movl %eax, 8
255 ret
256 GLOBL ( _x86_Attribute3f_end )
257
258 /**
259 * Generic handler for 3 float vector format data. This can be used for
260 * Normal3f, Color3f (when the color target is also float), or
261 * TexCoord3f.
262 */
263
264 GLOBL( _x86_Attribute3fv)
265 movl 4(%esp), %eax /* load 'v' off stack */
266 movl (%eax), %ecx /* load v[0] */
267 movl 4(%eax), %edx /* load v[1] */
268 movl 8(%eax), %eax /* load v[2] */
269 movl %ecx, 0 /* store v[0] to current vertex */
270 movl %edx, 4 /* store v[1] to current vertex */
271 movl %eax, 8 /* store v[2] to current vertex */
272 ret
273 GLOBL ( _x86_Attribute3fv_end )
274
275
276 /*
277 Color 4ubv_ub
278 */
279 GLOBL ( _x86_Color4ubv_ub )
280 movl 4(%esp), %eax
281 movl $0x12345678, %edx
282 movl (%eax), %eax
283 movl %eax, (%edx)
284 ret
285 GLOBL ( _x86_Color4ubv_ub_end )
286
287 /*
288 Color 4ubv 4f
289 */
290 GLOBL ( _x86_Color4ubv_4f )
291 push %ebx
292 movl $0, %edx
293 xor %eax, %eax
294 xor %ecx, %ecx
295 movl 8(%esp), %ebx
296 movl (%ebx), %ebx
297 mov %bl, %al
298 mov %bh, %cl
299 movl (%edx,%eax,4),%eax
300 movl (%edx,%ecx,4),%ecx
301 movl %eax, (0xdeadbeaf)
302 movl %ecx, (0xdeadbeaf)
303 xor %eax, %eax
304 xor %ecx, %ecx
305 shr $16, %ebx
306 mov %bl, %al
307 mov %bh, %cl
308 movl (%edx,%eax,4), %eax
309 movl (%edx,%ecx,4), %ecx
310 movl %eax, (0xdeadbeaf)
311 movl %ecx, (0xdeadbeaf)
312 pop %ebx
313 ret
314 GLOBL ( _x86_Color4ubv_4f_end )
315
316 /*
317
318 Color4ub_ub
319 */
320 GLOBL( _x86_Color4ub_ub )
321 push %ebx
322 movl 8(%esp), %eax
323 movl 12(%esp), %edx
324 movl 16(%esp), %ecx
325 movl 20(%esp), %ebx
326 mov %al, (0)
327 mov %dl, (0)
328 mov %cl, (0)
329 mov %bl, (0)
330 pop %ebx
331 ret
332 GLOBL( _x86_Color4ub_ub_end )
333
334
335 /* \todo: change the "and $7, %eax" to something like "target & 4 ? target & 5 : target & 3)" */
336 /*
337 MultiTexCoord2fv st0/st1
338 */
339 GLOBL( _x86_MultiTexCoord2fv )
340 movl 4(%esp), %eax
341 movl 8(%esp), %ecx
342 and $7, %eax
343 movl (%ecx), %edx
344 shl $3, %eax
345 movl 4(%ecx), %ecx
346 movl %edx, 0xdeadbeef(%eax)
347 movl %ecx, 0xdeadbeef(%eax)
348 ret
349 GLOBL( _x86_MultiTexCoord2fv_end )
350
351 /*
352 MultiTexCoord2fv
353 */
354
355 GLOBL( _x86_MultiTexCoord2fv_2 )
356 movl 4(%esp,1), %eax
357 movl 8(%esp,1), %ecx
358 and $0x7, %eax
359 movl 0(,%eax,4), %edx
360 movl (%ecx), %eax
361 movl %eax, (%edx)
362 movl 4(%ecx), %eax
363 movl %eax, 4(%edx)
364 ret
365 GLOBL( _x86_MultiTexCoord2fv_2_end )
366
367 /*
368 MultiTexCoord2f st0/st1
369 */
370 GLOBL( _x86_MultiTexCoord2f )
371 movl 4(%esp), %eax
372 movl 8(%esp), %edx
373 movl 12(%esp), %ecx
374 and $7, %eax
375 shl $3, %eax
376 movl %edx, 0xdeadbeef(%eax)
377 movl %ecx, 0xdeadbeef(%eax)
378 ret
379 GLOBL( _x86_MultiTexCoord2f_end )
380
381 /*
382 MultiTexCoord2f
383 */
384 GLOBL( _x86_MultiTexCoord2f_2 )
385 movl 4(%esp), %eax
386 movl 8(%esp), %edx
387 movl 12(%esp,1), %ecx
388 and $7,%eax
389 movl 0(,%eax,4), %eax
390 movl %edx, (%eax)
391 movl %ecx, 4(%eax)
392 ret
393 GLOBL( _x86_MultiTexCoord2f_2_end )
394
395 #if defined(USE_SSE_ASM)
396 /**
397 * This can be used as a template for either Color3fv (when the color
398 * target is also a 3f) or Normal3fv.
399 */
400
401 GLOBL( _sse_Attribute3fv )
402 movl 4(%esp), %eax
403 movlps (%eax), %xmm0
404 movl 8(%eax), %eax
405 movlps %xmm0, 0
406 movl %eax, 8
407 ret
408 GLOBL( _sse_Attribute3fv_end )
409
410 /**
411 * This can be used as a template for either Color3f (when the color
412 * target is also a 3f) or Normal3f.
413 */
414
415 GLOBL( _sse_Attribute3f )
416 movlps 4(%esp), %xmm0
417 movl 12(%esp), %eax
418 movlps %xmm0, 0
419 movl %eax, 8
420 ret
421 GLOBL( _sse_Attribute3f_end )
422
423
424 /**
425 * Generic handler for 2 float vector format data. This can be used for
426 * TexCoord2fv and possibly other functions.
427 */
428
429 GLOBL( _sse_Attribute2fv )
430 movl 4(%esp), %eax
431 movlps (%eax), %xmm0
432 movlps %xmm0, 0
433 ret
434 GLOBL( _sse_Attribute2fv_end )
435
436
437 /**
438 * Generic handler for 2 float format data. This can be used for
439 * TexCoord2f and possibly other functions.
440 */
441
442 GLOBL( _sse_Attribute2f )
443 movlps 4(%esp), %xmm0
444 movlps %xmm0, 0
445 ret
446 GLOBL( _sse_Attribute2f_end )
447
448 /*
449 MultiTexCoord2fv st0/st1
450 */
451 GLOBL( _sse_MultiTexCoord2fv )
452 movl 4(%esp), %eax
453 movl 8(%esp), %ecx
454 and $7, %eax
455 movlps (%ecx), %xmm0
456 movlps %xmm0, 0xdeadbeef(,%eax,8)
457 ret
458 GLOBL( _sse_MultiTexCoord2fv_end )
459
460 /*
461 MultiTexCoord2fv
462 */
463 GLOBL( _sse_MultiTexCoord2fv_2 )
464 movl 4(%esp), %eax
465 movl 8(%esp), %ecx
466 and $0x7, %eax
467 movl 0(,%eax,4), %edx
468 movlps (%ecx), %xmm0
469 movlps %xmm0, (%edx)
470 ret
471 GLOBL( _sse_MultiTexCoord2fv_2_end )
472
473 /*
474 MultiTexCoord2f st0/st1
475 */
476 GLOBL( _sse_MultiTexCoord2f )
477 movl 4(%esp), %eax
478 and $7, %eax
479 movlps 8(%esp), %xmm0
480 movlps %xmm0, 0xdeadbeef(,%eax,8)
481 ret
482 GLOBL( _sse_MultiTexCoord2f_end )
483
484 /*
485 MultiTexCoord2f
486 */
487 GLOBL( _sse_MultiTexCoord2f_2 )
488 movl 4(%esp), %eax
489 movlps 8(%esp), %xmm0
490 and $7,%eax
491 movl 0(,%eax,4), %eax
492 movlps %xmm0, (%eax)
493 ret
494 GLOBL( _sse_MultiTexCoord2f_2_end )
495 #endif