• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -mtriple=powerpc-apple-darwin -march=ppc32 |  FileCheck %s
2
3define i32 @exchange_and_add(i32* %mem, i32 %val) nounwind {
4; CHECK-LABEL: exchange_and_add:
5; CHECK: lwarx {{r[0-9]+}}, 0, {{r[0-9]+}}
6  %tmp = atomicrmw add i32* %mem, i32 %val monotonic
7; CHECK: stwcx. {{r[0-9]+}}, 0, {{r[0-9]+}}
8  ret i32 %tmp
9}
10
11define i32 @exchange_and_cmp(i32* %mem) nounwind {
12; CHECK-LABEL: exchange_and_cmp:
13; CHECK: lwarx
14  %tmppair = cmpxchg i32* %mem, i32 0, i32 1 monotonic monotonic
15  %tmp = extractvalue { i32, i1 } %tmppair, 0
16; CHECK: stwcx.
17; CHECK: stwcx.
18  ret i32 %tmp
19}
20
21define i32 @exchange(i32* %mem, i32 %val) nounwind {
22; CHECK-LABEL: exchange:
23; CHECK: lwarx
24  %tmp = atomicrmw xchg i32* %mem, i32 1 monotonic
25; CHECK: stwcx.
26  ret i32 %tmp
27}
28