aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/radeon/radeon_vtxtmp_x86.S
blob: c77b41059ef18a40148dfad5bf12f646a3a76e54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_vtxtmp_x86.S,v 1.1 2002/10/30 12:51:58 alanh Exp $ */
/**************************************************************************

Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas.

All Rights Reserved.

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
on the rights to use, copy, modify, merge, publish, distribute, sub
license, and/or sell copies of the Software, and to permit persons to whom
the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
ATI, TUNGSTEN GRAPHICS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.

**************************************************************************/

#define GLOBL( x )	\
.globl x;		\
x:

.data
.align 4

/*
	vertex 3f vertex size 4
*/
	
GLOBL ( _x86_Vertex3f_4 )
	movl	(0), %ecx
	movl	4(%esp), %eax
	movl	8(%esp), %edx
	movl	%eax, (%ecx)
	movl	%edx, 4(%ecx)
	movl	12(%esp), %eax
	movl	(0), %edx
	movl	%eax, 8(%ecx)
	movl	%edx, 12(%ecx)
	movl	(0), %eax
	addl	$16, %ecx
	dec 	%eax
	movl	%ecx, (0)
	movl	%eax, (0)
	je	.1 
	ret
.1:	jmp	*0
	
GLOBL ( _x86_Vertex3f_4_end )

/*
	vertex 3f vertex size 6
*/
GLOBL ( _x86_Vertex3f_6 )
	push	%edi
	movl	(0), %edi
	movl	8(%esp), %eax
	movl	12(%esp), %edx
	movl	16(%esp), %ecx
	movl	%eax, (%edi)
	movl	%edx, 4(%edi)
	movl	%ecx, 8(%edi)
	movl	(0), %eax
	movl	(0), %edx
	movl	(0), %ecx
	movl	%eax, 12(%edi)
	movl	%edx, 16(%edi)
	movl	%ecx, 20(%edi)
	addl	$24, %edi
	movl	(0), %eax
	movl	%edi, (0)
	dec 	%eax
	pop 	%edi
	movl	%eax, (0)
	je	.2
	ret
.2:	jmp	*0
GLOBL ( _x86_Vertex3f_6_end )
/*
	vertex 3f generic size
*/
GLOBL ( _x86_Vertex3f )
	push	%edi
	push	%esi
	movl	$0, %esi
	movl	(0), %edi
	movl	12(%esp), %eax
	movl	16(%esp), %edx
	movl	20(%esp), %ecx
	movl	%eax, (%edi)
	movl	%edx, 4(%edi)
	movl	%ecx, 8(%edi)
	addl	$12, %edi
	movl	$0, %ecx
	repz
	movsl %ds:(%esi), %es:(%edi)
	movl	(0), %eax
	movl	%edi, (0)
	dec 	%eax
	movl	%eax, (0)
	pop 	%esi
	pop 	%edi
	je  	.3
	ret
.3:	jmp	*0

GLOBL ( _x86_Vertex3f_end )

/*
	Vertex 3fv vertex size 6
*/
GLOBL ( _x86_Vertex3fv_6 )
	movl	(0), %eax
	movl	4(%esp), %ecx
	movl	(%ecx), %edx
	movl	%edx, (%eax)
	movl	4(%ecx), %edx
	movl	8(%ecx), %ecx
	movl	%edx, 4(%eax)
	movl	%ecx, 8(%eax)
	movl	(28), %edx
	movl	(32), %ecx
	movl	%edx, 12(%eax)
	movl	%ecx, 16(%eax)
	movl	(36), %edx
	movl	%edx, 20(%eax)
	addl	$24, %eax
	movl	%eax, 0
	movl	4, %eax
	dec 	%eax
	movl	%eax, 4
	je	.4
	ret
.4:	jmp    *8
	
GLOBL ( _x86_Vertex3fv_6_end )

/*
	Vertex 3fv vertex size 8
*/
GLOBL ( _x86_Vertex3fv_8 )
	movl	(0), %eax
	movl	4(%esp), %ecx
	movl	(%ecx), %edx
	movl	%edx ,(%eax)
	movl	4(%ecx) ,%edx
	movl	8(%ecx) ,%ecx
	movl	%edx, 4(%eax)
	movl	%ecx, 8(%eax)
	movl	(28), %edx
	movl	(32), %ecx
	movl	%edx, 12(%eax)
	movl	%ecx, 16(%eax)
	movl	(28), %edx
	movl	(32), %ecx
	movl	%edx, 20(%eax)
	movl	%ecx, 24(%eax)
	movl	(36), %edx
	movl	%edx, 28(%eax)
	addl	$32, %eax
	movl	%eax, (0)
	movl	4, %eax
	dec	%eax
	movl    %eax, (4)
	je	.5
	ret
.5:	jmp    *8
	
GLOBL ( _x86_Vertex3fv_8_end )

/*
	Vertex 3fv generic vertex size
*/
GLOBL ( _x86_Vertex3fv )
	movl	4(%esp), %edx
	push	%edi
	push	%esi
	movl	(0x1010101), %edi
	movl	(%edx), %eax
	movl	4(%edx), %ecx
	movl	8(%edx), %esi
	movl	%eax, (%edi)
	movl	%ecx, 4(%edi)
	movl	%esi, 8(%edi)
	addl	$12, %edi
	movl	$6, %ecx
	movl	$0x58, %esi
	repz
	movsl %ds:(%esi), %es:(%edi)
	movl	%edi, (0x1010101)
	movl	(0x2020202), %eax
	pop	%esi
	pop	%edi
	dec	%eax
	movl	%eax, (0x2020202)
	je	.6
	ret
.6:	jmp    *0
GLOBL ( _x86_Vertex3fv_end )


/**
 * Generic handler for 2 float format data.  This can be used for
 * TexCoord2f and possibly other functions.
 */

GLOBL ( _x86_Attribute2f )
	movl	$0x0, %edx
	movl	4(%esp), %eax
	movl	8(%esp), %ecx
	movl	%eax, (%edx)
	movl	%ecx, 4(%edx)
	ret
GLOBL ( _x86_Attribute2f_end )


/**
 * Generic handler for 2 float vector format data.  This can be used for
 * TexCoord2fv and possibly other functions.
 */

GLOBL( _x86_Attribute2fv)
	movl 4(%esp), %eax      /* load 'v' off stack */
	movl (%eax), %ecx       /* load v[0] */
	movl 4(%eax), %eax      /* load v[1] */
	movl %ecx, 0      	/* store v[0] to current vertex */
	movl %eax, 4      	/* store v[1] to current vertex */
	ret
GLOBL ( _x86_Attribute2fv_end )


/**
 * Generic handler for 3 float format data.  This can be used for
 * Normal3f, Color3f (when the color target is also float), or
 * TexCoord3f.
 */

GLOBL ( _x86_Attribute3f )
	movl	4(%esp), %ecx
	movl	8(%esp), %edx
	movl	12(%esp), %eax
	movl	%ecx, 0
	movl	%edx, 4
	movl	%eax, 8
	ret
GLOBL ( _x86_Attribute3f_end )

/**
 * Generic handler for 3 float vector format data.  This can be used for
 * Normal3f, Color3f (when the color target is also float), or
 * TexCoord3f.
 */

GLOBL( _x86_Attribute3fv)
	movl 4(%esp), %eax      /* load 'v' off stack */
	movl (%eax), %ecx       /* load v[0] */
	movl 4(%eax), %edx      /* load v[1] */
	movl 8(%eax), %eax      /* load v[2] */
	movl %ecx, 0      	/* store v[0] to current vertex */
	movl %edx, 4      	/* store v[1] to current vertex */
	movl %eax, 8      	/* store v[2] to current vertex */
	ret
GLOBL ( _x86_Attribute3fv_end )


/*
	Color 4ubv_ub
*/
GLOBL ( _x86_Color4ubv_ub )
	movl 4(%esp), %eax
	movl $0x12345678, %edx
	movl (%eax), %eax
	movl %eax, (%edx)
	ret
GLOBL ( _x86_Color4ubv_ub_end )

/*
	Color 4ubv 4f
*/
GLOBL ( _x86_Color4ubv_4f )
	push	%ebx
	movl	$0, %edx
	xor	%eax, %eax
	xor	%ecx, %ecx
	movl	8(%esp), %ebx
	movl	(%ebx), %ebx
	mov	%bl, %al
	mov	%bh, %cl
	movl	(%edx,%eax,4),%eax
	movl	(%edx,%ecx,4),%ecx
	movl	%eax, (0xdeadbeaf)
	movl	%ecx, (0xdeadbeaf)
	xor	%eax, %eax
	xor	%ecx, %ecx
	shr	$16, %ebx
	mov	%bl, %al
	mov	%bh, %cl
	movl	(%edx,%eax,4), %eax
	movl	(%edx,%ecx,4), %ecx
	movl	%eax, (0xdeadbeaf)
	movl	%ecx, (0xdeadbeaf)
	pop	%ebx
	ret
GLOBL ( _x86_Color4ubv_4f_end )

/*

	Color4ub_ub
*/
GLOBL( _x86_Color4ub_ub )
	push	%ebx
	movl	8(%esp), %eax
	movl	12(%esp), %edx
	movl	16(%esp), %ecx
	movl	20(%esp), %ebx
	mov	%al, (0)
	mov	%dl, (0)
	mov	%cl, (0)
	mov	%bl, (0)
	pop	%ebx
	ret
GLOBL( _x86_Color4ub_ub_end )


/*
	MultiTexCoord2fv st0/st1
*/
GLOBL( _x86_MultiTexCoord2fv )
	movl	4(%esp), %eax
	movl	8(%esp), %ecx
	and	$1, %eax
	movl	(%ecx), %edx
	shl	$3, %eax
	movl	4(%ecx), %ecx
	movl	%edx, 0xdeadbeef(%eax)
	movl	%ecx, 0xdeadbeef(%eax)
	ret
GLOBL( _x86_MultiTexCoord2fv_end )

/*
	MultiTexCoord2fv
*/

GLOBL( _x86_MultiTexCoord2fv_2 )
	movl	4(%esp,1), %eax
	movl	8(%esp,1), %ecx
	and	$0x1, %eax
	movl	0(,%eax,4), %edx
	movl	(%ecx), %eax
	movl	%eax, (%edx)
	movl	4(%ecx), %eax
	movl	%eax, 4(%edx)
	ret
GLOBL( _x86_MultiTexCoord2fv_2_end )

/*
	MultiTexCoord2f st0/st1
*/
GLOBL( _x86_MultiTexCoord2f )
	movl	4(%esp), %eax
	movl	8(%esp), %edx
	movl	12(%esp), %ecx
	and	$1, %eax
	shl	$3, %eax
	movl	%edx, 0xdeadbeef(%eax)
	movl	%ecx, 0xdeadbeef(%eax)
	ret
GLOBL( _x86_MultiTexCoord2f_end )

/*
	MultiTexCoord2f
*/
GLOBL( _x86_MultiTexCoord2f_2 )
	movl	4(%esp), %eax
	movl	8(%esp), %edx
	movl	12(%esp,1), %ecx
	and	$1,%eax
	movl	0(,%eax,4), %eax
	movl	%edx, (%eax)
	movl	%ecx, 4(%eax)
	ret
GLOBL( _x86_MultiTexCoord2f_2_end )

/**
 * This can be used as a template for either Color3fv (when the color
 * target is also a 3f) or Normal3fv.
 */

GLOBL( _sse_Attribute3fv )
	movl	4(%esp), %eax
	movlps	(%eax), %xmm0
	movl	8(%eax), %eax
	movlps	%xmm0, 0
	movl	%eax, 8
	ret
GLOBL( _sse_Attribute3fv_end )

/**
 * This can be used as a template for either Color3f (when the color
 * target is also a 3f) or Normal3f.
 */

GLOBL( _sse_Attribute3f )
	movlps	4(%esp), %xmm0
	movl	12(%esp), %eax
	movlps	%xmm0, 0
	movl	%eax, 8
	ret
GLOBL( _sse_Attribute3f_end )


/**
 * Generic handler for 2 float vector format data.  This can be used for
 * TexCoord2fv and possibly other functions.
 */

GLOBL( _sse_Attribute2fv )
	movl	4(%esp), %eax
	movlps	(%eax), %xmm0
	movlps	%xmm0, 0
	ret
GLOBL( _sse_Attribute2fv_end )


/**
 * Generic handler for 2 float format data.  This can be used for
 * TexCoord2f and possibly other functions.
 */

GLOBL( _sse_Attribute2f )
	movlps	4(%esp), %xmm0
	movlps	%xmm0, 0
	ret
GLOBL( _sse_Attribute2f_end )

/*
	MultiTexCoord2fv st0/st1
*/
GLOBL( _sse_MultiTexCoord2fv )
	movl	4(%esp), %eax
	movl	8(%esp), %ecx
	and	$1, %eax
	movlps	(%ecx), %xmm0
	movlps	%xmm0, 0xdeadbeef(,%eax,8)
	ret
GLOBL( _sse_MultiTexCoord2fv_end )

/*
	MultiTexCoord2fv
*/
GLOBL( _sse_MultiTexCoord2fv_2 )
	movl	4(%esp), %eax
	movl	8(%esp), %ecx
	and	$0x1, %eax
	movl	0(,%eax,4), %edx
	movlps	(%ecx), %xmm0
	movlps	%xmm0, (%edx)
	ret
GLOBL( _sse_MultiTexCoord2fv_2_end )

/*
	MultiTexCoord2f st0/st1
*/
GLOBL( _sse_MultiTexCoord2f )
	movl	4(%esp), %eax
	and	$1, %eax
	movlps	8(%esp), %xmm0
	movlps	%xmm0, 0xdeadbeef(,%eax,8)
	ret
GLOBL( _sse_MultiTexCoord2f_end )

/*
	MultiTexCoord2f
*/
GLOBL( _sse_MultiTexCoord2f_2 )
	movl	4(%esp), %eax
	movlps	8(%esp), %xmm0
	and	$1,%eax
	movl	0(,%eax,4), %eax
	movlps	%xmm0, (%eax)
	ret
GLOBL( _sse_MultiTexCoord2f_2_end )