llvm-6502/test/Transforms/LoopVectorize
Arnold Schwaighofer a47aa4b4ef LoopVectorize: Support conditional stores by scalarizing
The vectorizer takes a loop like this and widens all instructions except for the
store. The stores are scalarized/unrolled and hidden behind an "if" block.

  for (i = 0; i < 128; ++i) {
    if (a[i] < 10)
      a[i] += val;
  }

  for (i = 0; i < 128; i+=2) {
    v = a[i:i+1];
    v0 = (extract v, 0) + 10;
    v1 = (extract v, 1) + 10;
    if (v0 < 10)
      a[i] = v0;
    if (v1 < 10)
      a[i] = v1;
  }

The vectorizer relies on subsequent optimizations to sink instructions into the
conditional block where they are anticipated.

The flag "vectorize-num-stores-pred" controls whether and how many stores to
handle this way. Vectorization of conditional stores is disabled per default for
now.

This patch also adds a change to the heuristic when the flag
"enable-loadstore-runtime-unroll" is enabled (off by default). It unrolls small
loops until load/store ports are saturated. This heuristic uses TTI's
getMaxUnrollFactor as a measure for load/store ports.

I also added a second flag -enable-cond-stores-vec. It will enable vectorization
of conditional stores. But there is no cost model for vectorization of
conditional stores in place yet so this will not do good at the moment.

rdar://15892953

Results for x86-64 -O3 -mavx +/- -mllvm -enable-loadstore-runtime-unroll
-vectorize-num-stores-pred=1 (before the BFI change):

 Performance Regressions:
   Benchmarks/Ptrdist/yacr2/yacr2 7.35% (maze3() is identical but 10% slower)
   Applications/siod/siod         2.18%
 Performance improvements:
   mesa                          -4.42%
   libquantum                    -4.15%

 With a patch that slightly changes the register heuristics (by subtracting the
 induction variable on both sides of the register pressure equation, as the
 induction variable is probably not really unrolled):

 Performance Regressions:
   Benchmarks/Ptrdist/yacr2/yacr2  7.73%
   Applications/siod/siod          1.97%

 Performance Improvements:
   libquantum                    -13.05% (we now also unroll quantum_toffoli)
   mesa                           -4.27%

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200270 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-28 01:01:53 +00:00
..
ARM ARM cost model: Unaligned vectorized double stores are expensive 2013-10-29 01:33:57 +00:00
X86 [vectorize] Initial version of respecting PGO in the vectorizer: treat 2014-01-27 13:11:50 +00:00
XCore Name the XCore target-specific subdirectories canonically. 2013-09-18 14:08:30 +00:00
12-12-11-if-conv.ll Update Transforms tests to use CHECK-LABEL for easier debugging. No functionality change. 2013-07-14 01:42:54 +00:00
2012-10-20-infloop.ll Force a fixed unroll count on the target independent tests. 2013-01-05 00:58:48 +00:00
2012-10-22-isconsec.ll TBAA: remove !tbaa from testing cases if not used. 2013-05-02 18:11:35 +00:00
align.ll LoopVectorizer: Use abi alignment for accesses with no alignment 2013-11-15 23:09:33 +00:00
bsd_regex.ll Fix missing CHECK-LABELs 2013-10-02 20:29:00 +00:00
bzip_reverse_loops.ll TBAA: remove !tbaa from testing cases if not used. 2013-05-02 18:11:35 +00:00
calloc.ll TBAA: remove !tbaa from testing cases if not used. 2013-04-30 17:52:57 +00:00
cast-induction.ll Update Transforms tests to use CHECK-LABEL for easier debugging. No functionality change. 2013-07-14 01:42:54 +00:00
cpp-new-array.ll Update Transforms tests to use CHECK-LABEL for easier debugging. No functionality change. 2013-07-14 01:42:54 +00:00
dbg.value.ll Debug Info: update testing cases to specify the debug info version number. 2013-11-22 21:49:45 +00:00
debugloc.ll Debug Info: update testing cases to specify the debug info version number. 2013-11-22 21:49:45 +00:00
ee-crash.ll LoopVectorizer: Don't attempt to vectorize extractelement instructions 2013-10-25 20:40:15 +00:00
flags.ll Update Transforms tests to use CHECK-LABEL for easier debugging. No functionality change. 2013-07-14 01:42:54 +00:00
float-reduction.ll Update Transforms tests to use CHECK-LABEL for easier debugging. No functionality change. 2013-07-14 01:42:54 +00:00
funcall.ll Fix missing CHECK-LABELs 2013-10-02 20:29:00 +00:00
gcc-examples.ll Update Transforms tests to use CHECK-LABEL for easier debugging. No functionality change. 2013-07-14 01:42:54 +00:00
global_alias.ll InstCombine: Teach most integer add/sub/mul/div combines how to deal with vectors. 2014-01-19 15:24:22 +00:00
hoist-loads.ll Fix missing CHECK-LABELs 2013-10-02 20:29:00 +00:00
i8-induction.ll TBAA: remove !tbaa from testing cases if not used. 2013-04-30 17:52:57 +00:00
if-conv-crash.ll LoopVectorize: Handle single edge PHIs 2013-05-18 18:38:34 +00:00
if-conversion-edgemasks.ll LoopVectorize: Cache edge masks created during if-conversion 2013-06-27 20:31:06 +00:00
if-conversion-nest.ll Update Transforms tests to use CHECK-LABEL for easier debugging. No functionality change. 2013-07-14 01:42:54 +00:00
if-conversion-reduction.ll Update Transforms tests to use CHECK-LABEL for easier debugging. No functionality change. 2013-07-14 01:42:54 +00:00
if-conversion.ll LoopVectorizer: Don't if-convert constant expressions that can trap 2013-12-17 01:11:01 +00:00
if-pred-stores.ll LoopVectorize: Support conditional stores by scalarizing 2014-01-28 01:01:53 +00:00
increment.ll Correct word hyphenations 2013-12-05 05:44:44 +00:00
induction_plus.ll LoopVectorizer: Perform redundancy elimination on induction variables 2013-11-01 22:18:19 +00:00
induction.ll Fix broken CHECK lines. 2014-01-11 21:06:00 +00:00
infiniteloop.ll Fix missing CHECK-LABELs 2013-10-02 20:29:00 +00:00
intrinsic.ll Revert "LoopVectorizer: Only allow vectorization of intrinsics." 2013-09-23 14:54:39 +00:00
lcssa-crash.ll LoopVectorize: LoopSimplify can't canonicalize loops with an indirectbr in it, don't assert on those cases. 2013-05-24 18:05:35 +00:00
lifetime.ll Fix missing CHECK-LABELs 2013-10-02 20:29:00 +00:00
memdep.ll Fix missing CHECK-LABELs 2013-10-02 20:29:00 +00:00
metadata-unroll.ll Update Transforms tests to use CHECK-LABEL for easier debugging. No functionality change. 2013-07-14 01:42:54 +00:00
metadata-width.ll Update Transforms tests to use CHECK-LABEL for easier debugging. No functionality change. 2013-07-14 01:42:54 +00:00
minmax_reduction.ll Scalarize select vector arguments when extracted. 2013-11-04 20:36:06 +00:00
multi-use-reduction-bug.ll LoopVectorizer: A reduction that has multiple uses of the reduction value is not 2014-01-19 03:18:31 +00:00
multiple-address-spaces.ll TBAA: remove !tbaa from testing cases when they are not needed. 2013-09-30 18:17:35 +00:00
no_idiv_reduction.ll Update Transforms tests to use CHECK-LABEL for easier debugging. No functionality change. 2013-07-14 01:42:54 +00:00
no_int_induction.ll Teach LoopVectorize about address space sizes 2013-08-22 02:42:55 +00:00
no_outside_user.ll Fix missing CHECK-LABELs 2013-10-02 20:29:00 +00:00
nofloat.ll Update Transforms tests to use CHECK-LABEL for easier debugging. No functionality change. 2013-07-14 01:42:54 +00:00
non-const-n.ll Update Transforms tests to use CHECK-LABEL for easier debugging. No functionality change. 2013-07-14 01:42:54 +00:00
nsw-crash.ll LoopVectorizer: Fix a bug in the vectorization of BinaryOperators. The BinaryOperator can be folded to an Undef, and we don't want to set NSW flags to undef vals. 2013-01-10 17:34:39 +00:00
opt.ll opt: Mirror vectorization presets of clang 2013-12-03 16:33:06 +00:00
phi-hang.ll LoopVectorize: Use a set to avoid longer cycles in the reduction chain too. 2013-04-18 14:29:13 +00:00
ptr_loops.ll Fix missing CHECK-LABELs 2013-10-02 20:29:00 +00:00
read-only.ll Update Transforms tests to use CHECK-LABEL for easier debugging. No functionality change. 2013-07-14 01:42:54 +00:00
reduction.ll LoopVectorize: External uses must use the last value in a reduction cycle 2013-10-07 21:05:43 +00:00
reverse_induction.ll Fix missing CHECK-LABELs 2013-10-02 20:29:00 +00:00
reverse_iter.ll Update Transforms tests to use CHECK-LABEL for easier debugging. No functionality change. 2013-07-14 01:42:54 +00:00
runtime-check-address-space.ll Don't use runtime bounds check between address spaces. 2013-10-02 22:38:17 +00:00
runtime-check-readonly-address-space.ll Don't use runtime bounds check between address spaces. 2013-10-02 22:38:17 +00:00
runtime-check-readonly.ll LoopVectorizer: Handle strided memory accesses by versioning 2014-01-10 18:20:32 +00:00
runtime-check.ll LoopVectorizer: If dependency checks fail try runtime checks 2013-11-01 03:05:07 +00:00
runtime-limit.ll Fix missing CHECK-LABELs 2013-10-02 20:29:00 +00:00
safegep.ll Fix missing CHECK-LABELs 2013-10-02 20:29:00 +00:00
same-base-access.ll Update Transforms tests to use CHECK-LABEL for easier debugging. No functionality change. 2013-07-14 01:42:54 +00:00
scalar-select.ll Update Transforms tests to use CHECK-LABEL for easier debugging. No functionality change. 2013-07-14 01:42:54 +00:00
scev-exitlim-crash.ll Fix missing CHECK-LABELs 2013-10-02 20:29:00 +00:00
simple-unroll.ll Update Transforms tests to use CHECK-LABEL for easier debugging. No functionality change. 2013-07-14 01:42:54 +00:00
small-loop.ll Update Transforms tests to use CHECK-LABEL for easier debugging. No functionality change. 2013-07-14 01:42:54 +00:00
start-non-zero.ll Update Transforms tests to use CHECK-LABEL for easier debugging. No functionality change. 2013-07-14 01:42:54 +00:00
store-shuffle-bug.ll Update Transforms tests to use CHECK-LABEL for easier debugging. No functionality change. 2013-07-14 01:42:54 +00:00
struct_access.ll LoopVectorize: Look for consecutive acces in GEPs with trailing zero indices 2013-11-01 14:09:50 +00:00
undef-inst-bug.ll Update Transforms tests to use CHECK-LABEL for easier debugging. No functionality change. 2013-07-14 01:42:54 +00:00
unroll_novec.ll [vectorizer] Add an override for the target instruction cost and use it 2014-01-27 11:41:50 +00:00
value-ptr-bug.ll Fix known typos 2014-01-24 17:20:08 +00:00
vectorize-once.ll Mark vector loops as already vectorized 2013-10-24 14:50:51 +00:00
version-mem-access.ll LoopVectorize: Only strip casts from integer types when replacing symbolic 2014-01-15 03:35:46 +00:00
write-only.ll Update Transforms tests to use CHECK-LABEL for easier debugging. No functionality change. 2013-07-14 01:42:54 +00:00