Skip to content

Commit d04ae1b

Browse files
authored
[AArch64] Use DAG->isAddLike in add_and_or_is_add (#79563)
This allows it to work with disjoint or's as well as computing the known bits.
1 parent 6720e3a commit d04ae1b

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

llvm/lib/Target/AArch64/AArch64InstrInfo.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,7 @@ def add_and_or_is_add : PatFrags<(ops node:$lhs, node:$rhs),
899899
[(add node:$lhs, node:$rhs), (or node:$lhs, node:$rhs)],[{
900900
if (N->getOpcode() == ISD::ADD)
901901
return true;
902-
return CurDAG->haveNoCommonBitsSet(N->getOperand(0), N->getOperand(1));
902+
return CurDAG->isADDLike(SDValue(N,0));
903903
}]> {
904904
let GISelPredicateCode = [{
905905
// Only handle G_ADD for now. FIXME. build capability to compute whether

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,9 +500,8 @@ entry:
500500
define i64 @selor64_disjoint(i64 %num, i64 %x) {
501501
; CHECK-LABEL: selor64_disjoint:
502502
; CHECK: // %bb.0: // %entry
503-
; CHECK-NEXT: orr x8, x0, #0x1
504503
; CHECK-NEXT: cmp x1, #0
505-
; CHECK-NEXT: csel x0, x8, x0, ne
504+
; CHECK-NEXT: cinc x0, x0, ne
506505
; CHECK-NEXT: ret
507506
entry:
508507
%tobool.not = icmp ne i64 %x, 0

llvm/test/CodeGen/AArch64/shift-accumulate.ll

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,3 +174,13 @@ define <2 x i64> @usra_with_movi_v2i64(<16 x i8> %0, <16 x i8> %1) {
174174
%7 = or <2 x i64> %6, %5
175175
ret <2 x i64> %7
176176
}
177+
178+
define <4 x i16> @usra_v4i16_disjointor(<4 x i16> %a) {
179+
; CHECK-LABEL: usra_v4i16_disjointor:
180+
; CHECK: // %bb.0:
181+
; CHECK-NEXT: usra v0.4h, v0.4h, #7
182+
; CHECK-NEXT: ret
183+
%s = lshr <4 x i16> %a, <i16 7, i16 7, i16 7, i16 7>
184+
%o = or disjoint <4 x i16> %s, %a
185+
ret <4 x i16> %o
186+
}

0 commit comments

Comments
 (0)