[PATCH] D145866: [DAG] visitAND - fold (and (any_ext V), c) -> (zero_ext (and (trunc V), c)) if profitable.

Phoebe Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 12 05:40:12 PDT 2023


pengfei accepted this revision.
pengfei added a comment.
This revision is now accepted and ready to land.

X86 tests change looks good.



================
Comment at: llvm/test/CodeGen/X86/switch-phi-const.ll:95
+; CHECK-NEXT:    movzbl %dil, %eax
+; CHECK-NEXT:    leal -1(%rax), %ecx
 ; CHECK-NEXT:    cmpl $54, %ecx
----------------
RKSimon wrote:
> pengfei wrote:
> > This doesn't look efficient than `decl %ecx`.
> I agree but we always fold mov+dec to lea: https://simd.godbolt.org/z/vvzfe14oc
Thanks! I see, just notice we also saved a `movzbl %dil, %eax`. So it's indeed a win.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145866/new/

https://reviews.llvm.org/D145866



More information about the llvm-commits mailing list