| 1 | /* $Id: 3dnow.h,v 1.1 2000-02-29 00:48:23 sandervl Exp $ */ | 
|---|
| 2 |  | 
|---|
| 3 | /* | 
|---|
| 4 | * Mesa 3-D graphics library | 
|---|
| 5 | * Version:  3.1 | 
|---|
| 6 | * | 
|---|
| 7 | * Copyright (C) 1999  Brian Paul   All Rights Reserved. | 
|---|
| 8 | * | 
|---|
| 9 | * Permission is hereby granted, free of charge, to any person obtaining a | 
|---|
| 10 | * copy of this software and associated documentation files (the "Software"), | 
|---|
| 11 | * to deal in the Software without restriction, including without limitation | 
|---|
| 12 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | 
|---|
| 13 | * and/or sell copies of the Software, and to permit persons to whom the | 
|---|
| 14 | * Software is furnished to do so, subject to the following conditions: | 
|---|
| 15 | * | 
|---|
| 16 | * The above copyright notice and this permission notice shall be included | 
|---|
| 17 | * in all copies or substantial portions of the Software. | 
|---|
| 18 | * | 
|---|
| 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | 
|---|
| 20 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 
|---|
| 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL | 
|---|
| 22 | * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN | 
|---|
| 23 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | 
|---|
| 24 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 
|---|
| 25 | */ | 
|---|
| 26 |  | 
|---|
| 27 |  | 
|---|
| 28 | /* | 
|---|
| 29 | * 3DNow! optimizations contributed by | 
|---|
| 30 | * Holger Waechtler <holger@akaflieg.extern.tu-berlin.de> | 
|---|
| 31 | */ | 
|---|
| 32 |  | 
|---|
| 33 |  | 
|---|
| 34 | #ifndef _3dnow_h | 
|---|
| 35 | #define _3dnow_h | 
|---|
| 36 |  | 
|---|
| 37 |  | 
|---|
| 38 |  | 
|---|
| 39 | #include "xform.h" | 
|---|
| 40 |  | 
|---|
| 41 |  | 
|---|
| 42 | void gl_init_3dnow_asm_transforms (void); | 
|---|
| 43 |  | 
|---|
| 44 |  | 
|---|
| 45 |  | 
|---|
| 46 |  | 
|---|
| 47 | #if 0 | 
|---|
| 48 | GLvector4f *gl_project_points( GLvector4f *proj_vec, | 
|---|
| 49 | const GLvector4f *clip_vec ) | 
|---|
| 50 | { | 
|---|
| 51 | __asm__ ( | 
|---|
| 52 | "   femms                                                              \n" | 
|---|
| 53 | "                                                                      \n" | 
|---|
| 54 | "   movq       (%0),     %%mm0      # x1             | x0              \n" | 
|---|
| 55 | "   movq       8(%0),    %%mm1      # oow            | x2              \n" | 
|---|
| 56 | "                                                                      \n" | 
|---|
| 57 | "1: movq       %%mm1,    %%mm2      # oow            | x2              \n" | 
|---|
| 58 | "   addl       %2,       %0         # next point                       \n" | 
|---|
| 59 | "                                                                      \n" | 
|---|
| 60 | "   punpckhdq  %%mm2,    %%mm2      # oow            | oow             \n" | 
|---|
| 61 | "   addl       $16,      %1         # next point                       \n" | 
|---|
| 62 | "                                                                      \n" | 
|---|
| 63 | "   pfrcp      %%mm2,    %%mm3      # 1/oow          | 1/oow           \n" | 
|---|
| 64 | "   decl       %3                                                      \n" | 
|---|
| 65 | "                                                                      \n" | 
|---|
| 66 | "   pfmul      %%mm3,    %%mm0      # x1/oow         | x0/oow          \n" | 
|---|
| 67 | "   movq       %%mm0,    -16(%1)    # write r0, r1                     \n" | 
|---|
| 68 | "                                                                      \n" | 
|---|
| 69 | "   pfmul      %%mm3,    %%mm1      # 1              | x2/oow          \n" | 
|---|
| 70 | "   movq       (%0),     %%mm0      # x1             | x0              \n" | 
|---|
| 71 | "                                                                      \n" | 
|---|
| 72 | "   movd       %%mm1,    8(%1)      # write r2                         \n" | 
|---|
| 73 | "   movd       %%mm3,    12(%1)     # write r3                         \n" | 
|---|
| 74 | "                                                                      \n" | 
|---|
| 75 | "   movq       8(%0),    %%mm1      # oow            | x2              \n" | 
|---|
| 76 | "   ja         1b                                                      \n" | 
|---|
| 77 | "                                                                      \n" | 
|---|
| 78 | "   femms                                                              \n" | 
|---|
| 79 | "                                                                        " | 
|---|
| 80 | ::"a" (clip_vec->start), | 
|---|
| 81 | "c" (proj_vec->start), | 
|---|
| 82 | "g" (clip_vec->stride), | 
|---|
| 83 | "d" (clip_vec->count) | 
|---|
| 84 | ); | 
|---|
| 85 |  | 
|---|
| 86 | proj_vec->flags |= VEC_SIZE_4; | 
|---|
| 87 | proj_vec->size = 3; | 
|---|
| 88 | proj_vec->count = clip_vec->count; | 
|---|
| 89 | return proj_vec; | 
|---|
| 90 | } | 
|---|
| 91 | #endif | 
|---|
| 92 |  | 
|---|
| 93 |  | 
|---|
| 94 |  | 
|---|
| 95 | #endif | 
|---|