x86-64.c revision 7117f1b4
17117f1b4Smrg/* $Id: x86-64.c,v 1.1.1.1 2008/07/29 05:10:26 mrg Exp $ */ 27117f1b4Smrg 37117f1b4Smrg/* 47117f1b4Smrg * Mesa 3-D graphics library 57117f1b4Smrg * Version: 6.3 67117f1b4Smrg * 77117f1b4Smrg * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. 87117f1b4Smrg * 97117f1b4Smrg * Permission is hereby granted, free of charge, to any person obtaining a 107117f1b4Smrg * copy of this software and associated documentation files (the "Software"), 117117f1b4Smrg * to deal in the Software without restriction, including without limitation 127117f1b4Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 137117f1b4Smrg * and/or sell copies of the Software, and to permit persons to whom the 147117f1b4Smrg * Software is furnished to do so, subject to the following conditions: 157117f1b4Smrg * 167117f1b4Smrg * The above copyright notice and this permission notice shall be included 177117f1b4Smrg * in all copies or substantial portions of the Software. 187117f1b4Smrg * 197117f1b4Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 207117f1b4Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 217117f1b4Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 227117f1b4Smrg * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 237117f1b4Smrg * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 247117f1b4Smrg * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 257117f1b4Smrg */ 267117f1b4Smrg 277117f1b4Smrg/* 287117f1b4Smrg * x86-64 optimizations shamelessy converted from x86/sse/3dnow assembly by 297117f1b4Smrg * Mikko Tiihonen 307117f1b4Smrg */ 317117f1b4Smrg 327117f1b4Smrg#ifdef USE_X86_64_ASM 337117f1b4Smrg 347117f1b4Smrg#include "glheader.h" 357117f1b4Smrg#include "context.h" 367117f1b4Smrg#include "math/m_xform.h" 377117f1b4Smrg#include "tnl/t_context.h" 387117f1b4Smrg#include "x86-64.h" 397117f1b4Smrg#include "../x86/common_x86_macros.h" 407117f1b4Smrg 417117f1b4Smrg#ifdef DEBUG 427117f1b4Smrg#include "math/m_debug.h" 437117f1b4Smrg#endif 447117f1b4Smrg 457117f1b4SmrgDECLARE_XFORM_GROUP( x86_64, 4 ) 467117f1b4Smrg 477117f1b4Smrg#else 487117f1b4Smrg/* just to silence warning below */ 497117f1b4Smrg#include "x86-64.h" 507117f1b4Smrg#endif 517117f1b4Smrg 527117f1b4Smrg/* 537117f1b4Smrgextern void _mesa_x86_64_transform_points4_general( XFORM_ARGS ); 547117f1b4Smrgextern void _mesa_x86_64_transform_points4_identity( XFORM_ARGS ); 557117f1b4Smrgextern void _mesa_x86_64_transform_points4_perspective( XFORM_ARGS ); 567117f1b4Smrgextern void _mesa_x86_64_transform_points4_3d( XFORM_ARGS ); 577117f1b4Smrgextern void _mesa_x86_64_transform_points4_3d_no_rot( XFORM_ARGS ); 587117f1b4Smrgextern void _mesa_x86_64_transform_points4_2d_no_rot( XFORM_ARGS ); 597117f1b4Smrgextern void _mesa_x86_64_transform_points4_2d( XFORM_ARGS ); 607117f1b4Smrg*/ 617117f1b4Smrg 627117f1b4Smrg#ifdef USE_X86_64_ASM 637117f1b4Smrgstatic void message( const char *msg ) 647117f1b4Smrg{ 657117f1b4Smrg GLboolean debug; 667117f1b4Smrg#ifdef DEBUG 677117f1b4Smrg debug = GL_TRUE; 687117f1b4Smrg#else 697117f1b4Smrg if ( _mesa_getenv( "MESA_DEBUG" ) ) { 707117f1b4Smrg debug = GL_TRUE; 717117f1b4Smrg } else { 727117f1b4Smrg debug = GL_FALSE; 737117f1b4Smrg } 747117f1b4Smrg#endif 757117f1b4Smrg if ( debug ) { 767117f1b4Smrg _mesa_debug( NULL, "%s", msg ); 777117f1b4Smrg } 787117f1b4Smrg} 797117f1b4Smrg#endif 807117f1b4Smrg 817117f1b4Smrg 827117f1b4Smrgvoid _mesa_init_all_x86_64_transform_asm(void) 837117f1b4Smrg{ 847117f1b4Smrg#ifdef USE_X86_64_ASM 857117f1b4Smrg 867117f1b4Smrg if ( _mesa_getenv( "MESA_NO_ASM" ) ) { 877117f1b4Smrg return; 887117f1b4Smrg } 897117f1b4Smrg 907117f1b4Smrg message("Initializing x86-64 optimizations\n"); 917117f1b4Smrg 927117f1b4Smrg ASSIGN_XFORM_GROUP( x86_64, 4 ); 937117f1b4Smrg 947117f1b4Smrg /* 957117f1b4Smrg _mesa_transform_tab[4][MATRIX_GENERAL] = 967117f1b4Smrg _mesa_x86_64_transform_points4_general; 977117f1b4Smrg _mesa_transform_tab[4][MATRIX_IDENTITY] = 987117f1b4Smrg _mesa_x86_64_transform_points4_identity; 997117f1b4Smrg _mesa_transform_tab[4][MATRIX_3D] = 1007117f1b4Smrg _mesa_x86_64_transform_points4_3d; 1017117f1b4Smrg _mesa_transform_tab[4][MATRIX_3D_NO_ROT] = 1027117f1b4Smrg _mesa_x86_64_transform_points4_3d_no_rot; 1037117f1b4Smrg _mesa_transform_tab[4][MATRIX_PERSPECTIVE] = 1047117f1b4Smrg _mesa_x86_64_transform_points4_perspective; 1057117f1b4Smrg _mesa_transform_tab[4][MATRIX_2D_NO_ROT] = 1067117f1b4Smrg _mesa_x86_64_transform_points4_2d_no_rot; 1077117f1b4Smrg _mesa_transform_tab[4][MATRIX_2D] = 1087117f1b4Smrg _mesa_x86_64_transform_points4_2d; 1097117f1b4Smrg */ 1107117f1b4Smrg 1117117f1b4Smrg#ifdef DEBUG_MATH 1127117f1b4Smrg _math_test_all_transform_functions("x86_64"); 1137117f1b4Smrg _math_test_all_cliptest_functions("x86_64"); 1147117f1b4Smrg _math_test_all_normal_transform_functions("x86_64"); 1157117f1b4Smrg#endif 1167117f1b4Smrg 1177117f1b4Smrg#endif 1187117f1b4Smrg} 119