Title: [286378] trunk/Source/_javascript_Core
Revision
286378
Author
[email protected]
Date
2021-12-01 12:32:39 -0800 (Wed, 01 Dec 2021)

Log Message

Disable madd4 instruction generation globally for MIPS
https://bugs.webkit.org/show_bug.cgi?id=233713

Patch by Mikhail R. Gadelha <[email protected]> on 2021-12-01
Reviewed by Yusuke Suzuki.

This is an improved version of r285788 and follows the approach used
in r231301. This patch removes the volatile attribute from the double
variable and adds a -mno-madd4 flag globally when compiling on MIPS.

* CMakeLists.txt:
* runtime/ParseInt.h:
(JSC::parseInt):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/CMakeLists.txt (286377 => 286378)


--- trunk/Source/_javascript_Core/CMakeLists.txt	2021-12-01 20:29:49 UTC (rev 286377)
+++ trunk/Source/_javascript_Core/CMakeLists.txt	2021-12-01 20:32:39 UTC (rev 286378)
@@ -1458,6 +1458,12 @@
     # Avoid using fused multiply-add instructions since this could give different results
     # for e.g. parseInt depending on the platform and compilation flags.
     WEBKIT_ADD_TARGET_CXX_FLAGS(_javascript_Core -ffp-contract=off -fno-slp-vectorize)
+
+    # On MIPS we have to explicitly disable madd4, since some versions of gcc still generate
+    # such instructions despite -ffp-contract=off
+    if (WTF_CPU_MIPS)
+        WEBKIT_ADD_TARGET_CXX_FLAGS(_javascript_Core -mno-madd4)
+    endif ()
 endif ()
 
 WEBKIT_COPY_FILES(_javascript_Core_CopyHeaders

Modified: trunk/Source/_javascript_Core/ChangeLog (286377 => 286378)


--- trunk/Source/_javascript_Core/ChangeLog	2021-12-01 20:29:49 UTC (rev 286377)
+++ trunk/Source/_javascript_Core/ChangeLog	2021-12-01 20:32:39 UTC (rev 286378)
@@ -1,3 +1,18 @@
+2021-12-01  Mikhail R. Gadelha  <[email protected]>
+
+        Disable madd4 instruction generation globally for MIPS
+        https://bugs.webkit.org/show_bug.cgi?id=233713
+
+        Reviewed by Yusuke Suzuki.
+
+        This is an improved version of r285788 and follows the approach used
+        in r231301. This patch removes the volatile attribute from the double 
+        variable and adds a -mno-madd4 flag globally when compiling on MIPS.
+
+        * CMakeLists.txt:
+        * runtime/ParseInt.h:
+        (JSC::parseInt):
+
 2021-12-01  Yusuke Suzuki  <[email protected]>
 
         Unreviewed, fix CLoop build

Modified: trunk/Source/_javascript_Core/runtime/ParseInt.h (286377 => 286378)


--- trunk/Source/_javascript_Core/runtime/ParseInt.h	2021-12-01 20:29:49 UTC (rev 286377)
+++ trunk/Source/_javascript_Core/runtime/ParseInt.h	2021-12-01 20:32:39 UTC (rev 286378)
@@ -162,15 +162,7 @@
     // 14. Let number be the Number value for mathInt.
     int firstDigitPosition = p;
     bool sawDigit = false;
-#if COMPILER(GCC)
-    // Due to a bug found in GCC v8.4.0, a wrong fused multiply-add optimization can be inserted when calculating the final number,
-    // in number *= radix; number += digit;, so add volatile to prevent optimizations.
-    // GCC v8.4.0 also seems to ignore #pragma STDC FP_CONTRACT OFF, compiling with -ffp-contract=off, and setting function attributes
-    // __attribute__((optimize("fp-contract=off"))) and __attribute__((optimize("-ffp-contract=off"))).
-    volatile double number = 0;
-#else
     double number = 0;
-#endif
     while (p < length) {
         int digit = parseDigit(data[p], radix);
         if (digit == -1)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to