[all-commits] [llvm/llvm-project] 26543f: [x86] improve codegen for bit-masked vector compar...

RotateRight via All-commits all-commits at lists.llvm.org
Fri Jul 3 14:33:40 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 26543f1c0cee8aad30d9b901e7dcf7282f8a30e0
      https://github.com/llvm/llvm-project/commit/26543f1c0cee8aad30d9b901e7dcf7282f8a30e0
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2020-07-03 (Fri, 03 Jul 2020)

  Changed paths:
    M llvm/lib/Target/X86/X86ISelLowering.cpp
    M llvm/test/CodeGen/X86/vselect-pcmp.ll

  Log Message:
  -----------
  [x86] improve codegen for bit-masked vector compare and select (PR46531)

We canonicalize patterns like:
  %s = lshr i32 %a0, 1
  %t = trunc i32 %s to i1

to:
  %a = and i32 %a0, 2
  %c = icmp ne i32 %a, 0

...in IR, but the bit-shifting original sequence may be better for x86 vector codegen.

I tried several variants of the transform, and it's tricky to not induce regressions.
In particular, I did not find a way to cleanly handle non-splat constants, so I've left
that as a TODO item here (currently negative tests for those are included). AVX512
resulted in some diffs, but didn't look meaningful, so I left that out too. Some of
the 256-bit AVX1 diffs are questionable, but close enough that they are probably
insignificant.

Differential Revision: https://reviews.llvm.org/D83073.




More information about the All-commits mailing list