[PATCH] D145468: [X86] Optimize (and (srl X 30) 2)

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 7 02:53:33 PST 2023


RKSimon added a comment.

I'm worried that this is very specific code for something I think we might be able to do with more generic folds (and possibly a X86ISelDAGToDAG tweak).



================
Comment at: llvm/test/CodeGen/X86/and-shift.ll:56
-; X64-NEXT:    movq %rdi, %rax
-; X64-NEXT:    shrq $30, %rax
-; X64-NEXT:    andl $2, %eax
----------------
We might be able to get SimplifyDemandedBits to recognise this as shrl $30, %eax (with suitable TLI checks)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145468



More information about the llvm-commits mailing list