From 1b2fef5c28a40cd001598071e25b876ad4fccdd1 Mon Sep 17 00:00:00 2001 From: Gareth Hughes Date: Thu, 29 Mar 2001 06:46:15 +0000 Subject: Consolidation of asm code in 3.5 --- src/mesa/math/m_debug_norm.c | 78 ++++++++++++---------------------------- src/mesa/math/m_debug_xform.c | 83 +++++++++++++++++-------------------------- 2 files changed, 55 insertions(+), 106 deletions(-) (limited to 'src/mesa/math') diff --git a/src/mesa/math/m_debug_norm.c b/src/mesa/math/m_debug_norm.c index a6f0cb76a7..45532475b3 100644 --- a/src/mesa/math/m_debug_norm.c +++ b/src/mesa/math/m_debug_norm.c @@ -1,4 +1,4 @@ -/* $Id: m_debug_norm.c,v 1.5 2001/03/12 00:48:41 gareth Exp $ */ +/* $Id: m_debug_norm.c,v 1.6 2001/03/29 06:46:27 gareth Exp $ */ /* * Mesa 3-D graphics library @@ -186,8 +186,7 @@ static void ref_norm_transform_normalize( const GLmatrix *mat, * Normal transformation tests */ -static int test_norm_function( normal_func func, int mtype, - int masked, long *cycles ) +static int test_norm_function( normal_func func, int mtype, long *cycles ) { GLvector3f source[1], dest[1], dest2[1], ref[1], ref2[1]; GLmatrix mat[1]; @@ -195,7 +194,6 @@ static int test_norm_function( normal_func func, int mtype, GLfloat d2[TEST_COUNT][3], r2[TEST_COUNT][3], length[TEST_COUNT]; GLfloat scale; GLfloat *m; - GLubyte mask[TEST_COUNT]; int i, j; #ifdef RUN_DEBUG_BENCHMARK int cycle_i; /* the counter for the benchmarks we run */ @@ -231,7 +229,6 @@ static int test_norm_function( normal_func func, int mtype, } for ( i = 0 ; i < TEST_COUNT ; i++ ) { - mask[i] = i % 2; /* mask every 2nd element */ ASSIGN_3V( d[i], 0.0, 0.0, 0.0 ); ASSIGN_3V( s[i], 0.0, 0.0, 0.0 ); ASSIGN_3V( d2[i], 0.0, 0.0, 0.0 ); @@ -278,31 +275,16 @@ static int test_norm_function( normal_func func, int mtype, } if ( mesa_profile ) { - if ( masked ) { - BEGIN_RACE( *cycles ); - func( mat, scale, source, NULL, mask, dest ); - END_RACE( *cycles ); - func( mat, scale, source, length, mask, dest2 ); - } else { - BEGIN_RACE( *cycles ); - func( mat, scale, source, NULL, NULL, dest ); - END_RACE( *cycles ); - func( mat, scale, source, length, NULL, dest2 ); - } + BEGIN_RACE( *cycles ); + func( mat, scale, source, NULL, NULL, dest ); + END_RACE( *cycles ); + func( mat, scale, source, length, NULL, dest2 ); } else { - if ( masked ) { - func( mat, scale, source, NULL, mask, dest ); - func( mat, scale, source, length, mask, dest2 ); - } else { - func( mat, scale, source, NULL, NULL, dest ); - func( mat, scale, source, length, NULL, dest2 ); - } + func( mat, scale, source, NULL, NULL, dest ); + func( mat, scale, source, length, NULL, dest2 ); } for ( i = 0 ; i < TEST_COUNT ; i++ ) { - if ( masked && !(mask[i] & 1) ) - continue; - for ( j = 0 ; j < 3 ; j++ ) { if ( significand_match( d[i][j], r[i][j] ) < REQUIRED_PRECISION ) { printf( "-----------------------------\n" ); @@ -344,7 +326,6 @@ static int test_norm_function( normal_func func, int mtype, void _math_test_all_normal_transform_functions( char *description ) { - int masked; int mtype; long benchmark_tab[0xf][0x4]; static int first_time = 1; @@ -362,46 +343,33 @@ void _math_test_all_normal_transform_functions( char *description ) } printf( "normal transform results after hooking in %s functions:\n", description ); + printf( "\n-------------------------------------------------------\n" ); } #endif - for ( masked = 0 ; masked <= 1 ; masked++ ) { - int cma = masked ? 1 : 0; - char *cmastring = masked ? "CULL_MASK_ACTIVE" : "0"; + for ( mtype = 0 ; mtype < 8 ; mtype++ ) { + normal_func func = _mesa_normal_tab[norm_types[mtype]][0]; + long *cycles = &(benchmark_tab[mtype][0]); -#ifdef RUN_DEBUG_BENCHMARK - if ( mesa_profile ) { - printf( "\n culling: %s \n", masked ? "CULL_MASK_ACTIVE" : "0" ); - printf( "\n-------------------------------------------------------\n" ); + if ( test_norm_function( func, mtype, cycles ) == 0 ) { + char buf[100]; + sprintf( buf, "_mesa_normal_tab[0][%s] failed test (%s)", + norm_strings[mtype], description ); + _mesa_problem( NULL, buf ); } -#endif - - for ( mtype = 0 ; mtype < 8 ; mtype++ ) { - normal_func func = _mesa_normal_tab[norm_types[mtype]][cma]; - long *cycles = &(benchmark_tab[mtype][cma]); - - if ( test_norm_function( func, mtype, masked, cycles ) == 0 ) { - char buf[100]; - sprintf( buf, "_mesa_normal_tab[%s][%s] failed test (%s)", - cmastring, norm_strings[mtype], description ); - _mesa_problem( NULL, buf ); - } #ifdef RUN_DEBUG_BENCHMARK - if ( mesa_profile ) { - printf( " %li\t", benchmark_tab[mtype][cma] ); - printf( " | [%s]\n", norm_strings[mtype] ); - } - } - if ( mesa_profile ) - printf( "\n" ); -#else + if ( mesa_profile ) { + printf( " %li\t", benchmark_tab[mtype][0] ); + printf( " | [%s]\n", norm_strings[mtype] ); } #endif } #ifdef RUN_DEBUG_BENCHMARK - if ( mesa_profile ) + if ( mesa_profile ) { + printf( "\n" ); fflush( stdout ); + } #endif } diff --git a/src/mesa/math/m_debug_xform.c b/src/mesa/math/m_debug_xform.c index 9636fc439d..6e19adea38 100644 --- a/src/mesa/math/m_debug_xform.c +++ b/src/mesa/math/m_debug_xform.c @@ -1,4 +1,4 @@ -/* $Id: m_debug_xform.c,v 1.6 2001/03/12 02:02:36 gareth Exp $ */ +/* $Id: m_debug_xform.c,v 1.7 2001/03/29 06:46:27 gareth Exp $ */ /* * Mesa 3-D graphics library @@ -159,8 +159,8 @@ static GLfloat s[TEST_COUNT][4] ALIGN16; static GLfloat d[TEST_COUNT][4] ALIGN16; static GLfloat r[TEST_COUNT][4] ALIGN16; -static int test_transform_function( transform_func func, int psize, int mtype, - int masked, long *cycles ) +static int test_transform_function( transform_func func, int psize, + int mtype, long *cycles ) { GLvector4f source[1], dest[1], ref[1]; GLmatrix mat[1]; @@ -238,28 +238,15 @@ static int test_transform_function( transform_func func, int psize, int mtype, ref_transform( ref, mat, source, NULL, 0 ); if ( mesa_profile ) { - if ( masked ) { - BEGIN_RACE( *cycles ); - func( dest, mat->m, source, mask, 1 ); - END_RACE( *cycles ); - } else { - BEGIN_RACE( *cycles ); - func( dest, mat->m, source, NULL, 0 ); - END_RACE( *cycles ); - } + BEGIN_RACE( *cycles ); + func( dest, mat->m, source, NULL, 0 ); + END_RACE( *cycles ); } else { - if ( masked ) { - func( dest, mat->m, source, mask, 1 ); - } else { - func( dest, mat->m, source, NULL, 0 ); - } + func( dest, mat->m, source, NULL, 0 ); } for ( i = 0 ; i < TEST_COUNT ; i++ ) { - if ( masked && (mask[i] & 1) ) - continue; - for ( j = 0 ; j < 4 ; j++ ) { if ( significand_match( d[i][j], r[i][j] ) < REQUIRED_PRECISION ) { printf( "-----------------------------\n" ); @@ -287,7 +274,7 @@ static int test_transform_function( transform_func func, int psize, int mtype, void _math_test_all_transform_functions( char *description ) { - int masked, psize, mtype; + int psize, mtype; long benchmark_tab[2][4][7]; static int first_time = 1; @@ -306,47 +293,41 @@ void _math_test_all_transform_functions( char *description ) } #endif - for ( masked = 0 ; masked <= 1 ; masked++ ) { - int cma = masked ? 1 : 0; - char *cmastring = masked ? "CULL_MASK_ACTIVE" : "0"; - #ifdef RUN_DEBUG_BENCHMARK - if ( mesa_profile ) { - printf( "\n culling: %s \n", masked ? "CULL_MASK_ACTIVE" : "0" ); - for ( psize = 1 ; psize <= 4 ; psize++ ) { - printf( " p%d\t", psize ); - } - printf( "\n--------------------------------------------------------\n" ); + if ( mesa_profile ) { + printf( "\n" ); + for ( psize = 1 ; psize <= 4 ; psize++ ) { + printf( " p%d\t", psize ); } + printf( "\n--------------------------------------------------------\n" ); + } #endif - for ( mtype = 0 ; mtype < 7 ; mtype++ ) { - for ( psize = 1 ; psize <= 4 ; psize++ ) { - transform_func func = _mesa_transform_tab[cma][psize][mtypes[mtype]]; - long *cycles = &(benchmark_tab[cma][psize-1][mtype]); - - if ( test_transform_function( func, psize, mtype, - masked, cycles ) == 0 ) { - char buf[100]; - sprintf( buf, "_mesa_transform_tab[%s][%d][%s] failed test (%s)", - cmastring, psize, mstrings[mtype], description ); - _mesa_problem( NULL, buf ); - } + for ( mtype = 0 ; mtype < 7 ; mtype++ ) { + for ( psize = 1 ; psize <= 4 ; psize++ ) { + transform_func func = _mesa_transform_tab[0][psize][mtypes[mtype]]; + long *cycles = &(benchmark_tab[0][psize-1][mtype]); + + if ( test_transform_function( func, psize, mtype, cycles ) == 0 ) { + char buf[100]; + sprintf( buf, "_mesa_transform_tab[0][%d][%s] failed test (%s)", + psize, mstrings[mtype], description ); + _mesa_problem( NULL, buf ); + } #ifdef RUN_DEBUG_BENCHMARK - if ( mesa_profile ) - printf( " %li\t", benchmark_tab[cma][psize-1][mtype] ); -#endif - } -#ifdef RUN_DEBUG_BENCHMARK - if ( mesa_profile ) - printf( " | [%s]\n", mstrings[mtype] ); + if ( mesa_profile ) + printf( " %li\t", benchmark_tab[0][psize-1][mtype] ); #endif } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) - printf( "\n" ); + printf( " | [%s]\n", mstrings[mtype] ); #endif } +#ifdef RUN_DEBUG_BENCHMARK + if ( mesa_profile ) + printf( "\n" ); +#endif } -- cgit v1.2.3