llvm-6502/test/Transforms/LoopVectorize
Arnold Schwaighofer 5f0d9dbdf4 X86 cost model: Adjust cost for custom lowered vector multiplies
This matters for example in following matrix multiply:

int **mmult(int rows, int cols, int **m1, int **m2, int **m3) {
  int i, j, k, val;
  for (i=0; i<rows; i++) {
    for (j=0; j<cols; j++) {
      val = 0;
      for (k=0; k<cols; k++) {
        val += m1[i][k] * m2[k][j];
      }
      m3[i][j] = val;
    }
  }
  return(m3);
}

Taken from the test-suite benchmark Shootout.

We estimate the cost of the multiply to be 2 while we generate 9 instructions
for it and end up being quite a bit slower than the scalar version (48% on my
machine).

Also, properly differentiate between avx1 and avx2. On avx-1 we still split the
vector into 2 128bits and handle the subvector muls like above with 9
instructions.
Only on avx-2 will we have a cost of 9 for v4i64.

I changed the test case in test/Transforms/LoopVectorize/X86/avx1.ll to use an
add instead of a mul because with a mul we now no longer vectorize. I did
verify that the mul would be indeed more expensive when vectorized with 3
kernels:

for (i ...)
   r += a[i] * 3;
for (i ...)
  m1[i] = m1[i] * 3; // This matches the test case in avx1.ll
and a matrix multiply.

In each case the vectorized version was considerably slower.

radar://13304919

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176403 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-02 04:02:52 +00:00
..
ARM Adding simple cast cost to ARM 2013-01-29 23:31:38 +00:00
X86 X86 cost model: Adjust cost for custom lowered vector multiplies 2013-03-02 04:02:52 +00:00
12-12-11-if-conv.ll Remove the -licm pass from the loop vectorizer test because the loop vectorizer does it now. 2013-01-09 01:20:59 +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 Force a fixed unroll count on the target independent tests. 2013-01-05 00:58:48 +00:00
bzip_reverse_loops.ll Add support for reverse pointer induction variables. These are loops that contain pointers that count backwards. 2013-01-23 01:35:00 +00:00
calloc.ll Remove the -licm pass from the loop vectorizer test because the loop vectorizer does it now. 2013-01-09 01:20:59 +00:00
cast-induction.ll Remove the -licm pass from the loop vectorizer test because the loop vectorizer does it now. 2013-01-09 01:20:59 +00:00
cpp-new-array.ll Remove the -licm pass from the loop vectorizer test because the loop vectorizer does it now. 2013-01-09 01:20:59 +00:00
flags.ll Remove the -licm pass from the loop vectorizer test because the loop vectorizer does it now. 2013-01-09 01:20:59 +00:00
float-reduction.ll LoopVectorizer: Add support for floating point reductions 2013-01-07 23:13:00 +00:00
gcc-examples.ll Remove the -licm pass from the loop vectorizer test because the loop vectorizer does it now. 2013-01-09 01:20:59 +00:00
global_alias.ll Some more tests for the global structure vectorizer 2013-02-23 12:48:30 +00:00
i8-induction.ll Fix PR14547. Handle induction variables of small sizes smaller than i32 (i8 and i16). 2013-01-13 07:56:29 +00:00
if-conv-crash.ll Force a fixed unroll count on the target independent tests. 2013-01-05 00:58:48 +00:00
if-conversion-reduction.ll Remove the -licm pass from the loop vectorizer test because the loop vectorizer does it now. 2013-01-09 01:20:59 +00:00
if-conversion.ll Remove the -licm pass from the loop vectorizer test because the loop vectorizer does it now. 2013-01-09 01:20:59 +00:00
increment.ll Remove the -licm pass from the loop vectorizer test because the loop vectorizer does it now. 2013-01-09 01:20:59 +00:00
induction_plus.ll Force a fixed unroll count on the target independent tests. 2013-01-05 00:58:48 +00:00
intrinsic.ll LoopVectorize: Vectorize math builtin calls. 2013-02-27 15:24:19 +00:00
lcssa-crash.ll Force a fixed unroll count on the target independent tests. 2013-01-05 00:58:48 +00:00
lit.local.cfg
no_int_induction.ll Remove the -licm pass from the loop vectorizer test because the loop vectorizer does it now. 2013-01-09 01:20:59 +00:00
nofloat.ll Remove the -licm pass from the loop vectorizer test because the loop vectorizer does it now. 2013-01-09 01:20:59 +00:00
non-const-n.ll Remove the -licm pass from the loop vectorizer test because the loop vectorizer does it now. 2013-01-09 01:20:59 +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
phi-hang.ll LoopVectorize: Don't hang forever if a PHI only has skipped PHI uses. 2013-03-01 19:07:31 +00:00
ptr_loops.ll Add support for reverse pointer induction variables. These are loops that contain pointers that count backwards. 2013-01-23 01:35:00 +00:00
read-only.ll Remove the -licm pass from the loop vectorizer test because the loop vectorizer does it now. 2013-01-09 01:20:59 +00:00
reduction.ll Remove the -licm pass from the loop vectorizer test because the loop vectorizer does it now. 2013-01-09 01:20:59 +00:00
runtime-check.ll LoopVectorizer: Emit memory checks into their own basic block. 2013-01-19 13:57:58 +00:00
same-base-access.ll Remove the -licm pass from the loop vectorizer test because the loop vectorizer does it now. 2013-01-09 01:20:59 +00:00
scalar-select.ll Remove the -licm pass from the loop vectorizer test because the loop vectorizer does it now. 2013-01-09 01:20:59 +00:00
simple-unroll.ll Remove the -licm pass from the loop vectorizer test because the loop vectorizer does it now. 2013-01-09 01:20:59 +00:00
small-loop.ll Remove the -licm pass from the loop vectorizer test because the loop vectorizer does it now. 2013-01-09 01:20:59 +00:00
start-non-zero.ll Force a fixed unroll count on the target independent tests. 2013-01-05 00:58:48 +00:00
struct_access.ll Add support for reverse pointer induction variables. These are loops that contain pointers that count backwards. 2013-01-23 01:35:00 +00:00
vectorize-once.ll PR14448 - prevent the loop vectorizer from vectorizing the same loop twice. 2013-03-02 01:33:49 +00:00
write-only.ll Remove the -licm pass from the loop vectorizer test because the loop vectorizer does it now. 2013-01-09 01:20:59 +00:00