Title: [244001] releases/WebKitGTK/webkit-2.24
Revision
244001
Author
[email protected]
Date
2019-04-08 05:38:37 -0700 (Mon, 08 Apr 2019)

Log Message

Merge r243989 - [CMake] Detect SSE2 at compile time
https://bugs.webkit.org/show_bug.cgi?id=196488

Patch by Xan Lopez <[email protected]> on 2019-04-08
Reviewed by Carlos Garcia Campos.

.:

* CMakeLists.txt: Use FindSSE2.cmake to detect SSE2 support.
* Source/cmake/FindSSE2.cmake: Added.

Source/_javascript_Core:

* assembler/MacroAssemblerX86Common.cpp: Remove unnecessary (and
incorrect) static_assert.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.24/CMakeLists.txt (244000 => 244001)


--- releases/WebKitGTK/webkit-2.24/CMakeLists.txt	2019-04-08 12:32:57 UTC (rev 244000)
+++ releases/WebKitGTK/webkit-2.24/CMakeLists.txt	2019-04-08 12:38:37 UTC (rev 244001)
@@ -106,6 +106,16 @@
     set(WTF_CPU_UNKNOWN 1)
 endif ()
 
+#---------------------------
+# Make sure SSE2 is present.
+#---------------------------
+if (WTF_CPU_X86)
+    include(FindSSE2)
+    if (NOT SSE2_SUPPORT_FOUND)
+        message(FATAL_ERROR "SSE2 support is required to compile WebKit")
+    endif ()
+endif ()
+
 # -----------------------------------------------------------------------------
 # Determine the operating system
 # -----------------------------------------------------------------------------

Modified: releases/WebKitGTK/webkit-2.24/ChangeLog (244000 => 244001)


--- releases/WebKitGTK/webkit-2.24/ChangeLog	2019-04-08 12:32:57 UTC (rev 244000)
+++ releases/WebKitGTK/webkit-2.24/ChangeLog	2019-04-08 12:38:37 UTC (rev 244001)
@@ -1,3 +1,13 @@
+2019-04-08  Xan Lopez  <[email protected]>
+
+        [CMake] Detect SSE2 at compile time
+        https://bugs.webkit.org/show_bug.cgi?id=196488
+
+        Reviewed by Carlos Garcia Campos.
+
+        * CMakeLists.txt: Use FindSSE2.cmake to detect SSE2 support.
+        * Source/cmake/FindSSE2.cmake: Added.
+
 2019-02-28  Carlos Garcia Campos  <[email protected]>
 
         [CoordinatedGraphics] Remove COORDINATED_GRAPHICS_THREADED option

Modified: releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/ChangeLog (244000 => 244001)


--- releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/ChangeLog	2019-04-08 12:32:57 UTC (rev 244000)
+++ releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/ChangeLog	2019-04-08 12:38:37 UTC (rev 244001)
@@ -1,3 +1,13 @@
+2019-04-08  Xan Lopez  <[email protected]>
+
+        [CMake] Detect SSE2 at compile time
+        https://bugs.webkit.org/show_bug.cgi?id=196488
+
+        Reviewed by Carlos Garcia Campos.
+
+        * assembler/MacroAssemblerX86Common.cpp: Remove unnecessary (and
+        incorrect) static_assert.
+
 2019-03-21  Carlos Garcia Campos  <[email protected]>
 
         [GLIB] User data not correctly passed to callback of functions and constructors with no parameters

Modified: releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/assembler/MacroAssemblerX86Common.cpp (244000 => 244001)


--- releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/assembler/MacroAssemblerX86Common.cpp	2019-04-08 12:32:57 UTC (rev 244000)
+++ releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/assembler/MacroAssemblerX86Common.cpp	2019-04-08 12:38:37 UTC (rev 244001)
@@ -787,7 +787,6 @@
     std::call_once(onceKey, [] {
         {
             CPUID cpuid = getCPUID(0x1);
-            s_sse2CheckState = (cpuid[3] & (1 << 26)) ? CPUIDCheckState::Set : CPUIDCheckState::Clear;
             s_sse4_1CheckState = (cpuid[2] & (1 << 19)) ? CPUIDCheckState::Set : CPUIDCheckState::Clear;
             s_sse4_2CheckState = (cpuid[2] & (1 << 20)) ? CPUIDCheckState::Set : CPUIDCheckState::Clear;
             s_popcntCheckState = (cpuid[2] & (1 << 23)) ? CPUIDCheckState::Set : CPUIDCheckState::Clear;
@@ -804,7 +803,6 @@
     });
 }
 
-MacroAssemblerX86Common::CPUIDCheckState MacroAssemblerX86Common::s_sse2CheckState = CPUIDCheckState::NotChecked;
 MacroAssemblerX86Common::CPUIDCheckState MacroAssemblerX86Common::s_sse4_1CheckState = CPUIDCheckState::NotChecked;
 MacroAssemblerX86Common::CPUIDCheckState MacroAssemblerX86Common::s_sse4_2CheckState = CPUIDCheckState::NotChecked;
 MacroAssemblerX86Common::CPUIDCheckState MacroAssemblerX86Common::s_avxCheckState = CPUIDCheckState::NotChecked;

Modified: releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/assembler/MacroAssemblerX86Common.h (244000 => 244001)


--- releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/assembler/MacroAssemblerX86Common.h	2019-04-08 12:32:57 UTC (rev 244000)
+++ releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/assembler/MacroAssemblerX86Common.h	2019-04-08 12:38:37 UTC (rev 244001)
@@ -4264,41 +4264,11 @@
     }
 #endif
 
-#if CPU(X86)
-#if OS(MAC_OS_X)
-
-    // All X86 Macs are guaranteed to support at least SSE2,
-    static bool isSSE2Present()
-    {
-        return true;
-    }
-
-#else // OS(MAC_OS_X)
-    static bool isSSE2Present()
-    {
-        if (s_sse2CheckState == CPUIDCheckState::NotChecked)
-            collectCPUFeatures();
-        return s_sse2CheckState == CPUIDCheckState::Set;
-    }
-
-#endif // OS(MAC_OS_X)
-#elif !defined(NDEBUG) // CPU(X86)
-
-    // On x86-64 we should never be checking for SSE2 in a non-debug build,
-    // but non debug add this method to keep the asserts above happy.
-    static bool isSSE2Present()
-    {
-        return true;
-    }
-
-#endif
-
     using CPUID = std::array<unsigned, 4>;
     static CPUID getCPUID(unsigned level);
     static CPUID getCPUIDEx(unsigned level, unsigned count);
     JS_EXPORT_PRIVATE static void collectCPUFeatures();
 
-    JS_EXPORT_PRIVATE static CPUIDCheckState s_sse2CheckState;
     JS_EXPORT_PRIVATE static CPUIDCheckState s_sse4_1CheckState;
     JS_EXPORT_PRIVATE static CPUIDCheckState s_sse4_2CheckState;
     JS_EXPORT_PRIVATE static CPUIDCheckState s_avxCheckState;

Added: releases/WebKitGTK/webkit-2.24/Source/cmake/FindSSE2.cmake (0 => 244001)


--- releases/WebKitGTK/webkit-2.24/Source/cmake/FindSSE2.cmake	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.24/Source/cmake/FindSSE2.cmake	2019-04-08 12:38:37 UTC (rev 244001)
@@ -0,0 +1,65 @@
+#################################
+# Check for the presence of SSE2.
+#
+# Once done, this will define:
+# - SSE2_SUPPORT_FOUND - the system supports (at least) SSE2.
+#
+# Copyright (c) 2014, Pablo Fernandez Alcantarilla, Jesus Nuevo
+# Copyright (c) 2019, Igalia S.L.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+#   * Redistributions of source code must retain the above copyright notice,
+#     this list of conditions and the following disclaimer.
+#
+#   * Redistributions in binary form must reproduce the above copyright notice,
+#     this list of conditions and the following disclaimer in the documentation
+#     and/or other materials provided with the distribution.
+#
+#   * Neither the name of the copyright holders nor the names of its contributors
+#     may be used to endorse or promote products derived from this software without
+#     specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+# SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
+# WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+set(SSE2_SUPPORT_FOUND FALSE)
+
+macro(CHECK_FOR_SSE2)
+    include(CheckCXXSourceRuns)
+
+    check_cxx_source_runs("
+        #include <emmintrin.h>
+        int main ()
+        {
+            __m128d a, b;
+            double vals[2] = {0};
+            a = _mm_loadu_pd (vals);
+            b = _mm_add_pd (a,a);
+            _mm_storeu_pd (vals,b);
+            return(0);
+        }"
+        HAVE_SSE2_EXTENSIONS)
+
+    if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANG)
+        if (HAVE_SSE2_EXTENSIONS)
+            set(SSE2_SUPPORT_FOUND TRUE)
+        endif ()
+    elseif (MSVC AND NOT CMAKE_CL_64)
+        if (HAVE_SSE2_EXTENSIONS)
+            set(SSE2_SUPPORT_FOUND TRUE)
+            message(STATUS "Found SSE2 extensions.")
+        endif (HAVE_SSE2_EXTENSIONS)
+    endif ()
+
+endmacro(CHECK_FOR_SSE2)
+
+CHECK_FOR_SSE2()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to