Home | History | Annotate | Download | only in PowerPC
      1 ; RUN: llc < %s -march=ppc64 | FileCheck %s
      2 
      3 define i64 @exchange_and_add(i64* %mem, i64 %val) nounwind {
      4 ; CHECK: exchange_and_add:
      5 ; CHECK: ldarx
      6   %tmp = atomicrmw add i64* %mem, i64 %val monotonic
      7 ; CHECK: stdcx.
      8   ret i64 %tmp
      9 }
     10 
     11 define i64 @exchange_and_cmp(i64* %mem) nounwind {
     12 ; CHECK: exchange_and_cmp:
     13 ; CHECK: ldarx
     14   %tmp = cmpxchg i64* %mem, i64 0, i64 1 monotonic
     15 ; CHECK: stdcx.
     16 ; CHECK: stdcx.
     17   ret i64 %tmp
     18 }
     19 
     20 define i64 @exchange(i64* %mem, i64 %val) nounwind {
     21 ; CHECK: exchange:
     22 ; CHECK: ldarx
     23   %tmp = atomicrmw xchg i64* %mem, i64 1 monotonic
     24 ; CHECK: stdcx.
     25   ret i64 %tmp
     26 }
     27