[X86] Fix `(shift X, (xor Y, N-1))` -> `(shift X, (not Y))` by properly inserting...
authorNoah Goldstein <goldstein.w.n@gmail.com>
Tue, 28 Feb 2023 17:00:35 +0000 (11:00 -0600)
committerNoah Goldstein <goldstein.w.n@gmail.com>
Wed, 1 Mar 2023 05:25:09 +0000 (23:25 -0600)
commit4a23031fac1a58f6cf05d07f915633930532eafa
tree1e64881f97d554292c3b8d99c0780d3c32953235
parent65f68812d399930d4af587c7a2333e46f367c5a7
[X86] Fix `(shift X, (xor Y, N-1))` -> `(shift X, (not Y))` by properly inserting `not Y` into DAG. [#61038]

Previously not inserting the `-1` in `not Y` (`xor Y, -1`) into the
DAG. Not inserting `-1` as a DAG node comes up as a bug when doing
`(xor (shl 1, A), B)` -> `(btc A, B)`. `btc` requires `B` (dst) to be
a register.

Differential Revision: https://reviews.llvm.org/D144984
llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
llvm/test/CodeGen/X86/pr61038.ll [new file with mode: 0644]