3 * Mesa 3-D graphics library
6 * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
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:
15 * The above copyright notice and this permission notice shall be included
16 * in all copies or substantial portions of the Software.
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 * THE AUTHORS OR COPYRIGHT HOLDERS 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.
29 #include "xform_args.h"
33 #define FRAME_OFFSET 4
37 GLOBL GLNAME( _mesa_3dnow_transform_points1_general )
38 HIDDEN(_mesa_3dnow_transform_points1_general)
39 GLNAME( _mesa_3dnow_transform_points1_general ):
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) )
53 MOV_L ( REGOFF(4, ECX), EDX )
55 MOV_L ( REGOFF(V4F_COUNT, EAX), ESI )
56 MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI )
57 MOV_L ( REGOFF(V4F_START, EAX), EAX )
60 JZ ( LLBL( G3TPGR_3 ) )
62 MOVQ ( REGIND(ECX), MM0 ) /* m01 | m00 */
63 MOVQ ( REGOFF(8, ECX), MM1 ) /* m03 | m02 */
65 MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */
66 MOVQ ( REGOFF(56, ECX), MM3 ) /* m33 | m32 */
71 MOVD ( REGIND(EAX), MM4 ) /* | x0 */
72 PUNPCKLDQ ( MM4, MM4 ) /* x0 | x0 */
74 MOVQ ( MM4, MM5 ) /* x0 | x0 */
75 PFMUL ( MM0, MM4 ) /* x0*m01 | x0*m00 */
77 PFMUL ( MM1, MM5 ) /* x0*m03 | x0*m02 */
78 PFADD ( MM2, MM4 ) /* x0*m01+m31 | x0*m00+m30 */
80 PFADD ( MM3, MM5 ) /* x0*m03+m33 | x0*m02+m32 */
81 MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */
83 MOVQ ( MM5, REGOFF(8, EDX) ) /* write r3, r2 */
84 ADD_L ( EDI, EAX ) /* next vertex */
86 ADD_L ( CONST(16), EDX ) /* next r */
87 DEC_L ( ESI ) /* decrement vertex counter */
89 JNZ ( LLBL( G3TPGR_2 ) ) /* cnt > 0 ? -> process next vertex */
102 GLOBL GLNAME( _mesa_3dnow_transform_points1_identity )
103 HIDDEN(_mesa_3dnow_transform_points1_identity)
104 GLNAME( _mesa_3dnow_transform_points1_identity ):
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) )
118 MOV_L ( REGOFF(4, ECX), EDX )
120 MOV_L ( REGOFF(V4F_COUNT, EAX), ESI )
121 MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI )
122 MOV_L ( REGOFF(V4F_START, EAX), EAX )
125 JZ ( LLBL( G3TPIR_4) )
130 MOVD ( REGIND(EAX), MM0 ) /* | x0 */
131 ADD_L ( EDI, EAX ) /* next vertex */
133 MOVD ( MM0, REGIND(EDX) ) /* | r0 */
134 ADD_L ( CONST(16), EDX ) /* next r */
136 DEC_L ( ESI ) /* decrement vertex counter */
137 JNZ ( LLBL( G3TPIR_3 ) ) /* cnt > 0 ? -> process next vertex */
150 GLOBL GLNAME( _mesa_3dnow_transform_points1_3d_no_rot )
151 HIDDEN(_mesa_3dnow_transform_points1_3d_no_rot)
152 GLNAME( _mesa_3dnow_transform_points1_3d_no_rot ):
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) )
166 MOV_L ( REGOFF(4, ECX), EDX )
168 MOV_L ( REGOFF(V4F_COUNT, EAX), ESI )
169 MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI )
170 MOV_L ( REGOFF(V4F_START, EAX), EAX )
173 JZ ( LLBL( G3TP3NRR_3 ) )
175 MOVD ( REGIND(ECX), MM0 ) /* | m00 */
176 MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */
178 MOVD ( REGOFF(56, ECX), MM3 ) /* | m32 */
183 MOVD ( REGIND(EAX), MM4 ) /* | x0 */
184 PFMUL ( MM0, MM4 ) /* | x0*m00 */
186 PFADD ( MM2, MM4 ) /* m31 | x0*m00+m30 */
187 MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */
189 MOVD ( MM3, REGOFF(8, EDX) ) /* write r2 */
190 ADD_L ( EDI, EAX ) /* next vertex */
192 ADD_L ( CONST(16), EDX ) /* next r */
193 DEC_L ( ESI ) /* decrement vertex counter */
195 JNZ ( LLBL( G3TP3NRR_2 ) ) /* cnt > 0 ? -> process next vertex */
208 GLOBL GLNAME( _mesa_3dnow_transform_points1_perspective )
209 HIDDEN(_mesa_3dnow_transform_points1_perspective)
210 GLNAME( _mesa_3dnow_transform_points1_perspective ):
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) )
224 MOV_L ( REGOFF(4, ECX), EDX )
226 MOV_L ( REGOFF(V4F_COUNT, EAX), ESI )
227 MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI )
228 MOV_L ( REGOFF(V4F_START, EAX), EAX )
231 JZ ( LLBL( G3TPPR_3 ) )
233 MOVD ( REGIND(ECX), MM0 ) /* | m00 */
234 MOVD ( REGOFF(56, ECX), MM3 ) /* | m32 */
239 MOVD ( REGIND(EAX), MM4 ) /* 0 | x0 */
240 PFMUL ( MM0, MM4 ) /* 0 | x0*m00 */
242 MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */
243 MOVQ ( MM3, REGOFF(8, EDX) ) /* write r2 (=m32), r3 (=0) */
245 ADD_L ( EDI, EAX ) /* next vertex */
246 ADD_L ( CONST(16), EDX ) /* next r */
248 DEC_L ( ESI ) /* decrement vertex counter */
249 JNZ ( LLBL( G3TPPR_2 ) ) /* cnt > 0 ? -> process next vertex */
262 GLOBL GLNAME( _mesa_3dnow_transform_points1_2d )
263 HIDDEN(_mesa_3dnow_transform_points1_2d)
264 GLNAME( _mesa_3dnow_transform_points1_2d ):
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) )
278 MOV_L ( REGOFF(4, ECX), EDX )
280 MOV_L ( REGOFF(V4F_COUNT, EAX), ESI )
281 MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI )
282 MOV_L ( REGOFF(V4F_START, EAX), EAX )
285 JZ ( LLBL( G3TP2R_3 ) )
287 MOVQ ( REGIND(ECX), MM0 ) /* m01 | m00 */
288 MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */
293 MOVD ( REGIND(EAX), MM4 ) /* | x0 */
294 PUNPCKLDQ ( MM4, MM4 ) /* x0 | x0 */
296 PFMUL ( MM0, MM4 ) /* x0*m01 | x0*m00 */
297 PFADD ( MM2, MM4 ) /* x0*m01+m31 | x0*m00+m30 */
299 MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */
300 ADD_L ( EDI, EAX ) /* next vertex */
302 ADD_L ( CONST(16), EDX ) /* next r */
303 DEC_L ( ESI ) /* decrement vertex counter */
305 JNZ ( LLBL( G3TP2R_2 ) ) /* cnt > 0 ? -> process next vertex */
318 GLOBL GLNAME( _mesa_3dnow_transform_points1_2d_no_rot )
319 HIDDEN(_mesa_3dnow_transform_points1_2d_no_rot)
320 GLNAME( _mesa_3dnow_transform_points1_2d_no_rot ):
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) )
334 MOV_L ( REGOFF(4, ECX), EDX )
336 MOV_L ( REGOFF(V4F_COUNT, EAX), ESI )
337 MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI )
338 MOV_L ( REGOFF(V4F_START, EAX), EAX )
341 JZ ( LLBL( G3TP2NRR_3 ) )
343 MOVD ( REGIND(ECX), MM0 ) /* | m00 */
344 MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */
349 MOVD ( REGIND(EAX), MM4 ) /* | x0 */
350 ADD_L ( EDI, EAX ) /* next vertex */
352 PFMUL ( MM0, MM4 ) /* | x0*m00 */
353 PFADD ( MM2, MM4 ) /* m31 | x0*m00+m30 */
355 MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */
356 ADD_L ( CONST(16), EDX ) /* next r */
358 DEC_L ( ESI ) /* decrement vertex counter */
359 JNZ ( LLBL( G3TP2NRR_2 ) ) /* cnt > 0 ? -> process next vertex */
372 GLOBL GLNAME( _mesa_3dnow_transform_points1_3d )
373 HIDDEN(_mesa_3dnow_transform_points1_3d)
374 GLNAME( _mesa_3dnow_transform_points1_3d ):
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) )
388 MOV_L ( REGOFF(4, ECX), EDX )
390 MOV_L ( REGOFF(V4F_COUNT, EAX), ESI )
391 MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI )
392 MOV_L ( REGOFF(V4F_START, EAX), EAX )
395 JZ ( LLBL( G3TP3R_3 ) )
397 MOVQ ( REGIND(ECX), MM0 ) /* m01 | m00 */
398 MOVD ( REGOFF(8, ECX), MM1 ) /* | m02 */
400 MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */
401 MOVD ( REGOFF(56, ECX), MM3 ) /* | m32 */
406 MOVD ( REGIND(EAX), MM4 ) /* | x0 */
407 PUNPCKLDQ ( MM4, MM4 ) /* x0 | x0 */
409 MOVQ ( MM4, MM5 ) /* | x0 */
410 PFMUL ( MM0, MM4 ) /* x0*m01 | x0*m00 */
412 PFMUL ( MM1, MM5 ) /* | x0*m02 */
413 PFADD ( MM2, MM4 ) /* x0*m01+m31 | x0*m00+m30 */
415 PFADD ( MM3, MM5 ) /* | x0*m02+m32 */
416 MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */
418 MOVD ( MM5, REGOFF(8, EDX) ) /* write r2 */
419 ADD_L ( EDI, EAX ) /* next vertex */
421 ADD_L ( CONST(16), EDX ) /* next r */
422 DEC_L ( ESI ) /* decrement vertex counter */
424 JNZ ( LLBL( G3TP3R_2 ) ) /* cnt > 0 ? -> process next vertex */
435 #if defined (__ELF__) && defined (__linux__)
436 .section .note.GNU-stack,"",%progbits