[PATCH] D15362: Guard "-msse3" flag in CMake for specific targets. NFC

Sumanth Gundapaneni via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 8 16:37:48 PST 2015


sgundapa created this revision.
sgundapa added a reviewer: samsonov.
sgundapa added a subscriber: llvm-commits.

msse3 is a target dependent flag and must be guarded as check_cxx_compiler_flag()
checks only for compiler error messages and ignores warnings. Earlier COMPILER_RT_HAS_MSSE3_FLAG
is "TRUE" for all targets as clang emits warnings and the compilation spits unnecessary 
warnings for non-X86 targets


http://reviews.llvm.org/D15362

Files:
  cmake/config-ix.cmake

Index: cmake/config-ix.cmake
===================================================================
--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -27,10 +27,15 @@
 check_cxx_compiler_flag(-std=c++11           COMPILER_RT_HAS_STD_CXX11_FLAG)
 check_cxx_compiler_flag(-ftls-model=initial-exec COMPILER_RT_HAS_FTLS_MODEL_INITIAL_EXEC)
 check_cxx_compiler_flag(-fno-lto             COMPILER_RT_HAS_FNO_LTO_FLAG)
-check_cxx_compiler_flag(-msse3               COMPILER_RT_HAS_MSSE3_FLAG)
 check_cxx_compiler_flag(-std=c99             COMPILER_RT_HAS_STD_C99_FLAG)
 check_cxx_compiler_flag(--sysroot=.          COMPILER_RT_HAS_SYSROOT_FLAG)
 
+if("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "i[2-6]86|x86|amd64")
+  # msse3 is a target dependent flag and must be guarded as check_cxx_compiler_flag()
+  # checks only for compiler error messages and ignores warnings
+  check_cxx_compiler_flag(-msse3               COMPILER_RT_HAS_MSSE3_FLAG)
+endif()
+
 if(NOT WIN32 AND NOT CYGWIN)
   # MinGW warns if -fvisibility-inlines-hidden is used.
   check_cxx_compiler_flag("-fvisibility-inlines-hidden" COMPILER_RT_HAS_FVISIBILITY_INLINES_HIDDEN_FLAG)
@@ -574,14 +579,6 @@
   set(COMPILER_RT_HAS_UBSAN FALSE)
 endif()
 
-# -msse3 flag is not valid for Mips therefore clang gives a warning
-# message with -msse3. But check_c_compiler_flags() checks only for
-# compiler error messages. Therefore COMPILER_RT_HAS_MSSE3_FLAG turns out to be
-# true on Mips, so we make it false here.
-if("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "mips")
-  set(COMPILER_RT_HAS_MSSE3_FLAG FALSE)
-endif()
-
 if (COMPILER_RT_HAS_SANITIZER_COMMON AND SAFESTACK_SUPPORTED_ARCH AND
     OS_NAME MATCHES "Darwin|Linux|FreeBSD")
   set(COMPILER_RT_HAS_SAFESTACK TRUE)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15362.42245.patch
Type: text/x-patch
Size: 1740 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151209/68989334/attachment.bin>


More information about the llvm-commits mailing list