[x86] try harder to use shift instead of test if it can save some immediate bytes
authorSanjay Patel <spatel@rotateright.com>
Thu, 17 Mar 2022 13:09:42 +0000 (09:09 -0400)
committerSanjay Patel <spatel@rotateright.com>
Thu, 17 Mar 2022 13:10:57 +0000 (09:10 -0400)
commit67e91510963a5307814aaf8463222635bddf1644
treee7347bd589cb6ccbabc2782c27b741c965274a3a
parent30de15e100ccb8a53f73f8c826902d67eced50ec
[x86] try harder to use shift instead of test if it can save some immediate bytes

We favor 'and' and 'test' in earlier phases of optimization,
and that's usually the better option, but we can save a few
instruction bytes by converting a mask constant to a shift here.

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