[all-commits] [llvm/llvm-project] 6efe64: [x86] add test for vector signbit mask fold (PR525...

RotateRight via All-commits all-commits at lists.llvm.org
Mon Nov 15 08:11:20 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6efe64cf9f11b41f4b8b5b882f3402e5d32ba61e
      https://github.com/llvm/llvm-project/commit/6efe64cf9f11b41f4b8b5b882f3402e5d32ba61e
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2021-11-15 (Mon, 15 Nov 2021)

  Changed paths:
    M llvm/test/CodeGen/X86/vector-pcmp.ll

  Log Message:
  -----------
  [x86] add test for vector signbit mask fold (PR52504); NFC

This goes with D113603 -
which was reverted because it could crash on this and similar examples.


  Commit: 3d01507c2dec61121a1efcc84d3a2328ffc651cd
      https://github.com/llvm/llvm-project/commit/3d01507c2dec61121a1efcc84d3a2328ffc651cd
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2021-11-15 (Mon, 15 Nov 2021)

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

  Log Message:
  -----------
  [x86] fold vector (X > -1) & Y to shift+andn (2nd try)

The first try at this patch ( bf5748a1af0d ) was reverted ( 5be64d416481 )
because it could crash. The cause of that problem was failing to account
for the optional peek-through-bitcast in the enclosing function.

This version of the patch adds a clause to avoid the fold in case of
bitcasts because it is unlikely to be profitable in that scenario.

A test case based on https://llvm.org/PR52504 was added to make sure
we don't have that problem again.

Original commit message:

and (pcmpgt X, -1), Y --> pandn (vsrai X, BitWidth-1), Y

This avoids the -1 constant vector in favor of an arithmetic shift
instruction if it exists (the ISA is still not complete after all
these years...).

We catch this pattern late in combining by matching PCMPGT, so it
should not interfere with more general folds.

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


Compare: https://github.com/llvm/llvm-project/compare/5c7255fe3a85...3d01507c2dec


More information about the All-commits mailing list