1 ; RUN: llc -O2 -march=bpfel -mattr=+alu32 < %s | FileCheck %s
13 ; int add(int a, int b)
20 ; return a + 0x7fffffff;
23 ; int sub(int a, int b)
30 ; return a - 0xffffffff;
33 ; int mul(int a, int b)
43 ; unsigned div(unsigned a, unsigned b)
48 ; unsigned div_i(unsigned a)
53 ; int or(int a, int b)
63 ; int xor(int a, int b)
73 ; int and(int a, int b)
83 ; int sll(int a, int b)
93 ; unsigned srl(unsigned a, unsigned b)
98 ; unsigned srl_i(unsigned a, unsigned b)
103 ; int sra(int a, int b)
108 ; int sra_i(int a, int b)
118 ; Function Attrs: norecurse nounwind readnone
119 define dso_local i32 @mov(i32 returned %a) local_unnamed_addr #0 {
122 ; CHECK: w{{[0-9]+}} = w{{[0-9]+}}
125 ; Function Attrs: norecurse nounwind readnone
126 define dso_local i32 @mov_ri() local_unnamed_addr #0 {
129 ; CHECK: w{{[0-9]+}} = 255
132 ; Function Attrs: norecurse nounwind readnone
133 define dso_local i32 @add(i32 %a, i32 %b) local_unnamed_addr #0 {
135 %add = add nsw i32 %b, %a
136 ; CHECK: w{{[0-9]+}} += w{{[0-9]+}}
140 ; Function Attrs: norecurse nounwind readnone
141 define dso_local i32 @add_i(i32 %a) local_unnamed_addr #0 {
143 %add = add nsw i32 %a, 2147483647
144 ; CHECK: w{{[0-9]+}} += 2147483647
148 ; Function Attrs: norecurse nounwind readnone
149 define dso_local i32 @sub(i32 %a, i32 %b) local_unnamed_addr #0 {
151 %sub = sub nsw i32 %a, %b
152 ; CHECK: w{{[0-9]+}} -= w{{[0-9]+}}
156 ; Function Attrs: norecurse nounwind readnone
157 define dso_local i32 @sub_i(i32 %a) local_unnamed_addr #0 {
160 ; CHECK: w{{[0-9]+}} += 1
164 ; Function Attrs: norecurse nounwind readnone
165 define dso_local i32 @mul(i32 %a, i32 %b) local_unnamed_addr #0 {
167 %mul = mul nsw i32 %b, %a
168 ; CHECK: w{{[0-9]+}} *= w{{[0-9]+}}
172 ; Function Attrs: norecurse nounwind readnone
173 define dso_local i32 @mul_i(i32 %a) local_unnamed_addr #0 {
175 %mul = mul nsw i32 %a, 15
176 ; CHECK: w{{[0-9]+}} *= 15
180 ; Function Attrs: norecurse nounwind readnone
181 define dso_local i32 @div(i32 %a, i32 %b) local_unnamed_addr #0 {
183 %div = udiv i32 %a, %b
184 ; CHECK: w{{[0-9]+}} /= w{{[0-9]+}}
188 ; Function Attrs: norecurse nounwind readnone
189 define dso_local i32 @div_i(i32 %a) local_unnamed_addr #0 {
191 %div = udiv i32 %a, 15
192 ; CHECK: w{{[0-9]+}} /= 15
196 ; Function Attrs: norecurse nounwind readnone
197 define dso_local i32 @or(i32 %a, i32 %b) local_unnamed_addr #0 {
200 ; CHECK: w{{[0-9]+}} |= w{{[0-9]+}}
204 ; Function Attrs: norecurse nounwind readnone
205 define dso_local i32 @or_i(i32 %a) local_unnamed_addr #0 {
208 ; CHECK: w{{[0-9]+}} |= 255
212 ; Function Attrs: norecurse nounwind readnone
213 define dso_local i32 @xor(i32 %a, i32 %b) local_unnamed_addr #0 {
215 %xor = xor i32 %b, %a
216 ; CHECK: w{{[0-9]+}} ^= w{{[0-9]+}}
220 ; Function Attrs: norecurse nounwind readnone
221 define dso_local i32 @xor_i(i32 %a) local_unnamed_addr #0 {
223 %xor = xor i32 %a, 4095
224 ; CHECK: w{{[0-9]+}} ^= 4095
228 ; Function Attrs: norecurse nounwind readnone
229 define dso_local i32 @and(i32 %a, i32 %b) local_unnamed_addr #0 {
231 %and = and i32 %b, %a
232 ; CHECK: w{{[0-9]+}} &= w{{[0-9]+}}
236 ; Function Attrs: norecurse nounwind readnone
237 define dso_local i32 @and_i(i32 %a) local_unnamed_addr #0 {
239 %and = and i32 %a, 65535
240 ; CHECK: w{{[0-9]+}} &= 65535
244 ; Function Attrs: norecurse nounwind readnone
245 define dso_local i32 @sll(i32 %a, i32 %b) local_unnamed_addr #0 {
247 %shl = shl i32 %a, %b
248 ; CHECK: w{{[0-9]+}} <<= w{{[0-9]+}}
252 ; Function Attrs: norecurse nounwind readnone
253 define dso_local i32 @sll_i(i32 %a) local_unnamed_addr #0 {
255 %shl = shl i32 %a, 17
256 ; CHECK: w{{[0-9]+}} <<= 17
260 ; Function Attrs: norecurse nounwind readnone
261 define dso_local i32 @srl(i32 %a, i32 %b) local_unnamed_addr #0 {
263 %shr = lshr i32 %a, %b
264 ; CHECK: w{{[0-9]+}} >>= w{{[0-9]+}}
268 ; Function Attrs: norecurse nounwind readnone
269 define dso_local i32 @srl_i(i32 %a, i32 %b) local_unnamed_addr #0 {
271 %shr = lshr i32 %a, 31
272 ; CHECK: w{{[0-9]+}} >>= 31
276 ; Function Attrs: norecurse nounwind readnone
277 define dso_local i32 @sra(i32 %a, i32 %b) local_unnamed_addr #0 {
279 %shr = ashr i32 %a, %b
280 ; CHECK: w{{[0-9]+}} s>>= w{{[0-9]+}}
284 ; Function Attrs: norecurse nounwind readnone
285 define dso_local i32 @sra_i(i32 %a, i32 %b) local_unnamed_addr #0 {
287 %shr = ashr i32 %a, 7
288 ; CHECK: w{{[0-9]+}} s>>= 7
292 ; Function Attrs: norecurse nounwind readnone
293 define dso_local i32 @neg(i32 %a) local_unnamed_addr #0 {
295 %sub = sub nsw i32 0, %a
296 ; CHECK: w{{[0-9]+}} = -w{{[0-9]+}}