Fixed the config.h inclusion
[gromacs.git] / include / detectcpu.h
blob28c223b6577c35359e9abec2387b4bf40bf30345
1 /*
2 * $Id$
3 *
4 * This source code is part of
5 *
6 * G R O M A C S
7 *
8 * GROningen MAchine for Chemical Simulations
9 *
10 * VERSION 3.2.0
11 * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
12 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
13 * Copyright (c) 2001-2004, The GROMACS development team,
14 * check out http://www.gromacs.org for more information.
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version 2
19 * of the License, or (at your option) any later version.
21 * If you want to redistribute modifications, please consider that
22 * scientific software is very special. Version control is crucial -
23 * bugs must be traceable. We will be happy to consider code for
24 * inclusion in the official distribution, but derived work must not
25 * be called official GROMACS. Details are found in the README & COPYING
26 * files - if they are missing, get the official version at www.gromacs.org.
28 * To help us fund GROMACS development, we humbly ask that you cite
29 * the papers on the package - you can find them in the top README file.
31 * For more info, check our website at http://www.gromacs.org
33 * And Hey:
34 * Gromacs Runs On Most of All Computer Systems
37 #ifndef _detectcpu_h
38 #define _detectcpu_h
40 #ifdef HAVE_CONFIG_H
41 #include <config.h>
42 #endif
44 #include <stdio.h>
46 extern int cpu_capabilities;
48 #define UNKNOWN_CPU 0
49 /* Flags for x86 and future processor capabilities */
50 #define X86_CPU 1
51 #define X86_SSE_SUPPORT (1 << 1)
52 #define X86_3DNOW_SUPPORT (1 << 2)
53 #define X86_SSE2_SUPPORT (1 << 3)
54 /* 3Dnow professional has SSE support, treat it as SSE (=IEEE ok) */
55 /* Even if the system cant do SSE, we want to tell the user that
56 * his/her cpu could do it with an OS upgrade.
57 * (This is not an issue for 3DNow)
59 #define CPU_SSE_SUPPORT (1 << 4)
60 #define CPU_SSE2_SUPPORT (1 << 5)
61 /* bit 6 unused */
62 #define IA64_CPU (1 << 7)
63 #define PPC_CPU (1 << 8)
64 #define PPC_ALTIVEC_SUPPORT (1 << 9)
65 #define AMD_CPU (1 << 10)
66 #define INTEL_CPU (1 << 11)
68 /* Values that are return by cpuid instructions on x86 */
69 #define VENDOR_AMD 0x68747541
70 #define VENDOR_INTEL 0x756e6547
71 #define FLAGS_SUPPORT_SSE 0x02000000
72 #define FLAGS_SUPPORT_SSE2 0x04000000
73 #define FLAGS_SUPPORT_EXT_3DNOW 0xc0000000
75 #if ( defined USE_X86_SSE_AND_3DNOW || defined USE_X86_SSE2)
76 /* x86 cpuid assembly routine in x86_cpuid.s */
77 void x86_cpuid(int,unsigned long *,unsigned long *,unsigned long *,unsigned long *);
78 #endif
80 #ifdef USE_X86_SSE_AND_3DNOW
81 #include <x86_sse.h>
82 #include <x86_3dnow.h>
83 #endif
85 #ifdef USE_X86_SSE2
86 #include <x86_sse2.h>
87 #endif
89 #ifdef USE_PPC_ALTIVEC
90 #include <ppc_altivec.h>
91 #endif
93 int detect_cpu(FILE *log);
95 #endif