MythTV  master
aclib.c
Go to the documentation of this file.
1 #include "config.h"
2 
3 /*
4  aclib - advanced C library ;)
5  This file contains functions which improve and expand standard C-library
6  see aclib_template.c ... this file only contains runtime cpu detection and config options stuff
7  runtime cpu detection by michael niedermayer (michaelni@gmx.at) is under GPL
8 */
9 #include <stdio.h>
10 #include <stddef.h>
11 #include <string.h>
12 #undef memcpy
13 
14 #define BLOCK_SIZE 256
15 #define CONFUSION_FACTOR 0
16 //Feel free to fine-tune the above 2, it might be possible to get some speedup with them :)
17 
18 #if ARCH_X86_64
19 # define REG_a "rax"
20 # define REG_b "rbx"
21 # define MOVX "movq"
22 #else
23 # define REG_a "eax"
24 # define REG_b "ebx"
25 # define MOVX "movl"
26 #endif
27 
28 #define COMPILE_MMX
29 #define COMPILE_MMX2
30 #define COMPILE_3DNOW
31 #define COMPILE_SSE
32 
33 #undef HAVE_MMX
34 #undef HAVE_MMX2
35 #undef HAVE_3DNOW
36 #undef HAVE_SSE
37 #undef HAVE_SSE2
38 
39 //MMX versions
40 #ifdef COMPILE_MMX
41 #undef RENAME
42 #define HAVE_MMX
43 #undef HAVE_MMX2
44 #undef HAVE_3DNOW
45 #undef HAVE_SSE
46 #undef HAVE_SSE2
47 #define RENAME(a) a ## _MMX
48 #include "aclib_template.c"
49 #endif
50 
51 //MMX2 versions
52 #ifdef COMPILE_MMX2
53 #undef RENAME
54 #define HAVE_MMX
55 #define HAVE_MMX2
56 #undef HAVE_3DNOW
57 #undef HAVE_SSE
58 #undef HAVE_SSE2
59 #define RENAME(a) a ## _MMX2
60 #include "aclib_template.c"
61 #endif
62 
63 //3DNOW versions
64 #ifdef COMPILE_3DNOW
65 #undef RENAME
66 #define HAVE_MMX
67 #undef HAVE_MMX2
68 #define HAVE_3DNOW
69 #undef HAVE_SSE
70 #undef HAVE_SSE2
71 #define RENAME(a) a ## _3DNow
72 #include "aclib_template.c"
73 #endif
74 
75 //SSE versions (only used on SSE2 cpus)
76 #ifdef COMPILE_SSE
77 #undef RENAME
78 #define HAVE_MMX
79 #define HAVE_MMX2
80 #undef HAVE_3DNOW
81 #define HAVE_SSE
82 #define HAVE_SSE2
83 #define RENAME(a) a ## _SSE
84 #include "aclib_template.c"
85 #endif
86 
87 /* vim: set expandtab tabstop=4 shiftwidth=4: */