• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -march=x86-64 -verify-machineinstrs | FileCheck %s
2
3; rdar://7103704
4
5define void @sub1(i32* nocapture %p, i32 %v) nounwind ssp {
6entry:
7; CHECK-LABEL: sub1:
8; CHECK: subl
9  %0 = atomicrmw sub i32* %p, i32 %v monotonic
10  ret void
11}
12
13define void @inc4(i64* nocapture %p) nounwind ssp {
14entry:
15; CHECK-LABEL: inc4:
16; CHECK: incq
17  %0 = atomicrmw add i64* %p, i64 1 monotonic
18  ret void
19}
20
21define void @add8(i64* nocapture %p) nounwind ssp {
22entry:
23; CHECK-LABEL: add8:
24; CHECK: addq $2
25  %0 = atomicrmw add i64* %p, i64 2 monotonic
26  ret void
27}
28
29define void @add4(i64* nocapture %p, i32 %v) nounwind ssp {
30entry:
31; CHECK-LABEL: add4:
32; CHECK: addq
33  %0 = sext i32 %v to i64		; <i64> [#uses=1]
34  %1 = atomicrmw add i64* %p, i64 %0 monotonic
35  ret void
36}
37
38define void @inc3(i8* nocapture %p) nounwind ssp {
39entry:
40; CHECK-LABEL: inc3:
41; CHECK: incb
42  %0 = atomicrmw add i8* %p, i8 1 monotonic
43  ret void
44}
45
46define void @add7(i8* nocapture %p) nounwind ssp {
47entry:
48; CHECK-LABEL: add7:
49; CHECK: addb $2
50  %0 = atomicrmw add i8* %p, i8 2 monotonic
51  ret void
52}
53
54define void @add3(i8* nocapture %p, i32 %v) nounwind ssp {
55entry:
56; CHECK-LABEL: add3:
57; CHECK: addb
58  %0 = trunc i32 %v to i8		; <i8> [#uses=1]
59  %1 = atomicrmw add i8* %p, i8 %0 monotonic
60  ret void
61}
62
63define void @inc2(i16* nocapture %p) nounwind ssp {
64entry:
65; CHECK-LABEL: inc2:
66; CHECK: incw
67  %0 = atomicrmw add i16* %p, i16 1 monotonic
68  ret void
69}
70
71define void @add6(i16* nocapture %p) nounwind ssp {
72entry:
73; CHECK-LABEL: add6:
74; CHECK: addw $2
75  %0 = atomicrmw add i16* %p, i16 2 monotonic
76  ret void
77}
78
79define void @add2(i16* nocapture %p, i32 %v) nounwind ssp {
80entry:
81; CHECK-LABEL: add2:
82; CHECK: addw
83	%0 = trunc i32 %v to i16		; <i16> [#uses=1]
84  %1 = atomicrmw add i16* %p, i16 %0 monotonic
85  ret void
86}
87
88define void @inc1(i32* nocapture %p) nounwind ssp {
89entry:
90; CHECK-LABEL: inc1:
91; CHECK: incl
92  %0 = atomicrmw add i32* %p, i32 1 monotonic
93  ret void
94}
95
96define void @add5(i32* nocapture %p) nounwind ssp {
97entry:
98; CHECK-LABEL: add5:
99; CHECK: addl $2
100  %0 = atomicrmw add i32* %p, i32 2 monotonic
101  ret void
102}
103
104define void @add1(i32* nocapture %p, i32 %v) nounwind ssp {
105entry:
106; CHECK-LABEL: add1:
107; CHECK: addl
108  %0 = atomicrmw add i32* %p, i32 %v monotonic
109  ret void
110}
111
112define void @dec4(i64* nocapture %p) nounwind ssp {
113entry:
114; CHECK-LABEL: dec4:
115; CHECK: decq
116  %0 = atomicrmw sub i64* %p, i64 1 monotonic
117  ret void
118}
119
120define void @sub8(i64* nocapture %p) nounwind ssp {
121entry:
122; CHECK-LABEL: sub8:
123; CHECK: subq $2
124  %0 = atomicrmw sub i64* %p, i64 2 monotonic
125  ret void
126}
127
128define void @sub4(i64* nocapture %p, i32 %v) nounwind ssp {
129entry:
130; CHECK-LABEL: sub4:
131; CHECK: subq
132	%0 = sext i32 %v to i64		; <i64> [#uses=1]
133  %1 = atomicrmw sub i64* %p, i64 %0 monotonic
134  ret void
135}
136
137define void @dec3(i8* nocapture %p) nounwind ssp {
138entry:
139; CHECK-LABEL: dec3:
140; CHECK: decb
141  %0 = atomicrmw sub i8* %p, i8 1 monotonic
142  ret void
143}
144
145define void @sub7(i8* nocapture %p) nounwind ssp {
146entry:
147; CHECK-LABEL: sub7:
148; CHECK: subb $2
149  %0 = atomicrmw sub i8* %p, i8 2 monotonic
150  ret void
151}
152
153define void @sub3(i8* nocapture %p, i32 %v) nounwind ssp {
154entry:
155; CHECK-LABEL: sub3:
156; CHECK: subb
157	%0 = trunc i32 %v to i8		; <i8> [#uses=1]
158  %1 = atomicrmw sub i8* %p, i8 %0 monotonic
159  ret void
160}
161
162define void @dec2(i16* nocapture %p) nounwind ssp {
163entry:
164; CHECK-LABEL: dec2:
165; CHECK: decw
166  %0 = atomicrmw sub i16* %p, i16 1 monotonic
167  ret void
168}
169
170define void @sub6(i16* nocapture %p) nounwind ssp {
171entry:
172; CHECK-LABEL: sub6:
173; CHECK: subw $2
174  %0 = atomicrmw sub i16* %p, i16 2 monotonic
175  ret void
176}
177
178define void @sub2(i16* nocapture %p, i32 %v) nounwind ssp {
179entry:
180; CHECK-LABEL: sub2:
181; CHECK-NOT: negl
182; CHECK: subw
183	%0 = trunc i32 %v to i16		; <i16> [#uses=1]
184  %1 = atomicrmw sub i16* %p, i16 %0 monotonic
185  ret void
186}
187
188define void @dec1(i32* nocapture %p) nounwind ssp {
189entry:
190; CHECK-LABEL: dec1:
191; CHECK: decl
192  %0 = atomicrmw sub i32* %p, i32 1 monotonic
193  ret void
194}
195
196define void @sub5(i32* nocapture %p) nounwind ssp {
197entry:
198; CHECK-LABEL: sub5:
199; CHECK: subl $2
200  %0 = atomicrmw sub i32* %p, i32 2 monotonic
201  ret void
202}
203