[PATCH] D148215: [SLP] Compute min/max scalar reduction costs using min/max intrinsics instead of expanded cmp+sel

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 13 04:39:43 PDT 2023


RKSimon created this revision.
RKSimon added reviewers: ABataev, fhahn, vdmitrie.
Herald added subscribers: vporpo, StephenFan, pengfei, hiraditya.
Herald added a project: All.
RKSimon requested review of this revision.
Herald added a subscriber: pcwang-thead.
Herald added a project: LLVM.

By default these will expand back to cmp/sel, but some targets (X86) has optimized costs for scalar integer min/max patterns which are lower than the default expansion (pre-SSE41 is particularly weak for vector min/max support).

I was considering updating all the LoopUtils minmax reduction helpers to work with the intrinsics directly (createMinMaxOp in particular), but I'm concerned that we don't guarantee minnum/maxnum handling on all backends. I could still do this for the integer cases at least?


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148215

Files:
  llvm/include/llvm/Transforms/Utils/LoopUtils.h
  llvm/lib/Transforms/Utils/LoopUtils.cpp
  llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
  llvm/test/Transforms/SLPVectorizer/X86/horizontal-minmax.ll
  llvm/test/Transforms/SLPVectorizer/X86/reorder_repeated_ops.ll
  llvm/test/Transforms/SLPVectorizer/X86/vectorize-reorder-reuse.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148215.513171.patch
Type: text/x-patch
Size: 33462 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230413/d2152cf3/attachment.bin>


More information about the llvm-commits mailing list