Skip to content

Commit 9ba051d

Browse files
committed
Pre-commit tests (NFC)
1 parent 5ece35d commit 9ba051d

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

llvm/test/CodeGen/AArch64/cmp-chains.ll

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,3 +258,35 @@ define i32 @neg_range_int(i32 %a, i32 %b, i32 %c) {
258258
ret i32 %retval.0
259259
}
260260

261+
; (b > -3 || a < -(c | 1))
262+
define i32 @neg_range_int_cmn(i32 %a, i32 %b, i32 %c) {
263+
; SDISEL-LABEL: neg_range_int_cmn:
264+
; SDISEL: // %bb.0:
265+
; SDISEL-NEXT: orr w8, w2, #0x1
266+
; SDISEL-NEXT: neg w8, w8
267+
; SDISEL-NEXT: cmp w8, w0
268+
; SDISEL-NEXT: ccmn w1, #3, #0, le
269+
; SDISEL-NEXT: csel w0, w1, w0, gt
270+
; SDISEL-NEXT: ret
271+
;
272+
; GISEL-LABEL: neg_range_int_cmn:
273+
; GISEL: // %bb.0:
274+
; GISEL-NEXT: orr w8, w2, #0x1
275+
; GISEL-NEXT: cmn w1, #3
276+
; GISEL-NEXT: neg w8, w8
277+
; GISEL-NEXT: cset w9, gt
278+
; GISEL-NEXT: cmp w8, w0
279+
; GISEL-NEXT: cset w8, gt
280+
; GISEL-NEXT: orr w8, w9, w8
281+
; GISEL-NEXT: and w8, w8, #0x1
282+
; GISEL-NEXT: tst w8, #0x1
283+
; GISEL-NEXT: csel w0, w1, w0, ne
284+
; GISEL-NEXT: ret
285+
%or = or i32 %c, 1
286+
%sub = sub nsw i32 0, %or
287+
%cmp = icmp sgt i32 %b, -3
288+
%cmp1 = icmp sgt i32 %sub, %a
289+
%1 = select i1 %cmp, i1 true, i1 %cmp1
290+
%ret = select i1 %1, i32 %b, i32 %a
291+
ret i32 %ret
292+
}

0 commit comments

Comments
 (0)