[PATCH] D113603: [x86] fold vector (X > -1) & Y to shift+andn

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 10 12:50:09 PST 2021


spatel created this revision.
spatel added reviewers: RKSimon, pengfei, craig.topper, lebedev.ri.
Herald added subscribers: hiraditya, mcrosier.
spatel requested review of this revision.
Herald added a project: LLVM.

and (pcmpgt X, -1), Y --> pandn (sra X, BW-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.

The test diffs are against trunk. This should eliminate lumps in D113426 <https://reviews.llvm.org/D113426> (if we want to see the cumulative results, I can rebase on top of that).


https://reviews.llvm.org/D113603

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113603.386286.patch
Type: text/x-patch
Size: 16936 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211110/494e1a11/attachment.bin>


More information about the llvm-commits mailing list