From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 112211 invoked by alias); 22 Feb 2018 18:49:43 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 112200 invoked by uid 89); 22 Feb 2018 18:49:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-12.3 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_LOW,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 22 Feb 2018 18:49:40 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7FF13402242D for ; Thu, 22 Feb 2018 18:49:29 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-204-85.brq.redhat.com [10.40.204.85]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 153CBB07BB for ; Thu, 22 Feb 2018 18:49:21 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id w1MIH0p4010504; Thu, 22 Feb 2018 19:17:00 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id w1MIGwf4010503; Thu, 22 Feb 2018 19:16:58 +0100 Date: Thu, 22 Feb 2018 18:49:00 -0000 From: Jakub Jelinek To: Kirill Yukhin , Uros Bizjak Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Tweak gcc.target/i386/avx2-vp{add,sub}q-3.c (PR target/82851) Message-ID: <20180222181658.GW5867@tucnak> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.1 (2017-09-22) X-IsSubscribed: yes X-SW-Source: 2018-02/txt/msg01301.txt.bz2 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 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