[AArch64] Enhance bit-field-positioning op matcher to see through 'any_extend' for...
authorMingming Liu <mingmingl@google.com>
Sat, 15 Oct 2022 18:50:56 +0000 (11:50 -0700)
committerMingming Liu <mingmingl@google.com>
Tue, 18 Oct 2022 16:07:14 +0000 (09:07 -0700)
commit34d18fd241abafdf0436cbceebdeff2ecf685ae2
tree4bf9c7b76ecd170a3cd31634399aa578775933c4
parent615af94dc20cb71d537858d30cf53549a6f063fc
[AArch64] Enhance bit-field-positioning op matcher to see through 'any_extend' for pattern 'and(any_extend(shl(val, N)), shifted-mask)'

Before this patch (and refactor patch D135843), isBitfieldPositioningOp won't handle "and(any_extend(shl(val, N), shifted-mask)" (bail out if AND op is not SHL)

After this patch, isBitfieldPositioningOp will see through "any_extend" to find "shl" to find possible bit-field-positioning nodes.

https://gcc.godbolt.org/z/3ncGKbGW6 is a four-liner LLVM IR that could be optimized to UBFIZ (see added test case test_and_extended_shift_with_imm in llvm/test/CodeGen/AArch64/bitfield-insert.ll). One existing test case also improves.

Differential Revision: https://reviews.llvm.org/D135852
llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp
llvm/test/CodeGen/AArch64/bitfield-insert.ll