Disallow the use of Clang to compile AVX_128_FMA
authorErik Lindahl <erik@kth.se>
Thu, 10 Jan 2013 00:12:41 +0000 (01:12 +0100)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Thu, 10 Jan 2013 20:24:34 +0000 (21:24 +0100)
Clang apparently produces buggy code both for verlet kernels
and group kernels when the AVX_128_FMA acceleration is enabled.
Since it happens in two places it is unlikely to be a minor
bug, and since it covers versions up to the currently
released one, we don't have much choice but to disallow this
combination for now.
Fixes #1099.

Change-Id: If8346fa0a58f51a0ef6ac16e4801fe98ad1c73c9

CMakeLists.txt

index 3e80ef869a4f3d4613cf2f46419a02c7e9e7cf1b..8408ca1f8bd88003c3763eb0fce6c39d4396407c 100644 (file)
@@ -801,6 +801,9 @@ elseif(${GMX_CPU_ACCELERATION} STREQUAL "AVX_128_FMA" OR ${GMX_CPU_ACCELERATION}
 
     # Set the FMA4 flags (MSVC doesn't require any)
     if(${GMX_CPU_ACCELERATION} STREQUAL "AVX_128_FMA" AND NOT MSVC)
+        if (${CMAKE_COMPILER_ID} MATCHES "Clang")
+            message(FATAL_ERROR "Clang up to at least version 3.2 produces incorrect code for AVX_128_FMA. Sorry, but you will have to select a different compiler or acceleration.")
+        endif()
         GMX_TEST_CFLAG(GNU_FMA_CFLAG "-mfma4" ACCELERATION_C_FLAGS)
         if (NOT GNU_FMA_CFLAG)
             message(WARNING "No C FMA4 flag found. Consider a newer compiler, or try SSE4.1 (lower performance).")