Title: [166234] trunk/Source/WTF
Revision
166234
Author
rga...@webkit.org
Date
2014-03-25 07:13:07 -0700 (Tue, 25 Mar 2014)

Log Message

[ARM64] GCC generates wrong code with -O2 flag in WTF::weakCompareAndSwap
https://bugs.webkit.org/show_bug.cgi?id=130500

Reviewed by Filip Pizlo.

Set the first operand to the exact register in the inline assembly with GCC.

* wtf/Atomics.h:
(WTF::weakCompareAndSwap):

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (166233 => 166234)


--- trunk/Source/WTF/ChangeLog	2014-03-25 13:14:42 UTC (rev 166233)
+++ trunk/Source/WTF/ChangeLog	2014-03-25 14:13:07 UTC (rev 166234)
@@ -1,5 +1,17 @@
 2014-03-25  Gabor Rapcsanyi  <rga...@webkit.org>
 
+        [ARM64] GCC generates wrong code with -O2 flag in WTF::weakCompareAndSwap
+        https://bugs.webkit.org/show_bug.cgi?id=130500
+
+        Reviewed by Filip Pizlo.
+
+        Set the first operand to the exact register in the inline assembly with GCC.
+
+        * wtf/Atomics.h:
+        (WTF::weakCompareAndSwap):
+
+2014-03-25  Gabor Rapcsanyi  <rga...@webkit.org>
+
         [EFL] Add ARM64 build support
         https://bugs.webkit.org/show_bug.cgi?id=130506
 

Modified: trunk/Source/WTF/wtf/Atomics.h (166233 => 166234)


--- trunk/Source/WTF/wtf/Atomics.h	2014-03-25 13:14:42 UTC (rev 166233)
+++ trunk/Source/WTF/wtf/Atomics.h	2014-03-25 14:13:07 UTC (rev 166234)
@@ -112,6 +112,20 @@
         : "r"(expected), "r"(newValue)
         : "memory");
     result = !result;
+#elif CPU(ARM64) && COMPILER(GCC)
+    unsigned tmp;
+    unsigned result;
+    asm volatile(
+        "mov %w1, #1\n\t"
+        "ldxr %w2, [%0]\n\t"
+        "cmp %w3, %w2\n\t"
+        "b.ne 0f\n\t"
+        "stxr %w1, %w4, [%0]\n\t"
+        "0:"
+        : "+r"(location), "=&r"(result), "=&r"(tmp)
+        : "r"(expected), "r"(newValue)
+        : "memory");
+    result = !result;
 #elif CPU(ARM64)
     unsigned tmp;
     unsigned result;
@@ -152,6 +166,20 @@
         : "memory"
         );
     return result;
+#elif CPU(ARM64) && COMPILER(GCC)
+    bool result;
+    void* tmp;
+    asm volatile(
+        "mov %w1, #1\n\t"
+        "ldxr %x2, [%0]\n\t"
+        "cmp %x3, %x2\n\t"
+        "b.ne 0f\n\t"
+        "stxr %w1, %x4, [%0]\n\t"
+        "0:"
+        : "+r"(location), "=&r"(result), "=&r"(tmp)
+        : "r"(expected), "r"(newValue)
+        : "memory");
+    return !result;
 #elif CPU(ARM64)
     bool result;
     void* tmp;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to