Skip to content

Commit f21dd70

Browse files
committed
[AArch64] Add some additional tests for conditions of branches. NFC
1 parent 64b9188 commit f21dd70

File tree

1 file changed

+260
-0
lines changed

1 file changed

+260
-0
lines changed
Lines changed: 260 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,260 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2+
; RUN: llc -mtriple=aarch64-none-none-eabi -verify-machineinstrs %s -o - | FileCheck %s
3+
4+
declare void @dummy()
5+
6+
define i32 @and_eq_ne_ult(i32 %s0, i32 %s1, i32 %s2, i32 %s3, i32 %s4, i32 %s5, i32* %p) {
7+
; CHECK-LABEL: and_eq_ne_ult:
8+
; CHECK: // %bb.0: // %entry
9+
; CHECK-NEXT: cmp w0, w1
10+
; CHECK-NEXT: ccmp w2, w3, #4, eq
11+
; CHECK-NEXT: b.ne .LBB0_3
12+
; CHECK-NEXT: // %bb.1: // %entry
13+
; CHECK-NEXT: cmp w4, w5
14+
; CHECK-NEXT: b.lo .LBB0_3
15+
; CHECK-NEXT: // %bb.2:
16+
; CHECK-NEXT: mov w0, wzr
17+
; CHECK-NEXT: ret
18+
; CHECK-NEXT: .LBB0_3: // %if
19+
; CHECK-NEXT: mov w0, #1
20+
; CHECK-NEXT: str w0, [x6]
21+
; CHECK-NEXT: ret
22+
entry:
23+
%c0 = icmp eq i32 %s0, %s1
24+
%c1 = icmp ne i32 %s2, %s3
25+
%a = and i1 %c0, %c1
26+
%c2 = icmp ult i32 %s4, %s5
27+
%o = or i1 %a, %c2
28+
br i1 %o, label %if, label %else
29+
30+
if:
31+
store i32 1, i32* %p
32+
ret i32 1
33+
34+
else:
35+
ret i32 0
36+
}
37+
38+
define i32 @and_ne_ult_ule(i32 %s0, i32 %s1, i32 %s2, i32 %s3, i32 %s4, i32 %s5, i32* %p) {
39+
; CHECK-LABEL: and_ne_ult_ule:
40+
; CHECK: // %bb.0: // %entry
41+
; CHECK-NEXT: cmp w0, w1
42+
; CHECK-NEXT: ccmp w2, w3, #2, ne
43+
; CHECK-NEXT: b.lo .LBB1_3
44+
; CHECK-NEXT: // %bb.1: // %entry
45+
; CHECK-NEXT: cmp w4, w5
46+
; CHECK-NEXT: b.ls .LBB1_3
47+
; CHECK-NEXT: // %bb.2:
48+
; CHECK-NEXT: mov w0, wzr
49+
; CHECK-NEXT: ret
50+
; CHECK-NEXT: .LBB1_3: // %if
51+
; CHECK-NEXT: mov w0, #1
52+
; CHECK-NEXT: str w0, [x6]
53+
; CHECK-NEXT: ret
54+
entry:
55+
%c0 = icmp ne i32 %s0, %s1
56+
%c1 = icmp ult i32 %s2, %s3
57+
%a = and i1 %c0, %c1
58+
%c2 = icmp ule i32 %s4, %s5
59+
%o = or i1 %a, %c2
60+
br i1 %o, label %if, label %else
61+
62+
if:
63+
store i32 1, i32* %p
64+
ret i32 1
65+
66+
else:
67+
ret i32 0
68+
}
69+
70+
define i32 @and_ult_ule_ugt(i32 %s0, i32 %s1, i32 %s2, i32 %s3, i32 %s4, i32 %s5, i32* %p) {
71+
; CHECK-LABEL: and_ult_ule_ugt:
72+
; CHECK: // %bb.0: // %entry
73+
; CHECK-NEXT: cmp w0, w1
74+
; CHECK-NEXT: ccmp w2, w3, #2, lo
75+
; CHECK-NEXT: b.ls .LBB2_3
76+
; CHECK-NEXT: // %bb.1: // %entry
77+
; CHECK-NEXT: cmp w4, w5
78+
; CHECK-NEXT: b.hi .LBB2_3
79+
; CHECK-NEXT: // %bb.2:
80+
; CHECK-NEXT: mov w0, wzr
81+
; CHECK-NEXT: ret
82+
; CHECK-NEXT: .LBB2_3: // %if
83+
; CHECK-NEXT: mov w0, #1
84+
; CHECK-NEXT: str w0, [x6]
85+
; CHECK-NEXT: ret
86+
entry:
87+
%c0 = icmp ult i32 %s0, %s1
88+
%c1 = icmp ule i32 %s2, %s3
89+
%a = and i1 %c0, %c1
90+
%c2 = icmp ugt i32 %s4, %s5
91+
%o = or i1 %a, %c2
92+
br i1 %o, label %if, label %else
93+
94+
if:
95+
store i32 1, i32* %p
96+
ret i32 1
97+
98+
else:
99+
ret i32 0
100+
}
101+
102+
define i32 @and_ule_ugt_uge(i32 %s0, i32 %s1, i32 %s2, i32 %s3, i32 %s4, i32 %s5, i32* %p) {
103+
; CHECK-LABEL: and_ule_ugt_uge:
104+
; CHECK: // %bb.0: // %entry
105+
; CHECK-NEXT: cmp w0, w1
106+
; CHECK-NEXT: ccmp w2, w3, #0, ls
107+
; CHECK-NEXT: b.hi .LBB3_3
108+
; CHECK-NEXT: // %bb.1: // %entry
109+
; CHECK-NEXT: cmp w4, w5
110+
; CHECK-NEXT: b.hs .LBB3_3
111+
; CHECK-NEXT: // %bb.2:
112+
; CHECK-NEXT: mov w0, wzr
113+
; CHECK-NEXT: ret
114+
; CHECK-NEXT: .LBB3_3: // %if
115+
; CHECK-NEXT: mov w0, #1
116+
; CHECK-NEXT: str w0, [x6]
117+
; CHECK-NEXT: ret
118+
entry:
119+
%c0 = icmp ule i32 %s0, %s1
120+
%c1 = icmp ugt i32 %s2, %s3
121+
%a = and i1 %c0, %c1
122+
%c2 = icmp uge i32 %s4, %s5
123+
%o = or i1 %a, %c2
124+
br i1 %o, label %if, label %else
125+
126+
if:
127+
store i32 1, i32* %p
128+
ret i32 1
129+
130+
else:
131+
ret i32 0
132+
}
133+
134+
define i32 @and_ugt_uge_slt(i32 %s0, i32 %s1, i32 %s2, i32 %s3, i32 %s4, i32 %s5, i32* %p) {
135+
; CHECK-LABEL: and_ugt_uge_slt:
136+
; CHECK: // %bb.0: // %entry
137+
; CHECK-NEXT: cmp w0, w1
138+
; CHECK-NEXT: ccmp w2, w3, #0, hi
139+
; CHECK-NEXT: b.hs .LBB4_3
140+
; CHECK-NEXT: // %bb.1: // %entry
141+
; CHECK-NEXT: cmp w4, w5
142+
; CHECK-NEXT: b.lt .LBB4_3
143+
; CHECK-NEXT: // %bb.2:
144+
; CHECK-NEXT: mov w0, wzr
145+
; CHECK-NEXT: ret
146+
; CHECK-NEXT: .LBB4_3: // %if
147+
; CHECK-NEXT: mov w0, #1
148+
; CHECK-NEXT: str w0, [x6]
149+
; CHECK-NEXT: ret
150+
entry:
151+
%c0 = icmp ugt i32 %s0, %s1
152+
%c1 = icmp uge i32 %s2, %s3
153+
%a = and i1 %c0, %c1
154+
%c2 = icmp slt i32 %s4, %s5
155+
%o = or i1 %a, %c2
156+
br i1 %o, label %if, label %else
157+
158+
if:
159+
store i32 1, i32* %p
160+
ret i32 1
161+
162+
else:
163+
ret i32 0
164+
}
165+
166+
define i32 @and_uge_slt_sle(i32 %s0, i32 %s1, i32 %s2, i32 %s3, i32 %s4, i32 %s5, i32* %p) {
167+
; CHECK-LABEL: and_uge_slt_sle:
168+
; CHECK: // %bb.0: // %entry
169+
; CHECK-NEXT: cmp w0, w1
170+
; CHECK-NEXT: ccmp w2, w3, #0, hs
171+
; CHECK-NEXT: b.lt .LBB5_3
172+
; CHECK-NEXT: // %bb.1: // %entry
173+
; CHECK-NEXT: cmp w4, w5
174+
; CHECK-NEXT: b.le .LBB5_3
175+
; CHECK-NEXT: // %bb.2:
176+
; CHECK-NEXT: mov w0, wzr
177+
; CHECK-NEXT: ret
178+
; CHECK-NEXT: .LBB5_3: // %if
179+
; CHECK-NEXT: mov w0, #1
180+
; CHECK-NEXT: str w0, [x6]
181+
; CHECK-NEXT: ret
182+
entry:
183+
%c0 = icmp uge i32 %s0, %s1
184+
%c1 = icmp slt i32 %s2, %s3
185+
%a = and i1 %c0, %c1
186+
%c2 = icmp sle i32 %s4, %s5
187+
%o = or i1 %a, %c2
188+
br i1 %o, label %if, label %else
189+
190+
if:
191+
store i32 1, i32* %p
192+
ret i32 1
193+
194+
else:
195+
ret i32 0
196+
}
197+
198+
define i32 @and_slt_sle_sgt(i32 %s0, i32 %s1, i32 %s2, i32 %s3, i32 %s4, i32 %s5, i32* %p) {
199+
; CHECK-LABEL: and_slt_sle_sgt:
200+
; CHECK: // %bb.0: // %entry
201+
; CHECK-NEXT: cmp w0, w1
202+
; CHECK-NEXT: ccmp w2, w3, #0, lt
203+
; CHECK-NEXT: b.le .LBB6_3
204+
; CHECK-NEXT: // %bb.1: // %entry
205+
; CHECK-NEXT: cmp w4, w5
206+
; CHECK-NEXT: b.gt .LBB6_3
207+
; CHECK-NEXT: // %bb.2:
208+
; CHECK-NEXT: mov w0, wzr
209+
; CHECK-NEXT: ret
210+
; CHECK-NEXT: .LBB6_3: // %if
211+
; CHECK-NEXT: mov w0, #1
212+
; CHECK-NEXT: str w0, [x6]
213+
; CHECK-NEXT: ret
214+
entry:
215+
%c0 = icmp slt i32 %s0, %s1
216+
%c1 = icmp sle i32 %s2, %s3
217+
%a = and i1 %c0, %c1
218+
%c2 = icmp sgt i32 %s4, %s5
219+
%o = or i1 %a, %c2
220+
br i1 %o, label %if, label %else
221+
222+
if:
223+
store i32 1, i32* %p
224+
ret i32 1
225+
226+
else:
227+
ret i32 0
228+
}
229+
230+
define i32 @and_sle_sgt_sge(i32 %s0, i32 %s1, i32 %s2, i32 %s3, i32 %s4, i32 %s5, i32* %p) {
231+
; CHECK-LABEL: and_sle_sgt_sge:
232+
; CHECK: // %bb.0: // %entry
233+
; CHECK-NEXT: cmp w0, w1
234+
; CHECK-NEXT: ccmp w2, w3, #4, le
235+
; CHECK-NEXT: b.gt .LBB7_3
236+
; CHECK-NEXT: // %bb.1: // %entry
237+
; CHECK-NEXT: cmp w4, w5
238+
; CHECK-NEXT: b.ge .LBB7_3
239+
; CHECK-NEXT: // %bb.2:
240+
; CHECK-NEXT: mov w0, wzr
241+
; CHECK-NEXT: ret
242+
; CHECK-NEXT: .LBB7_3: // %if
243+
; CHECK-NEXT: mov w0, #1
244+
; CHECK-NEXT: str w0, [x6]
245+
; CHECK-NEXT: ret
246+
entry:
247+
%c0 = icmp sle i32 %s0, %s1
248+
%c1 = icmp sgt i32 %s2, %s3
249+
%a = and i1 %c0, %c1
250+
%c2 = icmp sge i32 %s4, %s5
251+
%o = or i1 %a, %c2
252+
br i1 %o, label %if, label %else
253+
254+
if:
255+
store i32 1, i32* %p
256+
ret i32 1
257+
258+
else:
259+
ret i32 0
260+
}

0 commit comments

Comments
 (0)