Hi!

These tests FAIL the vp.*q.*ymm insn scan with some tunings, e.g.
-mtune=silvermont or -mtune=atom, because vectorizing it using AVX2
is based on costs considered too expensive.
E.g. for -mtune=silvermont I see for VF 4:

avx2-vpop-check.h:16:3: note: Cost model analysis:
  Vector inside of loop cost: 330
  Vector prologue cost: 0
  Vector epilogue cost: 0
  Scalar iteration cost: 48
  Scalar outside cost: 0
  Vector outside cost: 0
  prologue iterations: 0
  epilogue iterations: 0
avx2-vpop-check.h:16:3: note: cost model: the vector iteration cost = 330 
divided by the scalar iteration cost = 48 is greater or equal to the vect
orization factor = 4.
avx2-vpop-check.h:16:3: note: not vectorized: vectorization not profitable.
avx2-vpop-check.h:16:3: note: not vectorized: vector version will never be 
profitable.
avx2-vpop-check.h:16:3: note: ***** Re-trying analysis with vector size 16

while with -mtune=generic I see:

avx2-vpop-check.h:16:3: note: Cost model analysis:
  Vector inside of loop cost: 64
  Vector prologue cost: 0
  Vector epilogue cost: 0
  Scalar iteration cost: 40
  Scalar outside cost: 0
  Vector outside cost: 0
  prologue iterations: 0
  epilogue iterations: 0
  Calculated minimum iters for profitability: 0

I think we can either use -mtune=generic as in the patch below,
or add -fno-vect-cost-model.

Tested on x86_64-linux with:
make check-gcc 
RUNTESTFLAGS='--target_board=unix\{-m32,-m32/-mtune=silvermont,-m32/-mtune=atom,-m64,-m64/-mtune=silvermont,-m64/-mtune=atom\}
 i386.exp=avx2-vp*q-3.c'
Ok for trunk?

2018-02-22  Jakub Jelinek  <ja...@redhat.com>

        PR target/82851
        * gcc.target/i386/avx2-vpaddq-3.c: Add -mtune=generic to dg-options.
        * gcc.target/i386/avx2-vpsubq-3.c: Likewise.

--- gcc/testsuite/gcc.target/i386/avx2-vpaddq-3.c.jj    2015-05-29 
15:02:59.475249515 +0200
+++ gcc/testsuite/gcc.target/i386/avx2-vpaddq-3.c       2018-02-22 
18:44:45.353178253 +0100
@@ -1,5 +1,5 @@
 /* { dg-do run } */
-/* { dg-options "-mavx2 -mno-prefer-avx128 -O2 -ftree-vectorize -save-temps" } 
*/
+/* { dg-options "-mavx2 -mno-prefer-avx128 -O2 -ftree-vectorize -mtune=generic 
-save-temps" } */
 /* { dg-require-effective-target avx2 } */
 
 
--- gcc/testsuite/gcc.target/i386/avx2-vpsubq-3.c.jj    2015-05-29 
15:03:00.572232560 +0200
+++ gcc/testsuite/gcc.target/i386/avx2-vpsubq-3.c       2018-02-22 
18:45:02.131168864 +0100
@@ -1,5 +1,5 @@
 /* { dg-do run } */
-/* { dg-options "-mavx2 -mno-prefer-avx128 -O2 -ftree-vectorize -save-temps" } 
*/
+/* { dg-options "-mavx2 -mno-prefer-avx128 -O2 -ftree-vectorize -mtune=generic 
-save-temps" } */
 /* { dg-require-effective-target avx2 } */
 
 

        Jakub

Reply via email to