1; RUN: llc < %s -mtriple=armv7-apple-darwin10 -verify-machineinstrs | FileCheck %s
2; RUN: llc < %s -mtriple=thumbv7-apple-darwin10 -verify-machineinstrs | FileCheck %s
3
4define void @func(i32 %argc, i8** %argv) nounwind {
5entry:
6	%argc.addr = alloca i32		; <i32*> [#uses=1]
7	%argv.addr = alloca i8**		; <i8***> [#uses=1]
8	%val1 = alloca i32		; <i32*> [#uses=2]
9	%val2 = alloca i32		; <i32*> [#uses=15]
10	%andt = alloca i32		; <i32*> [#uses=2]
11	%ort = alloca i32		; <i32*> [#uses=2]
12	%xort = alloca i32		; <i32*> [#uses=2]
13	%old = alloca i32		; <i32*> [#uses=18]
14	%temp = alloca i32		; <i32*> [#uses=2]
15	store i32 %argc, i32* %argc.addr
16	store i8** %argv, i8*** %argv.addr
17	store i32 0, i32* %val1
18	store i32 31, i32* %val2
19	store i32 3855, i32* %andt
20	store i32 3855, i32* %ort
21	store i32 3855, i32* %xort
22	store i32 4, i32* %temp
23	%tmp = load i32* %temp
24  ; CHECK: ldrex
25  ; CHECK: add
26  ; CHECK: strex
27  %0 = atomicrmw add i32* %val1, i32 %tmp monotonic
28	store i32 %0, i32* %old
29  ; CHECK: ldrex
30  ; CHECK: sub
31  ; CHECK: strex
32  %1 = atomicrmw sub i32* %val2, i32 30 monotonic
33	store i32 %1, i32* %old
34  ; CHECK: ldrex
35  ; CHECK: add
36  ; CHECK: strex
37  %2 = atomicrmw add i32* %val2, i32 1 monotonic
38	store i32 %2, i32* %old
39  ; CHECK: ldrex
40  ; CHECK: sub
41  ; CHECK: strex
42  %3 = atomicrmw sub i32* %val2, i32 1 monotonic
43	store i32 %3, i32* %old
44  ; CHECK: ldrex
45  ; CHECK: and
46  ; CHECK: strex
47  %4 = atomicrmw and i32* %andt, i32 4080 monotonic
48	store i32 %4, i32* %old
49  ; CHECK: ldrex
50  ; CHECK: or
51  ; CHECK: strex
52  %5 = atomicrmw or i32* %ort, i32 4080 monotonic
53	store i32 %5, i32* %old
54  ; CHECK: ldrex
55  ; CHECK: eor
56  ; CHECK: strex
57  %6 = atomicrmw xor i32* %xort, i32 4080 monotonic
58	store i32 %6, i32* %old
59  ; CHECK: ldrex
60  ; CHECK: cmp
61  ; CHECK: strex
62  %7 = atomicrmw min i32* %val2, i32 16 monotonic
63	store i32 %7, i32* %old
64	%neg = sub i32 0, 1		; <i32> [#uses=1]
65  ; CHECK: ldrex
66  ; CHECK: cmp
67  ; CHECK: strex
68  %8 = atomicrmw min i32* %val2, i32 %neg monotonic
69	store i32 %8, i32* %old
70  ; CHECK: ldrex
71  ; CHECK: cmp
72  ; CHECK: strex
73  %9 = atomicrmw max i32* %val2, i32 1 monotonic
74	store i32 %9, i32* %old
75  ; CHECK: ldrex
76  ; CHECK: cmp
77  ; CHECK: strex
78  %10 = atomicrmw max i32* %val2, i32 0 monotonic
79	store i32 %10, i32* %old
80	ret void
81}
82