[PATCH] D45834: [TTI] Add a hook to TTI for choosing scalarized shuffle-reduction sequence for reduction idiom

Farhana Aleen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 19 12:08:47 PDT 2018


FarhanaAleen created this revision.
FarhanaAleen added a reviewer: RKSimon.

This patch adds a hook to TTI for choosing scalarized shuffle-reduction as opposed to vectorized shuffle-reduction sequence for reduction idiom.

Allows generation:

  %0 = extractelement <4 x float> %bin.rdx, i32 0
  %1 = extractelement <4 x float> %bin.rdx, i32 1
  %res = fadd fast float %0, %1

Instead of

  %rdx.shuf1 = shufflevector <4 x float> %bin.rdx, <4 x float> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>
  %bin.rdx2 = fadd fast <4 x float> %bin.rdx, %rdx.shuf1
  %res = extractelement <4 x float> %bin.rdx2, i32 0

Hi Simon,

This patch reflects your suggestion on https://reviews.llvm.org/D45393


https://reviews.llvm.org/D45834

Files:
  include/llvm/Analysis/TargetTransformInfo.h
  include/llvm/Analysis/TargetTransformInfoImpl.h
  include/llvm/Transforms/Utils/LoopUtils.h
  lib/Analysis/TargetTransformInfo.cpp
  lib/Transforms/Utils/LoopUtils.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45834.143147.patch
Type: text/x-patch
Size: 8792 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180419/e09aaabf/attachment.bin>


More information about the llvm-commits mailing list