summaryrefslogtreecommitdiff
path: root/dxr3memcpy.h
blob: b0f8c140cd9f5082f5efd480762e91836fce0893 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*
 * dxr3memcpy.h
 *
 * Copyright (C) 2004 Christian Gmeiner
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 2.1
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 */

/*****************************************************************************
 * memcpy.h: functions and definitions of the MMX/MMX2/SSE optimized versions
 * of memcpy
 *****************************************************************************
 * Copyright (C) 2001 Keuleu
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
 *****************************************************************************
 *
 * Original code:
 * 
 * Copyright (C) 2000-2001 the xine project
 * 
 * This file is part of xine, a unix video player.
 * 
 *****************************************************************************/

#ifndef _DXR3MEMCPY_H_
#define _DXR3MEMCPY_H_

#include "dxr3vdrincludes.h"

// ==================================
// size of buffer for benchmark
#define BUFSIZE 1024*1024

enum {
  MEMCPY_PROBE = 0,
  MEMCPY_GLIBC,
  MEMCPY_KERNEL,
  MEMCPY_MMX,
  MEMCPY_MMXEXT,
  MEMCPY_SSE
};

// ==================================
struct memcpy_routine
{
	string name;
	void *(* function)(void *to, const void *from, size_t len);
	unsigned long long time;
	uint32_t cpu_require;		// caps from dxr3cpu.h
};

// ==================================
// little class to to a nice benchmark
class cDxr3MemcpyBench
{
public:
	cDxr3MemcpyBench(uint32_t config_flags = 0);

private:
	unsigned long long int Rdtsc();

	vector<memcpy_routine>	m_methods;
};

// ==================================
// optimized/fast memcpy
extern void *(* dxr3_memcpy)(void *to, const void *from, size_t len);

#endif /*_DXR3MEMCPY_H_*/