summaryrefslogtreecommitdiff
path: root/src/mesa/math
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2001-05-23 14:27:03 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2001-05-23 14:27:03 +0000
commit7943b349d696f8030f0d2f836ad42a762f4c6026 (patch)
treef6ff639bac006d8d755f06ce5e937571e255c508 /src/mesa/math
parent8bd06931018d5662b92f1cfeee2abaf352d0044c (diff)
SPARC assembly optimizations from David Miller.
Diffstat (limited to 'src/mesa/math')
-rw-r--r--src/mesa/math/m_debug_util.h32
-rw-r--r--src/mesa/math/m_xform.c9
2 files changed, 38 insertions, 3 deletions
diff --git a/src/mesa/math/m_debug_util.h b/src/mesa/math/m_debug_util.h
index dc8024a1621..efedda973bb 100644
--- a/src/mesa/math/m_debug_util.h
+++ b/src/mesa/math/m_debug_util.h
@@ -1,4 +1,4 @@
-/* $Id: m_debug_util.h,v 1.3 2001/03/30 14:44:43 gareth Exp $ */
+/* $Id: m_debug_util.h,v 1.4 2001/05/23 14:27:03 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -38,7 +38,9 @@
* NOTE: it works only on CPUs which know the 'rdtsc' command (586 or higher)
* (hope, you don't try to debug Mesa on a 386 ;)
*/
-#if defined(__GNUC__) && defined(__i386__) && defined(USE_X86_ASM)
+#if defined(__GNUC__) && \
+ ((defined(__i386__) && defined(USE_X86_ASM)) || \
+ (defined(__sparc__) && defined(USE_SPARC_ASM)))
#define RUN_DEBUG_BENCHMARK
#endif
@@ -67,6 +69,8 @@ extern char *mesa_profile;
* It is assumed that all calculations are done in the cache.
*/
+#if defined(__i386__)
+
#if 1 /* PPro, PII, PIII version */
/* Profiling on the P6 architecture requires a little more work, due to
@@ -183,6 +187,30 @@ extern char *mesa_profile;
#endif
+#elif defined(__sparc__)
+
+#define INIT_COUNTER() \
+ do { counter_overhead = 5; } while(0)
+
+#define BEGIN_RACE(x) \
+x = LONG_MAX; \
+for (cycle_i = 0; cycle_i <10; cycle_i++) { \
+ register long cycle_tmp1 asm("l0"); \
+ register long cycle_tmp2 asm("l1"); \
+ /* rd %tick, %l0 */ \
+ __asm__ __volatile__ (".word 0xa1410000" : "=r" (cycle_tmp1)); /* save timestamp */
+
+#define END_RACE(x) \
+ /* rd %tick, %l1 */ \
+ __asm__ __volatile__ (".word 0xa3410000" : "=r" (cycle_tmp2)); \
+ if (x > (cycle_tmp2-cycle_tmp1)) x = cycle_tmp2 - cycle_tmp1; \
+} \
+x -= counter_overhead;
+
+#else
+#error Your processor is not supported for RUN_XFORM_BENCHMARK
+#endif
+
#else
#define BEGIN_RACE(x)
diff --git a/src/mesa/math/m_xform.c b/src/mesa/math/m_xform.c
index 69430848be2..c043b09069a 100644
--- a/src/mesa/math/m_xform.c
+++ b/src/mesa/math/m_xform.c
@@ -1,4 +1,4 @@
-/* $Id: m_xform.c,v 1.13 2001/05/21 16:33:41 gareth Exp $ */
+/* $Id: m_xform.c,v 1.14 2001/05/23 14:27:03 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -56,6 +56,10 @@
#include "X86/common_x86_asm.h"
#endif
+#ifdef USE_SPARC_ASM
+#include "SPARC/sparc.h"
+#endif
+
clip_func _mesa_clip_tab[5];
clip_func _mesa_clip_np_tab[5];
dotprod_func _mesa_dotprod_tab[5];
@@ -206,6 +210,9 @@ _math_init_transformation( void )
#ifdef USE_X86_ASM
_mesa_init_all_x86_transform_asm();
#endif
+#ifdef USE_SPARC_ASM
+ _mesa_init_all_sparc_transform_asm();
+#endif
}
void