summaryrefslogtreecommitdiffstats
path: root/src/mesa/x86/3dnow.h
blob: 8f8161d5b3a1ec97bf42a4dd07787c9234ec7f8f (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
/* $Id: 3dnow.h,v 1.1.1.1 1999/08/19 00:55:42 jtg Exp $ */

/*
 * Mesa 3-D graphics library
 * Version:  3.1
 * 
 * Copyright (C) 1999  Brian Paul   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
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * 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 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 NONINFRINGEMENT.  IN NO EVENT SHALL
 * BRIAN PAUL 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.
 */


/*
 * 3DNow! optimizations contributed by
 * Holger Waechtler <holger@akaflieg.extern.tu-berlin.de>
 */


#ifndef _3dnow_h
#define _3dnow_h



#include "xform.h"


void gl_init_3dnow_asm_transforms (void);




#if 0
GLvector4f *gl_project_points( GLvector4f *proj_vec,
                               const GLvector4f *clip_vec )
{
   __asm__ (
   "   femms                                                              \n"
   "                                                                      \n"
   "   movq       (%0),     %%mm0      # x1             | x0              \n"
   "   movq       8(%0),    %%mm1      # oow            | x2              \n"
   "                                                                      \n"
   "1: movq       %%mm1,    %%mm2      # oow            | x2              \n"
   "   addl       %2,       %0         # next point                       \n"
   "                                                                      \n"
   "   punpckhdq  %%mm2,    %%mm2      # oow            | oow             \n"
   "   addl       $16,      %1         # next point                       \n"
   "                                                                      \n"
   "   pfrcp      %%mm2,    %%mm3      # 1/oow          | 1/oow           \n"
   "   decl       %3                                                      \n"
   "                                                                      \n"
   "   pfmul      %%mm3,    %%mm0      # x1/oow         | x0/oow          \n"
   "   movq       %%mm0,    -16(%1)    # write r0, r1                     \n"
   "                                                                      \n"
   "   pfmul      %%mm3,    %%mm1      # 1              | x2/oow          \n"
   "   movq       (%0),     %%mm0      # x1             | x0              \n"
   "                                                                      \n"
   "   movd       %%mm1,    8(%1)      # write r2                         \n"
   "   movd       %%mm3,    12(%1)     # write r3                         \n"
   "                                                                      \n"
   "   movq       8(%0),    %%mm1      # oow            | x2              \n"
   "   ja         1b                                                      \n"
   "                                                                      \n"
   "   femms                                                              \n"
   "                                                                        "
   ::"a" (clip_vec->start),
   "c" (proj_vec->start),
   "g" (clip_vec->stride),
   "d" (clip_vec->count)
   );

   proj_vec->flags |= VEC_SIZE_4;
   proj_vec->size = 3;
   proj_vec->count = clip_vec->count;
   return proj_vec;
}
#endif



#endif