summaryrefslogtreecommitdiff
path: root/src/mesa/x86-64/x86-64.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/x86-64/x86-64.c')
-rw-r--r--src/mesa/x86-64/x86-64.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/src/mesa/x86-64/x86-64.c b/src/mesa/x86-64/x86-64.c
index 9ec43c841d..96f8da87f0 100644
--- a/src/mesa/x86-64/x86-64.c
+++ b/src/mesa/x86-64/x86-64.c
@@ -41,7 +41,10 @@
#include "math/m_debug.h"
#endif
+extern void _mesa_x86_64_cpuid(unsigned int *regs);
+
DECLARE_XFORM_GROUP( x86_64, 4 )
+DECLARE_XFORM_GROUP( 3dnow, 4 )
#else
/* just to silence warning below */
@@ -81,6 +84,7 @@ static void message( const char *msg )
void _mesa_init_all_x86_64_transform_asm(void)
{
#ifdef USE_X86_64_ASM
+ unsigned int regs[4];
if ( _mesa_getenv( "MESA_NO_ASM" ) ) {
return;
@@ -88,24 +92,32 @@ void _mesa_init_all_x86_64_transform_asm(void)
message("Initializing x86-64 optimizations\n");
- ASSIGN_XFORM_GROUP( x86_64, 4 );
- /*
_mesa_transform_tab[4][MATRIX_GENERAL] =
_mesa_x86_64_transform_points4_general;
_mesa_transform_tab[4][MATRIX_IDENTITY] =
_mesa_x86_64_transform_points4_identity;
_mesa_transform_tab[4][MATRIX_3D] =
_mesa_x86_64_transform_points4_3d;
- _mesa_transform_tab[4][MATRIX_3D_NO_ROT] =
- _mesa_x86_64_transform_points4_3d_no_rot;
- _mesa_transform_tab[4][MATRIX_PERSPECTIVE] =
- _mesa_x86_64_transform_points4_perspective;
- _mesa_transform_tab[4][MATRIX_2D_NO_ROT] =
- _mesa_x86_64_transform_points4_2d_no_rot;
- _mesa_transform_tab[4][MATRIX_2D] =
- _mesa_x86_64_transform_points4_2d;
- */
+
+ regs[0] = 0x80000001;
+ regs[1] = 0x00000000;
+ regs[2] = 0x00000000;
+ regs[3] = 0x00000000;
+ _mesa_x86_64_cpuid(regs);
+ if (regs[3] & (1U << 31)) {
+ message("3Dnow! detected\n");
+ _mesa_transform_tab[4][MATRIX_3D_NO_ROT] =
+ _mesa_3dnow_transform_points4_3d_no_rot;
+ _mesa_transform_tab[4][MATRIX_PERSPECTIVE] =
+ _mesa_3dnow_transform_points4_perspective;
+ _mesa_transform_tab[4][MATRIX_2D_NO_ROT] =
+ _mesa_3dnow_transform_points4_2d_no_rot;
+ _mesa_transform_tab[4][MATRIX_2D] =
+ _mesa_3dnow_transform_points4_2d;
+
+ }
+
#ifdef DEBUG_MATH
_math_test_all_transform_functions("x86_64");