public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Kirill Yukhin <kirill.yukhin@gmail.com>, Uros Bizjak <ubizjak@gmail.com>
Cc: gcc-patches@gcc.gnu.org
Subject: [PATCH] Tweak gcc.target/i386/avx2-vp{add,sub}q-3.c (PR target/82851)
Date: Thu, 22 Feb 2018 18:49:00 -0000	[thread overview]
Message-ID: <20180222181658.GW5867@tucnak> (raw)

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

             reply	other threads:[~2018-02-22 18:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-22 18:49 Jakub Jelinek [this message]
2018-02-22 18:56 ` Uros Bizjak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180222181658.GW5867@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=kirill.yukhin@gmail.com \
    --cc=ubizjak@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).