Changeset 166234 in webkit


Ignore:
Timestamp:
Mar 25, 2014 7:13:07 AM (10 years ago)
Author:
rgabor@webkit.org
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):

Location:
trunk/Source/WTF
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r166232 r166234  
     12014-03-25  Gabor Rapcsanyi  <rgabor@webkit.org>
     2
     3        [ARM64] GCC generates wrong code with -O2 flag in WTF::weakCompareAndSwap
     4        https://bugs.webkit.org/show_bug.cgi?id=130500
     5
     6        Reviewed by Filip Pizlo.
     7
     8        Set the first operand to the exact register in the inline assembly with GCC.
     9
     10        * wtf/Atomics.h:
     11        (WTF::weakCompareAndSwap):
     12
    1132014-03-25  Gabor Rapcsanyi  <rgabor@webkit.org>
    214
  • trunk/Source/WTF/wtf/Atomics.h

    r165676 r166234  
    113113        : "memory");
    114114    result = !result;
     115#elif CPU(ARM64) && COMPILER(GCC)
     116    unsigned tmp;
     117    unsigned result;
     118    asm volatile(
     119        "mov %w1, #1\n\t"
     120        "ldxr %w2, [%0]\n\t"
     121        "cmp %w3, %w2\n\t"
     122        "b.ne 0f\n\t"
     123        "stxr %w1, %w4, [%0]\n\t"
     124        "0:"
     125        : "+r"(location), "=&r"(result), "=&r"(tmp)
     126        : "r"(expected), "r"(newValue)
     127        : "memory");
     128    result = !result;
    115129#elif CPU(ARM64)
    116130    unsigned tmp;
     
    153167        );
    154168    return result;
     169#elif CPU(ARM64) && COMPILER(GCC)
     170    bool result;
     171    void* tmp;
     172    asm volatile(
     173        "mov %w1, #1\n\t"
     174        "ldxr %x2, [%0]\n\t"
     175        "cmp %x3, %x2\n\t"
     176        "b.ne 0f\n\t"
     177        "stxr %w1, %x4, [%0]\n\t"
     178        "0:"
     179        : "+r"(location), "=&r"(result), "=&r"(tmp)
     180        : "r"(expected), "r"(newValue)
     181        : "memory");
     182    return !result;
    155183#elif CPU(ARM64)
    156184    bool result;
Note: See TracChangeset for help on using the changeset viewer.