[gmx-developers] MSVC 32bit + SSE

Roland Schulz roland at utk.edu
Mon Jul 26 07:00:46 CEST 2010


Hi,

gmx_sse2_single.h doesn't compile with MSVC 2010 on 32bit. As the COMPILER
RANT in the file states MSVC doesn't support more than 3 __m128 parameters.
In the rant it also says that  some compilers don't support pointers to
__m128. For what compiler is this still true? If none, I suggest to change
the arguments to const pointers.

If there are still, some: Are there also compilers which don't support
either pointers nor unlimited __m128 parameters?

If not, I suggest a mixed approach. Where we detect which version is
supported and use macros to have to write each function only once. See the
below example. I think this is much less error prone than converting all
functions to macros as the rant suggests. Mainly because of the double
evaluation pitfall of macros.

Roland

sample:
#include <xmmintrin.h>

#ifdef SSE_POINTER
#define SSE_M128(a) const __m128 *a
#define SSE_REF(a) (&a)
#define SSE_IND(a) (*a)
#else
#define SSE_M128(a) __m128 a
#define SSE_REF(a) (a)
#define SSE_IND(a) (a)
#endif

static inline void f(SSE_M128(b)) {
  __m128 x = SSE_IND(b);
}

int main() {
  __m128 x;
  f(SSE_REF(x));
  return 0;
}



-- 
ORNL/UT Center for Molecular Biophysics cmb.ornl.gov
865-241-1537, ORNL PO BOX 2008 MS6309
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://maillist.sys.kth.se/pipermail/gromacs.org_gmx-developers/attachments/20100726/92302da6/attachment.html>


More information about the gromacs.org_gmx-developers mailing list