[PATCH] D47985: [CostModel] Replace ShuffleKind::SK_Alternate with ShuffleKind::SK_Select (PR33744)

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 9 11:48:38 PDT 2018


RKSimon created this revision.
RKSimon added reviewers: efriedma, delena, craig.topper, ABataev, dtemirbulatov, mkuper, spatel.
Herald added a reviewer: javed.absar.

As discussed on PR33744, this patch replaces ShuffleKind::SK_Alternate which requires shuffle masks to only match an alternating pattern from its 2 sources:

e.g. v4f32: <0,5,2,7> or <4,1,6,3>

This seems far too restrictive as most SIMD hardware which will implement it using a general blend/bit-select instruction (permitting elements from either source as long as they are inline):

e.g. v4f32: <0,5,2,7>, <4,1,6,3>, <0,1,6,7>, <4,1,2,3> etc.

This initial patch just updates the name and cost model shuffle mask analysis, later patch reviews will update SLP to better utilise this - it still limits itself to SK_Alternate patterns.

It also raised an interesting issue in that Identity shuffles are being matched by analysis to a mixture of SK_PermuteSingleSrc/SK_Alternate - shouldn't we just return cost = 0 for these cases?


Repository:
  rL LLVM

https://reviews.llvm.org/D47985

Files:
  include/llvm/Analysis/TargetTransformInfo.h
  include/llvm/CodeGen/BasicTTIImpl.h
  lib/Analysis/TargetTransformInfo.cpp
  lib/Target/ARM/ARMTargetTransformInfo.cpp
  lib/Target/X86/X86TargetTransformInfo.cpp
  lib/Transforms/Vectorize/SLPVectorizer.cpp
  test/Analysis/CostModel/X86/alternate-shuffle-cost.ll
  test/Analysis/CostModel/X86/reduction.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47985.150633.patch
Type: text/x-patch
Size: 87299 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180609/a500c20e/attachment.bin>


More information about the llvm-commits mailing list