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_double.h"
31 /* Include double precision SSE intrinsics kernel headers in local directory */
32 #include "nb_kernel400_sse2_double.h"
33 #include "nb_kernel410_sse2_double.h"
34 #include "nb_kernel430_sse2_double.h"
39 #include "../nb_kerneltype.h"
40 #include "nb_kernel_sse2_double.h"
43 kernellist_sse2_double[eNR_NBKERNEL_NR] =
108 nb_kernel400_sse2_double,
109 nb_kernel410_sse2_double,
110 nb_kernel430_sse2_double
114 /* Return 0 if SSE support is present, or
115 * non-zero on failure.
118 nb_kernel_sse2_double_test(FILE * log)
121 unsigned int _eax,_ebx,_ecx,_edx;
127 fprintf(log,"Checking CPU SSE2 support... ");
139 #elif defined(__x86_64__)
140 /* GCC 64-bit inline asm */
141 __asm__ ("push %%rbx\n\tcpuid\n\tpop %%rbx\n" \
142 : "=a" (_eax), "=S" (_ebx), "=c" (_ecx), "=d" (_edx) \
144 #elif defined(__i386__)
145 __asm__ ("push %%ebx\n\tcpuid\n\tpop %%ebx\n" \
146 : "=a" (_eax), "=S" (_ebx), "=c" (_ecx), "=d" (_edx) \
151 fprintf(log,"Don't know how to call cpuid() on this system!\n");
153 _eax=_ebx=_ecx=_edx=0;
158 * SSE Bit 25 of edx should be set
159 * SSE2 Bit 26 of edx should be set
160 * SSE3 Bit 0 of ecx should be set
161 * SSE4.1 Bit 19 of ecx should be set
163 status = (_edx & (1 << 26)) != 0;
167 fprintf(log,"%s present.", (status==0) ? "not" : "");
170 /* Return SSE2 status */
178 nb_kernel_setup_sse2_double(FILE *log,nb_kernel_t **list)
183 if(nb_kernel_sse2_double_test(log) == 0)
188 for(i=0;i<eNR_NBKERNEL_NR;i++)
190 p = kernellist_sse2_double[i];