[PATCH] D12202: Add Support for Small Size Reductions

Matthew Simpson via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 20 11:42:19 PDT 2015


mssimpso created this revision.
mssimpso added reviewers: jmolloy, hfinkel.
mssimpso added subscribers: llvm-commits, mcrosier.
Herald added a subscriber: aemerson.

Unlike scalar operations, we can perform vector operations on
element types that are smaller than the native integer types. We
type-promote scalar operations if they are smaller than a native
type (e.g., i8 arithmetic is promoted to i32 arithmetic on Arm
targets). This patch detects and removes type-promotions within the
reduction detection framework, enabling the vectorization of small
size reductions.

In the legality phase, we look through the ANDs and extensions that
InstCombine creates during promotion, keeping track of the smaller
type. In the profitability phase, we use the smaller type and
ignore the ANDs and extensions in the cost model. Finally, in the
code generation phase, we truncate the result of the reduction to
allow InstCombine to rewrite the entire expression in the smaller
type.

This fixes PR21369.

http://reviews.llvm.org/D12202

Files:
  include/llvm/Transforms/Utils/LoopUtils.h
  lib/Transforms/Utils/LoopUtils.cpp
  lib/Transforms/Vectorize/LoopVectorize.cpp
  test/Transforms/LoopVectorize/reduction-small-size.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12202.32717.patch
Type: text/x-patch
Size: 23693 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150820/0f0484f6/attachment.bin>


More information about the llvm-commits mailing list