[X86] Make `(shift X (xor/sub N-1, Y))` -> `(shift X, (not Y))` check for one use.
authorNoah Goldstein <goldstein.w.n@gmail.com>
Wed, 1 Mar 2023 04:21:53 +0000 (22:21 -0600)
committerNoah Goldstein <goldstein.w.n@gmail.com>
Wed, 1 Mar 2023 05:25:16 +0000 (23:25 -0600)
commit05ca9ebc0433b4e19fc67c1dd023414bc6357f09
tree3e0864f3b886874bf21d0111966614498c0f8712
parent4a23031fac1a58f6cf05d07f915633930532eafa
[X86] Make `(shift X (xor/sub N-1, Y))` -> `(shift X, (not Y))` check for one use.

`(xor/sub N-1, Y)` -> `(not Y)` is minorly preferable (especially for
`(sub N-1, Y)` where it saves an instruction), but isn't worth
potentially creating an extra instruction for.

So, only do the transformation if `(xor/sub N-1, Y)` has one use.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D144985
llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
llvm/test/CodeGen/X86/pr61038.ll