@@ -468,6 +468,21 @@ entry:
468468 ret i32 %sel
469469}
470470
471+ define i32 @selor32_2 (i32 %num , i32 %x ) {
472+ ; CHECK-LABEL: selor32_2:
473+ ; CHECK: // %bb.0: // %entry
474+ ; CHECK-NEXT: and w8, w0, #0xff00
475+ ; CHECK-NEXT: cmp w1, #0
476+ ; CHECK-NEXT: orr w9, w8, #0x2
477+ ; CHECK-NEXT: csel w0, w9, w8, ne
478+ ; CHECK-NEXT: ret
479+ entry:
480+ %and = and i32 %num , 65280
481+ %tobool.not = icmp ne i32 %x , 0
482+ %or = or disjoint i32 %and , 2
483+ %sel = select i1 %tobool.not , i32 %or , i32 %and
484+ ret i32 %sel
485+ }
471486
472487define i64 @selor64 (i64 %num , i64 %x ) {
473488; CHECK-LABEL: selor64:
@@ -484,3 +499,18 @@ entry:
484499 %sel = select i1 %tobool.not , i64 %or , i64 %and
485500 ret i64 %sel
486501}
502+
503+ ; Same as above with disjoint but without knowing haveNoCommonBitsSet.
504+ define i64 @selor64_disjoint (i64 %num , i64 %x ) {
505+ ; CHECK-LABEL: selor64_disjoint:
506+ ; CHECK: // %bb.0: // %entry
507+ ; CHECK-NEXT: orr x8, x0, #0x1
508+ ; CHECK-NEXT: cmp x1, #0
509+ ; CHECK-NEXT: csel x0, x8, x0, ne
510+ ; CHECK-NEXT: ret
511+ entry:
512+ %tobool.not = icmp ne i64 %x , 0
513+ %or = or disjoint i64 %num , 1
514+ %sel = select i1 %tobool.not , i64 %or , i64 %num
515+ ret i64 %sel
516+ }
0 commit comments