• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1
2/*
3 * Mesa 3-D graphics library
4 * Version:  3.5
5 *
6 * Copyright (C) 1999-2001  Brian Paul   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 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included
16 * in all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
21 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
22 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 */
25
26#ifdef USE_3DNOW_ASM
27#include "assyntax.h"
28#include "matypes.h"
29#include "xform_args.h"
30
31    SEG_TEXT
32
33#define FRAME_OFFSET	4
34
35
36ALIGNTEXT16
37GLOBL GLNAME( _mesa_3dnow_transform_points1_general )
38HIDDEN(_mesa_3dnow_transform_points1_general)
39GLNAME( _mesa_3dnow_transform_points1_general ):
40
41    PUSH_L    ( ESI )
42
43    MOV_L     ( ARG_DEST, ECX )
44    MOV_L     ( ARG_MATRIX, ESI )
45    MOV_L     ( ARG_SOURCE, EAX )
46    MOV_L     ( CONST(4), REGOFF(V4F_SIZE, ECX) )
47    OR_B      ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) )
48    MOV_L     ( REGOFF(V4F_COUNT, EAX), EDX )
49    MOV_L     ( EDX, REGOFF(V4F_COUNT, ECX) )
50
51    PUSH_L    ( EDI )
52
53    MOV_L     ( REGOFF(4, ECX), EDX )
54    MOV_L     ( ESI, ECX )
55    MOV_L     ( REGOFF(V4F_COUNT, EAX), ESI )
56    MOV_L     ( REGOFF(V4F_STRIDE, EAX), EDI )
57    MOV_L     ( REGOFF(V4F_START, EAX), EAX )
58
59    TEST_L    ( ESI, ESI )
60    JZ        ( LLBL( G3TPGR_3 ) )
61
62    MOVQ      ( REGIND(ECX), MM0 )	/* m01             | m00             */
63    MOVQ      ( REGOFF(8, ECX), MM1 )	/* m03             | m02             */
64
65    MOVQ      ( REGOFF(48, ECX), MM2 )	/* m31             | m30             */
66    MOVQ      ( REGOFF(56, ECX), MM3 )	/* m33             | m32             */
67
68ALIGNTEXT16
69LLBL( G3TPGR_2 ):
70
71    MOVD      ( REGIND(EAX), MM4 )	/*                 | x0              */
72    PUNPCKLDQ ( MM4, MM4 )		/* x0              | x0              */
73
74    MOVQ      ( MM4, MM5 )		/* x0              | x0              */
75    PFMUL     ( MM0, MM4 )		/* x0*m01          | x0*m00          */
76
77    PFMUL     ( MM1, MM5 )		/* x0*m03          | x0*m02          */
78    PFADD     ( MM2, MM4 )		/* x0*m01+m31      | x0*m00+m30      */
79
80    PFADD     ( MM3, MM5 )		/* x0*m03+m33      | x0*m02+m32      */
81    MOVQ      ( MM4, REGIND(EDX) )	/* write r1, r0                      */
82
83    MOVQ      ( MM5, REGOFF(8, EDX) )	/* write r3, r2                      */
84    ADD_L     ( EDI, EAX )		/* next vertex                       */
85
86    ADD_L     ( CONST(16), EDX )	/* next r                            */
87    DEC_L     ( ESI )			/* decrement vertex counter          */
88
89    JNZ       ( LLBL( G3TPGR_2 ) )	/* cnt > 0 ? -> process next vertex  */
90
91LLBL( G3TPGR_3 ):
92
93    FEMMS
94    POP_L     ( EDI )
95    POP_L     ( ESI )
96    RET
97
98
99
100
101ALIGNTEXT16
102GLOBL GLNAME( _mesa_3dnow_transform_points1_identity )
103HIDDEN(_mesa_3dnow_transform_points1_identity)
104GLNAME( _mesa_3dnow_transform_points1_identity ):
105
106    PUSH_L    ( ESI )
107
108    MOV_L     ( ARG_DEST, ECX )
109    MOV_L     ( ARG_MATRIX, ESI )
110    MOV_L     ( ARG_SOURCE, EAX )
111    MOV_L     ( CONST(1), REGOFF(V4F_SIZE, ECX) )
112    OR_B      ( CONST(VEC_SIZE_1), REGOFF(V4F_FLAGS, ECX) )
113    MOV_L     ( REGOFF(V4F_COUNT, EAX), EDX )
114    MOV_L     ( EDX, REGOFF(V4F_COUNT, ECX) )
115
116    PUSH_L    ( EDI )
117
118    MOV_L     ( REGOFF(4, ECX), EDX )
119    MOV_L     ( ESI, ECX )
120    MOV_L     ( REGOFF(V4F_COUNT, EAX), ESI )
121    MOV_L     ( REGOFF(V4F_STRIDE, EAX), EDI )
122    MOV_L     ( REGOFF(V4F_START, EAX), EAX )
123
124    TEST_L    ( ESI, ESI )
125    JZ        ( LLBL( G3TPIR_4) )
126
127ALIGNTEXT16
128LLBL( G3TPIR_3 ):
129
130    MOVD      ( REGIND(EAX), MM0 )	/*                 | x0              */
131    ADD_L     ( EDI, EAX )		/* next vertex                       */
132
133    MOVD      ( MM0, REGIND(EDX) )	/*                 | r0              */
134    ADD_L     ( CONST(16), EDX )	/* next r                            */
135
136    DEC_L     ( ESI )			/* decrement vertex counter          */
137    JNZ       ( LLBL( G3TPIR_3 ) )	/* cnt > 0 ? -> process next vertex  */
138
139LLBL( G3TPIR_4 ):
140
141    FEMMS
142    POP_L     ( EDI )
143    POP_L     ( ESI )
144    RET
145
146
147
148
149ALIGNTEXT16
150GLOBL GLNAME( _mesa_3dnow_transform_points1_3d_no_rot )
151HIDDEN(_mesa_3dnow_transform_points1_3d_no_rot)
152GLNAME( _mesa_3dnow_transform_points1_3d_no_rot ):
153
154    PUSH_L    ( ESI )
155
156    MOV_L     ( ARG_DEST, ECX )
157    MOV_L     ( ARG_MATRIX, ESI )
158    MOV_L     ( ARG_SOURCE, EAX )
159    MOV_L     ( CONST(3), REGOFF(V4F_SIZE, ECX) )
160    OR_B      ( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, ECX) )
161    MOV_L     ( REGOFF(V4F_COUNT, EAX), EDX )
162    MOV_L     ( EDX, REGOFF(V4F_COUNT, ECX) )
163
164    PUSH_L    ( EDI )
165
166    MOV_L     ( REGOFF(4, ECX), EDX )
167    MOV_L     ( ESI, ECX )
168    MOV_L     ( REGOFF(V4F_COUNT, EAX), ESI )
169    MOV_L     ( REGOFF(V4F_STRIDE, EAX), EDI )
170    MOV_L     ( REGOFF(V4F_START, EAX), EAX )
171
172    TEST_L    ( ESI, ESI )
173    JZ        ( LLBL( G3TP3NRR_3 ) )
174
175    MOVD      ( REGIND(ECX), MM0 )	/*                 | m00             */
176    MOVQ      ( REGOFF(48, ECX), MM2 )	/* m31             | m30             */
177
178    MOVD      ( REGOFF(56, ECX), MM3 )	/*                 | m32             */
179
180ALIGNTEXT16
181LLBL( G3TP3NRR_2 ):
182
183    MOVD      ( REGIND(EAX), MM4 )	/*                 | x0              */
184    PFMUL     ( MM0, MM4 )		/*                 | x0*m00          */
185
186    PFADD     ( MM2, MM4 )		/* m31             | x0*m00+m30      */
187    MOVQ      ( MM4, REGIND(EDX) )	/* write r1, r0                      */
188
189    MOVD      ( MM3, REGOFF(8, EDX) )	/* write r2                          */
190    ADD_L     ( EDI, EAX )		/* next vertex                       */
191
192    ADD_L     ( CONST(16), EDX )	/* next r                            */
193    DEC_L     ( ESI )			/* decrement vertex counter          */
194
195    JNZ       ( LLBL( G3TP3NRR_2 ) )	/* cnt > 0 ? -> process next vertex  */
196
197LLBL( G3TP3NRR_3 ):
198
199    FEMMS
200    POP_L     ( EDI )
201    POP_L     ( ESI )
202    RET
203
204
205
206
207ALIGNTEXT16
208GLOBL GLNAME( _mesa_3dnow_transform_points1_perspective )
209HIDDEN(_mesa_3dnow_transform_points1_perspective)
210GLNAME( _mesa_3dnow_transform_points1_perspective ):
211
212    PUSH_L    ( ESI )
213
214    MOV_L     ( ARG_DEST, ECX )
215    MOV_L     ( ARG_MATRIX, ESI )
216    MOV_L     ( ARG_SOURCE, EAX )
217    MOV_L     ( CONST(4), REGOFF(V4F_SIZE, ECX) )
218    OR_B      ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) )
219    MOV_L     ( REGOFF(V4F_COUNT, EAX), EDX )
220    MOV_L     ( EDX, REGOFF(V4F_COUNT, ECX) )
221
222    PUSH_L    ( EDI )
223
224    MOV_L     ( REGOFF(4, ECX), EDX )
225    MOV_L     ( ESI, ECX )
226    MOV_L     ( REGOFF(V4F_COUNT, EAX), ESI )
227    MOV_L     ( REGOFF(V4F_STRIDE, EAX), EDI )
228    MOV_L     ( REGOFF(V4F_START, EAX), EAX )
229
230    TEST_L    ( ESI, ESI )
231    JZ        ( LLBL( G3TPPR_3 ) )
232
233    MOVD      ( REGIND(ECX), MM0 )	/*                 | m00             */
234    MOVD      ( REGOFF(56, ECX), MM3 )	/*                 | m32             */
235
236ALIGNTEXT16
237LLBL( G3TPPR_2 ):
238
239    MOVD      ( REGIND(EAX), MM4 )	/* 0               | x0              */
240    PFMUL     ( MM0, MM4 )		/* 0               | x0*m00          */
241
242    MOVQ      ( MM4, REGIND(EDX) )	/* write r1, r0                      */
243    MOVQ      ( MM3, REGOFF(8, EDX) )	/* write r2  (=m32), r3 (=0)         */
244
245    ADD_L     ( EDI, EAX )		/* next vertex                       */
246    ADD_L     ( CONST(16), EDX )	/* next r                            */
247
248    DEC_L     ( ESI )			/* decrement vertex counter          */
249    JNZ       ( LLBL( G3TPPR_2 ) )	/* cnt > 0 ? -> process next vertex  */
250
251LLBL( G3TPPR_3 ):
252
253    FEMMS
254    POP_L     ( EDI )
255    POP_L     ( ESI )
256    RET
257
258
259
260
261ALIGNTEXT16
262GLOBL GLNAME( _mesa_3dnow_transform_points1_2d )
263HIDDEN(_mesa_3dnow_transform_points1_2d)
264GLNAME( _mesa_3dnow_transform_points1_2d ):
265
266    PUSH_L    ( ESI )
267
268    MOV_L     ( ARG_DEST, ECX )
269    MOV_L     ( ARG_MATRIX, ESI )
270    MOV_L     ( ARG_SOURCE, EAX )
271    MOV_L     ( CONST(2), REGOFF(V4F_SIZE, ECX) )
272    OR_B      ( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, ECX) )
273    MOV_L     ( REGOFF(V4F_COUNT, EAX), EDX )
274    MOV_L     ( EDX, REGOFF(V4F_COUNT, ECX) )
275
276    PUSH_L    ( EDI )
277
278    MOV_L     ( REGOFF(4, ECX), EDX )
279    MOV_L     ( ESI, ECX )
280    MOV_L     ( REGOFF(V4F_COUNT, EAX), ESI )
281    MOV_L     ( REGOFF(V4F_STRIDE, EAX), EDI )
282    MOV_L     ( REGOFF(V4F_START, EAX), EAX )
283
284    TEST_L    ( ESI, ESI )
285    JZ        ( LLBL( G3TP2R_3 ) )
286
287    MOVQ      ( REGIND(ECX), MM0 )	/* m01             | m00             */
288    MOVQ      ( REGOFF(48, ECX), MM2 )	/* m31             | m30             */
289
290ALIGNTEXT16
291LLBL( G3TP2R_2 ):
292
293    MOVD      ( REGIND(EAX), MM4 )	/*                 | x0              */
294    PUNPCKLDQ ( MM4, MM4 )		/* x0              | x0              */
295
296    PFMUL     ( MM0, MM4 )		/* x0*m01          | x0*m00          */
297    PFADD     ( MM2, MM4 )		/* x0*m01+m31      | x0*m00+m30      */
298
299    MOVQ      ( MM4, REGIND(EDX) )	/* write r1, r0                      */
300    ADD_L     ( EDI, EAX )		/* next vertex                       */
301
302    ADD_L     ( CONST(16), EDX )	/* next r                            */
303    DEC_L     ( ESI )			/* decrement vertex counter          */
304
305    JNZ       ( LLBL( G3TP2R_2 ) )	/* cnt > 0 ? -> process next vertex  */
306
307LLBL( G3TP2R_3 ):
308
309    FEMMS
310    POP_L     ( EDI )
311    POP_L     ( ESI )
312    RET
313
314
315
316
317ALIGNTEXT16
318GLOBL GLNAME( _mesa_3dnow_transform_points1_2d_no_rot )
319HIDDEN(_mesa_3dnow_transform_points1_2d_no_rot)
320GLNAME( _mesa_3dnow_transform_points1_2d_no_rot ):
321
322    PUSH_L    ( ESI )
323
324    MOV_L     ( ARG_DEST, ECX )
325    MOV_L     ( ARG_MATRIX, ESI )
326    MOV_L     ( ARG_SOURCE, EAX )
327    MOV_L     ( CONST(2), REGOFF(V4F_SIZE, ECX) )
328    OR_B      ( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, ECX) )
329    MOV_L     ( REGOFF(V4F_COUNT, EAX), EDX )
330    MOV_L     ( EDX, REGOFF(V4F_COUNT, ECX) )
331
332    PUSH_L    ( EDI )
333
334    MOV_L     ( REGOFF(4, ECX), EDX )
335    MOV_L     ( ESI, ECX )
336    MOV_L     ( REGOFF(V4F_COUNT, EAX), ESI )
337    MOV_L     ( REGOFF(V4F_STRIDE, EAX), EDI )
338    MOV_L     ( REGOFF(V4F_START, EAX), EAX )
339
340    TEST_L    ( ESI, ESI )
341    JZ        ( LLBL( G3TP2NRR_3 ) )
342
343    MOVD      ( REGIND(ECX), MM0 )	/*                 | m00             */
344    MOVQ      ( REGOFF(48, ECX), MM2 )	/* m31             | m30             */
345
346ALIGNTEXT16
347LLBL( G3TP2NRR_2 ):
348
349    MOVD      ( REGIND(EAX), MM4 )	/*                 | x0              */
350    ADD_L     ( EDI, EAX )		/* next vertex                       */
351
352    PFMUL     ( MM0, MM4 )		/*                 | x0*m00          */
353    PFADD     ( MM2, MM4 )		/* m31             | x0*m00+m30      */
354
355    MOVQ      ( MM4, REGIND(EDX) )	/* write r1, r0                      */
356    ADD_L     ( CONST(16), EDX )	/* next r                            */
357
358    DEC_L     ( ESI )			/* decrement vertex counter          */
359    JNZ       ( LLBL( G3TP2NRR_2 ) )	/* cnt > 0 ? -> process next vertex  */
360
361LLBL( G3TP2NRR_3 ):
362
363    FEMMS
364    POP_L     ( EDI )
365    POP_L     ( ESI )
366    RET
367
368
369
370
371ALIGNTEXT16
372GLOBL GLNAME( _mesa_3dnow_transform_points1_3d )
373HIDDEN(_mesa_3dnow_transform_points1_3d)
374GLNAME( _mesa_3dnow_transform_points1_3d ):
375
376    PUSH_L    ( ESI )
377
378    MOV_L     ( ARG_DEST, ECX )
379    MOV_L     ( ARG_MATRIX, ESI )
380    MOV_L     ( ARG_SOURCE, EAX )
381    MOV_L     ( CONST(3), REGOFF(V4F_SIZE, ECX) )
382    OR_B      ( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, ECX) )
383    MOV_L     ( REGOFF(V4F_COUNT, EAX), EDX )
384    MOV_L     ( EDX, REGOFF(V4F_COUNT, ECX) )
385
386    PUSH_L    ( EDI )
387
388    MOV_L     ( REGOFF(4, ECX), EDX )
389    MOV_L     ( ESI, ECX )
390    MOV_L     ( REGOFF(V4F_COUNT, EAX), ESI )
391    MOV_L     ( REGOFF(V4F_STRIDE, EAX), EDI )
392    MOV_L     ( REGOFF(V4F_START, EAX), EAX )
393
394    TEST_L    ( ESI, ESI )
395    JZ        ( LLBL( G3TP3R_3 ) )
396
397    MOVQ      ( REGIND(ECX), MM0 )	/* m01             | m00             */
398    MOVD      ( REGOFF(8, ECX), MM1 )	/*                 | m02             */
399
400    MOVQ      ( REGOFF(48, ECX), MM2 )	/* m31             | m30             */
401    MOVD      ( REGOFF(56, ECX), MM3 )	/*                 | m32             */
402
403ALIGNTEXT16
404LLBL( G3TP3R_2 ):
405
406    MOVD      ( REGIND(EAX), MM4 )	/*                 | x0              */
407    PUNPCKLDQ ( MM4, MM4 )		/* x0              | x0              */
408
409    MOVQ      ( MM4, MM5 )		/*                 | x0              */
410    PFMUL     ( MM0, MM4 )		/* x0*m01          | x0*m00          */
411
412    PFMUL     ( MM1, MM5 )		/*                 | x0*m02          */
413    PFADD     ( MM2, MM4 )		/* x0*m01+m31      | x0*m00+m30      */
414
415    PFADD     ( MM3, MM5 )		/*                 | x0*m02+m32      */
416    MOVQ      ( MM4, REGIND(EDX) )	/* write r1, r0                      */
417
418    MOVD      ( MM5, REGOFF(8, EDX) )	/* write r2                          */
419    ADD_L     ( EDI, EAX )		/* next vertex                       */
420
421    ADD_L     ( CONST(16), EDX )	/* next r                            */
422    DEC_L     ( ESI )			/* decrement vertex counter          */
423
424    JNZ       ( LLBL( G3TP3R_2 ) )	/* cnt > 0 ? -> process next vertex  */
425
426LLBL( G3TP3R_3 ):
427
428    FEMMS
429    POP_L     ( EDI )
430    POP_L     ( ESI )
431    RET
432
433#endif
434
435#if defined (__ELF__) && defined (__linux__)
436	.section .note.GNU-stack,"",%progbits
437#endif
438