public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Tweak gcc.target/i386/avx2-vp{add,sub}q-3.c (PR target/82851)
@ 2018-02-22 18:49 Jakub Jelinek
  2018-02-22 18:56 ` Uros Bizjak
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2018-02-22 18:49 UTC (permalink / raw)
  To: Kirill Yukhin, Uros Bizjak; +Cc: gcc-patches

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  <jakub@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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Tweak gcc.target/i386/avx2-vp{add,sub}q-3.c (PR target/82851)
  2018-02-22 18:49 [PATCH] Tweak gcc.target/i386/avx2-vp{add,sub}q-3.c (PR target/82851) Jakub Jelinek
@ 2018-02-22 18:56 ` Uros Bizjak
  0 siblings, 0 replies; 2+ messages in thread
From: Uros Bizjak @ 2018-02-22 18:56 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Kirill Yukhin, gcc-patches

On Thu, Feb 22, 2018 at 7:16 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> 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  <jakub@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.

OK.

Thanks,
Uros.

> --- 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-02-22 18:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-22 18:49 [PATCH] Tweak gcc.target/i386/avx2-vp{add,sub}q-3.c (PR target/82851) Jakub Jelinek
2018-02-22 18:56 ` Uros Bizjak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).