From: David Green Date: Tue, 21 Jun 2022 15:07:01 +0000 (+0100) Subject: [AArch64] Move add_and_or_is_add pattern. NFC X-Git-Tag: upstream/15.0.7~4034 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=939c57097ecd7ba7760d5c011a5034df17b5a943;p=platform%2Fupstream%2Fllvm.git [AArch64] Move add_and_or_is_add pattern. NFC This just moves the add_and_or_is_add further up in the file, so that it can be shared with SVE as in D128159. --- diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.td b/llvm/lib/Target/AArch64/AArch64InstrInfo.td index c6d9029..374b2f1 100644 --- a/llvm/lib/Target/AArch64/AArch64InstrInfo.td +++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.td @@ -734,6 +734,22 @@ def AArch64tbl : SDNode<"AArch64ISD::TBL", SDT_AArch64TBL>; def AArch64mrs : SDNode<"AArch64ISD::MRS", SDTypeProfile<1, 1, [SDTCisVT<0, i64>, SDTCisVT<1, i32>]>, [SDNPHasChain, SDNPOutGlue]>; + +// Match add node and also treat an 'or' node is as an 'add' if the or'ed operands +// have no common bits. +def add_and_or_is_add : PatFrags<(ops node:$lhs, node:$rhs), + [(add node:$lhs, node:$rhs), (or node:$lhs, node:$rhs)],[{ + if (N->getOpcode() == ISD::ADD) + return true; + return CurDAG->haveNoCommonBitsSet(N->getOperand(0), N->getOperand(1)); +}]> { + let GISelPredicateCode = [{ + // Only handle G_ADD for now. FIXME. build capability to compute whether + // operands of G_OR have common bits set or not. + return MI.getOpcode() == TargetOpcode::G_ADD; + }]; +} + //===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===// @@ -6473,22 +6489,6 @@ def : Pat<(int_aarch64_neon_sqdmulls_scalar (i32 FPR32:$Rn), VectorIndexS:$idx)), (SQDMULLv1i64_indexed FPR32:$Rn, V128:$Vm, VectorIndexS:$idx)>; -// Match add node and also treat an 'or' node is as an 'add' if the or'ed operands -// have no common bits. -def add_and_or_is_add : PatFrags<(ops node:$lhs, node:$rhs), - [(add node:$lhs, node:$rhs), (or node:$lhs, node:$rhs)],[{ - if (N->getOpcode() == ISD::ADD) - return true; - return CurDAG->haveNoCommonBitsSet(N->getOperand(0), N->getOperand(1)); -}]> { - let GISelPredicateCode = [{ - // Only handle G_ADD for now. FIXME. build capability to compute whether - // operands of G_OR have common bits set or not. - return MI.getOpcode() == TargetOpcode::G_ADD; - }]; -} - - //---------------------------------------------------------------------------- // AdvSIMD scalar shift instructions //----------------------------------------------------------------------------