Skip to content

Commit d187dfe

Browse files
committed
[AArch64] Add some tests for addLikeOr with csinc. NFC
1 parent 3eeed79 commit d187dfe

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

llvm/test/CodeGen/AArch64/arm64-csel.ll

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,3 +420,67 @@ entry:
420420
ret i64 %add
421421
}
422422

423+
define i32 @or(i32 %num, i32 %x) {
424+
; CHECK-LABEL: or:
425+
; CHECK: // %bb.0: // %entry
426+
; CHECK-NEXT: cmp w1, #0
427+
; CHECK-NEXT: and w8, w0, #0xff00
428+
; CHECK-NEXT: cset w9, ne
429+
; CHECK-NEXT: orr w0, w8, w9
430+
; CHECK-NEXT: ret
431+
entry:
432+
%and = and i32 %num, 65280
433+
%tobool.not = icmp ne i32 %x, 0
434+
%cond = zext i1 %tobool.not to i32
435+
%or = or disjoint i32 %and, %cond
436+
ret i32 %or
437+
}
438+
439+
define i64 @or64(i64 %num, i64 %x) {
440+
; CHECK-LABEL: or64:
441+
; CHECK: // %bb.0: // %entry
442+
; CHECK-NEXT: cmp x1, #0
443+
; CHECK-NEXT: and x8, x0, #0xff00
444+
; CHECK-NEXT: cset w9, ne
445+
; CHECK-NEXT: orr x0, x8, x9
446+
; CHECK-NEXT: ret
447+
entry:
448+
%and = and i64 %num, 65280
449+
%tobool.not = icmp ne i64 %x, 0
450+
%conv = zext i1 %tobool.not to i64
451+
%or = or disjoint i64 %and, %conv
452+
ret i64 %or
453+
}
454+
455+
define i32 @selor32(i32 %num, i32 %x) {
456+
; CHECK-LABEL: selor32:
457+
; CHECK: // %bb.0: // %entry
458+
; CHECK-NEXT: and w8, w0, #0xff00
459+
; CHECK-NEXT: cmp w1, #0
460+
; CHECK-NEXT: orr w9, w8, #0x1
461+
; CHECK-NEXT: csel w0, w9, w8, ne
462+
; CHECK-NEXT: ret
463+
entry:
464+
%and = and i32 %num, 65280
465+
%tobool.not = icmp ne i32 %x, 0
466+
%or = or disjoint i32 %and, 1
467+
%sel = select i1 %tobool.not, i32 %or, i32 %and
468+
ret i32 %sel
469+
}
470+
471+
472+
define i64 @selor64(i64 %num, i64 %x) {
473+
; CHECK-LABEL: selor64:
474+
; CHECK: // %bb.0: // %entry
475+
; CHECK-NEXT: and x8, x0, #0xff00
476+
; CHECK-NEXT: cmp x1, #0
477+
; CHECK-NEXT: orr x9, x8, #0x1
478+
; CHECK-NEXT: csel x0, x9, x8, ne
479+
; CHECK-NEXT: ret
480+
entry:
481+
%and = and i64 %num, 65280
482+
%tobool.not = icmp ne i64 %x, 0
483+
%or = or disjoint i64 %and, 1
484+
%sel = select i1 %tobool.not, i64 %or, i64 %and
485+
ret i64 %sel
486+
}

0 commit comments

Comments
 (0)