[AArch64]Enhance 'isBitfieldPositioningOp' to find pattern (shl(and(val,mask), N).
authorMingming Liu <mingmingl@google.com>
Fri, 14 Oct 2022 22:26:04 +0000 (15:26 -0700)
committerMingming Liu <mingmingl@google.com>
Mon, 17 Oct 2022 16:01:29 +0000 (09:01 -0700)
commitdb0286a09626a3a29ceacbe95a1a05004f62242c
tree98acc748400a92018f7abe63ab907ebb6312ef41
parent970e1ea01aa0dce4f606eee1610c92b8b838f303
[AArch64]Enhance 'isBitfieldPositioningOp' to find pattern (shl(and(val,mask), N).

Before this patch (and D135844)

- Given DAG node shl(op, N), isBitfieldPositioningOp uses (optionally shifted [1] ) op as the Src (least significant bits of Src are inserted into DstLSB of Dst node).

After this patch

- If op is and(val, mask), isBitfieldPositioningOp tries to see through and and find if val is a simpler source than op.

It helps in a similar (probably symmetric) way how isSeveralBitsExtractOpFromShr [2] optimizes isBitfieldExtractOpFromShr

Existing test cases are improved without regressions.

[1] https://github.com/llvm/llvm-project/blob/cbd8464595220b5ea76c70ac9965d84970c4b712/llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp#L2546
[2] https://github.com/llvm/llvm-project/blob/cbd8464595220b5ea76c70ac9965d84970c4b712/llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp#L2057

Differential Revision: https://reviews.llvm.org/D135850
llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp
llvm/test/CodeGen/AArch64/arm64-indexed-vector-ldst.ll
llvm/test/CodeGen/AArch64/arm64-neon-copy.ll
llvm/test/CodeGen/AArch64/arm64-nvcast.ll
llvm/test/CodeGen/AArch64/pr58350.ll
llvm/test/CodeGen/AArch64/vec_uaddo.ll
llvm/test/CodeGen/AArch64/vec_umulo.ll