comparison ppc/dsputil_ppc.h @ 1340:09b8fe0f0139 libavcodec

PPC fixes & clean-up patch by (Romain Dolbeau <dolbeau at irisa dot fr>)
author michaelni
date Fri, 04 Jul 2003 09:39:05 +0000
parents 80c46c310a91
children e8ff4783f188
comparison
equal deleted inserted replaced
1339:338a2f6e6402 1340:09b8fe0f0139
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */ 17 */
18 18
19 #ifndef _DSPUTIL_PPC_ 19 #ifndef _DSPUTIL_PPC_
20 #define _DSPUTIL_PPC_ 20 #define _DSPUTIL_PPC_
21
22 #ifdef CONFIG_DARWIN
23 /* The Apple assembler shipped w/ gcc-3.3 knows about DCBZL, previous assemblers don't
24 We assume here that the Darwin GCC is from Apple.... */
25 #if (__GNUC__ * 100 + __GNUC_MINOR__ < 303)
26 #define NO_DCBZL
27 #endif
28 #else /* CONFIG_DARWIN */
29 /* I don't think any non-Apple assembler knows about DCBZL */
30 #define NO_DCBZL
31 #endif /* CONFIG_DARWIN */
21 32
22 #ifdef POWERPC_TBL_PERFORMANCE_REPORT 33 #ifdef POWERPC_TBL_PERFORMANCE_REPORT
23 void powerpc_display_perf_report(void); 34 void powerpc_display_perf_report(void);
24 /* if you add to the enum below, also add to the perfname array 35 /* if you add to the enum below, also add to the perfname array
25 in dsputil_ppc.c */ 36 in dsputil_ppc.c */
47 powerpc_data_num, 58 powerpc_data_num,
48 powerpc_data_total 59 powerpc_data_total
49 }; 60 };
50 extern unsigned long long perfdata[powerpc_perf_total][powerpc_data_total]; 61 extern unsigned long long perfdata[powerpc_perf_total][powerpc_data_total];
51 #ifdef POWERPC_PERF_USE_PMC 62 #ifdef POWERPC_PERF_USE_PMC
52 extern unsigned long long perfdata_miss[powerpc_perf_total][powerpc_data_total]; 63 extern unsigned long long perfdata_pmc2[powerpc_perf_total][powerpc_data_total];
64 extern unsigned long long perfdata_pmc3[powerpc_perf_total][powerpc_data_total];
53 #endif 65 #endif
54 66
55 #ifndef POWERPC_PERF_USE_PMC 67 #ifndef POWERPC_PERF_USE_PMC
56 #define POWERPC_GET_CYCLES(a) asm volatile("mftb %0" : "=r" (a)) 68 #define POWERPC_GET_CYCLES(a) asm volatile("mftb %0" : "=r" (a))
57 #define POWERPC_TBL_DECLARE(a, cond) register unsigned long tbl_start, tbl_stop 69 #define POWERPC_TBL_DECLARE(a, cond) register unsigned long tbl_start, tbl_stop
73 } \ 85 } \
74 } while (0) 86 } while (0)
75 87
76 #else /* POWERPC_PERF_USE_PMC */ 88 #else /* POWERPC_PERF_USE_PMC */
77 #define POWERPC_GET_CYCLES(a) asm volatile("mfspr %0, 937" : "=r" (a)) 89 #define POWERPC_GET_CYCLES(a) asm volatile("mfspr %0, 937" : "=r" (a))
78 #define POWERPC_GET_MISS(a) asm volatile("mfspr %0, 938" : "=r" (a)) 90 #define POWERPC_GET_PMC2(a) asm volatile("mfspr %0, 938" : "=r" (a))
79 #define POWERPC_TBL_DECLARE(a, cond) register unsigned long cycles_start, cycles_stop, miss_start, miss_stop 91 #define POWERPC_GET_PMC3(a) asm volatile("mfspr %0, 941" : "=r" (a))
80 #define POWERPC_TBL_START_COUNT(a, cond) do { POWERPC_GET_MISS(miss_start); POWERPC_GET_CYCLES(cycles_start); } while (0) 92 #define POWERPC_TBL_DECLARE(a, cond) register unsigned long cycles_start, cycles_stop, pmc2_start, pmc2_stop, pmc3_start, pmc3_stop
93 #define POWERPC_TBL_START_COUNT(a, cond) do { \
94 POWERPC_GET_PMC3(pmc3_start); \
95 POWERPC_GET_PMC2(pmc2_start); \
96 POWERPC_GET_CYCLES(cycles_start); } while (0)
81 #define POWERPC_TBL_STOP_COUNT(a, cond) do { \ 97 #define POWERPC_TBL_STOP_COUNT(a, cond) do { \
82 POWERPC_GET_CYCLES(cycles_stop); \ 98 POWERPC_GET_CYCLES(cycles_stop); \
83 POWERPC_GET_MISS(miss_stop); \ 99 POWERPC_GET_PMC2(pmc2_stop); \
100 POWERPC_GET_PMC3(pmc3_stop); \
84 if (cycles_stop >= cycles_start) \ 101 if (cycles_stop >= cycles_start) \
85 { \ 102 { \
86 unsigned long diff = \ 103 unsigned long diff = \
87 cycles_stop - cycles_start; \ 104 cycles_stop - cycles_start; \
88 if (cond) \ 105 if (cond) \
93 perfdata[a][powerpc_data_max] = diff; \ 110 perfdata[a][powerpc_data_max] = diff; \
94 perfdata[a][powerpc_data_sum] += diff; \ 111 perfdata[a][powerpc_data_sum] += diff; \
95 perfdata[a][powerpc_data_num] ++; \ 112 perfdata[a][powerpc_data_num] ++; \
96 } \ 113 } \
97 } \ 114 } \
98 if (miss_stop >= miss_start) \ 115 if (pmc2_stop >= pmc2_start) \
99 { \ 116 { \
100 unsigned long diff = \ 117 unsigned long diff = \
101 miss_stop - miss_start; \ 118 pmc2_stop - pmc2_start; \
102 if (cond) \ 119 if (cond) \
103 { \ 120 { \
104 if (diff < perfdata_miss[a][powerpc_data_min]) \ 121 if (diff < perfdata_pmc2[a][powerpc_data_min]) \
105 perfdata_miss[a][powerpc_data_min] = diff; \ 122 perfdata_pmc2[a][powerpc_data_min] = diff; \
106 if (diff > perfdata_miss[a][powerpc_data_max]) \ 123 if (diff > perfdata_pmc2[a][powerpc_data_max]) \
107 perfdata_miss[a][powerpc_data_max] = diff; \ 124 perfdata_pmc2[a][powerpc_data_max] = diff; \
108 perfdata_miss[a][powerpc_data_sum] += diff; \ 125 perfdata_pmc2[a][powerpc_data_sum] += diff; \
109 perfdata_miss[a][powerpc_data_num] ++; \ 126 perfdata_pmc2[a][powerpc_data_num] ++; \
127 } \
128 } \
129 if (pmc3_stop >= pmc3_start) \
130 { \
131 unsigned long diff = \
132 pmc3_stop - pmc3_start; \
133 if (cond) \
134 { \
135 if (diff < perfdata_pmc3[a][powerpc_data_min]) \
136 perfdata_pmc3[a][powerpc_data_min] = diff; \
137 if (diff > perfdata_pmc3[a][powerpc_data_max]) \
138 perfdata_pmc3[a][powerpc_data_max] = diff; \
139 perfdata_pmc3[a][powerpc_data_sum] += diff; \
140 perfdata_pmc3[a][powerpc_data_num] ++; \
110 } \ 141 } \
111 } \ 142 } \
112 } while (0) 143 } while (0)
113 144
114 #endif /* POWERPC_PERF_USE_PMC */ 145 #endif /* POWERPC_PERF_USE_PMC */