[X86] Replace (31/63 -/^ X) with (NOT X) and ignore (32/64 ^ X) when computing shift...
authorNoah Goldstein <goldstein.w.n@gmail.com>
Fri, 13 Jan 2023 02:24:43 +0000 (18:24 -0800)
committerPhoebe Wang <phoebe.wang@intel.com>
Fri, 13 Jan 2023 04:53:57 +0000 (20:53 -0800)
commit4916523053d791e17d1cc2135f7a14de16ed1dcc
tree5a0115b07454b8ebdee58638b4bf15d94a950646
parent371884865393141b0216b6479260b6feef5915ee
[X86] Replace (31/63 -/^ X) with (NOT X) and ignore (32/64 ^ X) when computing shift count

Shift count is masked by hardware so these peepholes just extend
common patterns for NOT to the lower bits of shift count.

As well (32/64 ^ X) is masked off by the shift so can be safely
ignored.

Reviewed By: pengfei, lebedev.ri

Differential Revision: https://reviews.llvm.org/D140087
llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
llvm/test/CodeGen/X86/legalize-shift-64.ll
llvm/test/CodeGen/X86/not-shift.ll