Skip to content

Commit 5b3bf4b

Browse files
committed
Pre-commit tests (NFC)
1 parent 41a08e7 commit 5b3bf4b

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-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+
}

llvm/test/CodeGen/AArch64/cmp-select-sign.ll

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,4 +262,19 @@ define <4 x i65> @sign_4xi65(<4 x i65> %a) {
262262
ret <4 x i65> %res
263263
}
264264

265+
define i32 @or_neg(i32 %x, i32 %y) {
266+
; CHECK-LABEL: or_neg:
267+
; CHECK: // %bb.0:
268+
; CHECK-NEXT: orr w8, w0, #0x1
269+
; CHECK-NEXT: neg w8, w8
270+
; CHECK-NEXT: cmp w8, w1
271+
; CHECK-NEXT: cset w0, gt
272+
; CHECK-NEXT: ret
273+
%3 = or i32 %x, 1
274+
%4 = sub nsw i32 0, %3
275+
%5 = icmp sgt i32 %4, %y
276+
%6 = zext i1 %5 to i32
277+
ret i32 %6
278+
}
279+
265280
declare void @use_4xi1(<4 x i1>)

0 commit comments

Comments
 (0)