x86-64.c revision 7117f1b4
1/* $Id: x86-64.c,v 1.1.1.1 2008/07/29 05:10:26 mrg Exp $ */ 2 3/* 4 * Mesa 3-D graphics library 5 * Version: 6.3 6 * 7 * Copyright (C) 1999-2003 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 * x86-64 optimizations shamelessy converted from x86/sse/3dnow assembly by 29 * Mikko Tiihonen 30 */ 31 32#ifdef USE_X86_64_ASM 33 34#include "glheader.h" 35#include "context.h" 36#include "math/m_xform.h" 37#include "tnl/t_context.h" 38#include "x86-64.h" 39#include "../x86/common_x86_macros.h" 40 41#ifdef DEBUG 42#include "math/m_debug.h" 43#endif 44 45DECLARE_XFORM_GROUP( x86_64, 4 ) 46 47#else 48/* just to silence warning below */ 49#include "x86-64.h" 50#endif 51 52/* 53extern void _mesa_x86_64_transform_points4_general( XFORM_ARGS ); 54extern void _mesa_x86_64_transform_points4_identity( XFORM_ARGS ); 55extern void _mesa_x86_64_transform_points4_perspective( XFORM_ARGS ); 56extern void _mesa_x86_64_transform_points4_3d( XFORM_ARGS ); 57extern void _mesa_x86_64_transform_points4_3d_no_rot( XFORM_ARGS ); 58extern void _mesa_x86_64_transform_points4_2d_no_rot( XFORM_ARGS ); 59extern void _mesa_x86_64_transform_points4_2d( XFORM_ARGS ); 60*/ 61 62#ifdef USE_X86_64_ASM 63static void message( const char *msg ) 64{ 65 GLboolean debug; 66#ifdef DEBUG 67 debug = GL_TRUE; 68#else 69 if ( _mesa_getenv( "MESA_DEBUG" ) ) { 70 debug = GL_TRUE; 71 } else { 72 debug = GL_FALSE; 73 } 74#endif 75 if ( debug ) { 76 _mesa_debug( NULL, "%s", msg ); 77 } 78} 79#endif 80 81 82void _mesa_init_all_x86_64_transform_asm(void) 83{ 84#ifdef USE_X86_64_ASM 85 86 if ( _mesa_getenv( "MESA_NO_ASM" ) ) { 87 return; 88 } 89 90 message("Initializing x86-64 optimizations\n"); 91 92 ASSIGN_XFORM_GROUP( x86_64, 4 ); 93 94 /* 95 _mesa_transform_tab[4][MATRIX_GENERAL] = 96 _mesa_x86_64_transform_points4_general; 97 _mesa_transform_tab[4][MATRIX_IDENTITY] = 98 _mesa_x86_64_transform_points4_identity; 99 _mesa_transform_tab[4][MATRIX_3D] = 100 _mesa_x86_64_transform_points4_3d; 101 _mesa_transform_tab[4][MATRIX_3D_NO_ROT] = 102 _mesa_x86_64_transform_points4_3d_no_rot; 103 _mesa_transform_tab[4][MATRIX_PERSPECTIVE] = 104 _mesa_x86_64_transform_points4_perspective; 105 _mesa_transform_tab[4][MATRIX_2D_NO_ROT] = 106 _mesa_x86_64_transform_points4_2d_no_rot; 107 _mesa_transform_tab[4][MATRIX_2D] = 108 _mesa_x86_64_transform_points4_2d; 109 */ 110 111#ifdef DEBUG_MATH 112 _math_test_all_transform_functions("x86_64"); 113 _math_test_all_cliptest_functions("x86_64"); 114 _math_test_all_normal_transform_functions("x86_64"); 115#endif 116 117#endif 118} 119