Subversion Repositories shark

Rev

Rev 56 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
56 pj 1
/* $XFree86$ */
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
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
/*
30
 * Authors:
31
 *   Keith Whitwell <keith@tungstengraphics.com>
32
 */
33
 
34
#include "imports.h" 
35
#include "simple_list.h" 
36
#include "t_vtx_api.h"
37
 
38
#if defined(USE_SSE_ASM)
39
 
40
/* Build specialized versions of the immediate calls on the fly for
41
 * the current state.  ???P4 SSE2 versions???
42
 */
43
 
44
 
45
static struct dynfn *makeSSENormal3fv( struct _vb *vb, int key )
46
{
47
   /* Requires P4 (sse2?)
48
    */
49
   static unsigned char temp[] = {
50
      0x8b, 0x44, 0x24, 0x04,           /*  mov    0x4(%esp,1),%eax */
51
      0xba, 0x78, 0x56, 0x34, 0x12,     /*  mov    $0x12345678,%edx */
52
      0xf3, 0x0f, 0x7e, 0x00,           /*  movq   (%eax),%xmm0 */
53
      0x66, 0x0f, 0x6e, 0x48, 0x08,     /*  movd   0x8(%eax),%xmm1 */
54
      0x66, 0x0f, 0xd6, 0x42, 0x0c,     /*  movq   %xmm0,0xc(%edx) */
55
      0x66, 0x0f, 0x7e, 0x4a, 0x14,     /*  movd   %xmm1,0x14(%edx) */
56
      0xc3,                             /*  ret     */
57
   };
58
 
59
 
60
   struct dynfn *dfn = MALLOC_STRUCT( dynfn );
61
   insert_at_head( &vb->dfn_cache.Normal3fv, dfn );
62
   dfn->key = key;
63
 
64
   dfn->code = ALIGN_MALLOC( sizeof(temp), 16 );
65
   memcpy (dfn->code, temp, sizeof(temp));
66
   FIXUP(dfn->code, 5, 0x0, (int)vb->normalptr);
67
   return dfn;
68
}
69
 
70
void _tnl_InitSSECodegen( struct dfn_generators *gen )
71
{
72
   /* Need to:
73
    *    - check kernel sse support
74
    *    - check p4/sse2
75
    */
76
   (void) makeSSENormal3fv;
77
}
78
 
79
 
80
#else 
81
 
82
void _tnl_InitSSECodegen( struct dfn_generators *gen )
83
{
84
   (void) gen;
85
}
86
 
87
#endif
88
 
89
 
90
 
91