[PATCH] D121147: [x86] try harder to use shift instead of test if it can save some immediate bytes
Matthias Braun via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 10 10:40:31 PST 2022
MatzeB added inline comments.
================
Comment at: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:5617
// Check if we can replace AND+IMM64 with a shift. This is possible for
// masks like 0xFF000000 or 0x00FFFFFF and if we care only about the zero
----------------
Guess this is no longer matching just IMM64
================
Comment at: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:5622
+ // TODO: Extend this to handle i32.
+ if (N0.getOperand(0).hasOneUse() && CmpVT == MVT::i64 &&
+ !isInt<8>(Mask) && onlyUsesZeroFlag(SDValue(Node, 0))) {
----------------
I think the `hasOneUse()` check makes sense for the cases where you turning a `testl xx, IMM32` into a shift. However for the IMM64 case we save a whole `movabsq` instruction so even if we end up with an extra COPY its a good deal.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D121147/new/
https://reviews.llvm.org/D121147
More information about the llvm-commits
mailing list