1 /* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
3 * This file is part of Gromacs Copyright (c) 1991-2004
4 * David van der Spoel, Erik Lindahl, University of Groningen.
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * To help us fund GROMACS development, we humbly ask that you cite
12 * the research papers on the package. Check out http://www.gromacs.org
15 * Gnomes, ROck Monsters And Chili Sauce
21 /* Must come directly after config.h */
22 #ifdef GMX_THREAD_SHM_FDECOMP
23 #include <thread_mpi.h>
26 #include <types/simple.h>
27 #include <types/nrnb.h>
29 #include "nb_kernel_sse2_single.h"
31 /* Include single precision SSE intrinsics kernel headers in local directory */
32 #include "nb_kernel400_sse2_single.h"
33 #include "nb_kernel410_sse2_single.h"
34 #include "nb_kernel430_sse2_single.h"
40 /* MSVC definition for __cpuid() */
44 #include "../nb_kerneltype.h"
45 #include "nb_kernel_sse2_single.h"
48 kernellist_sse2_single[eNR_NBKERNEL_NR] =
113 nb_kernel400_sse2_single,
114 nb_kernel410_sse2_single,
115 nb_kernel430_sse2_single
119 /* Return 0 if SSE support is present, or
120 * non-zero on failure.
123 nb_kernel_sse2_single_test(FILE * log)
126 unsigned int _eax,_ebx,_ecx,_edx;
132 fprintf(log,"Checking CPU SSE2 support... ");
144 #elif defined(__x86_64__)
145 /* GCC 64-bit inline asm */
146 __asm__ ("push %%rbx\n\tcpuid\n\tpop %%rbx\n" \
147 : "=a" (_eax), "=S" (_ebx), "=c" (_ecx), "=d" (_edx) \
149 #elif defined(__i386__)
150 __asm__ ("push %%ebx\n\tcpuid\n\tpop %%ebx\n" \
151 : "=a" (_eax), "=S" (_ebx), "=c" (_ecx), "=d" (_edx) \
156 fprintf(log,"Don't know how to call cpuid() on this system!\n");
158 _eax=_ebx=_ecx=_edx=0;
163 * SSE Bit 25 of edx should be set
164 * SSE2 Bit 26 of edx should be set
165 * SSE3 Bit 0 of ecx should be set
166 * SSE4.1 Bit 19 of ecx should be set
168 status = (_edx & (1 << 26)) != 0;
172 fprintf(log,"%s present.", (status==0) ? "not" : "");
175 /* Return SSE2 status */
183 nb_kernel_setup_sse2_single(FILE *log,nb_kernel_t **list)
188 if(nb_kernel_sse2_single_test(log) == 0)
193 for(i=0;i<eNR_NBKERNEL_NR;i++)
195 p = kernellist_sse2_single[i];