[all-commits] [llvm/llvm-project] cc8a34: [X86] Refactor movmsk(icmp_eq(and(x, c1), 0)) -> mov...

Simon Pilgrim via All-commits all-commits at lists.llvm.org
Thu Mar 23 10:50:12 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cc8a34b11b0cff9c28780401a61d1cfb9a0f8b36
  Author: Simon Pilgrim <llvm-dev at redking.me.uk>
  Date:   2023-03-23 (Thu, 23 Mar 2023)

  Changed paths:
    M llvm/lib/Target/X86/X86ISelLowering.cpp
    M llvm/test/CodeGen/X86/vector-reduce-or-cmp.ll

  Log Message:
  [X86] Refactor movmsk(icmp_eq(and(x,c1),0)) -> movmsk(not(shl(x,c2))) fold to use KnownBits

We don't need an explicit AND mask, we can use KnownBits to determine if each element has (the same) single non-zero bit and shift that into the msb/signbit for MOVMSK to access directly.

More information about the All-commits mailing list