From patchwork Thu Oct 17 12:36:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Andre Vieira (lists)" X-Patchwork-Id: 1178502 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-511216-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="fDvcyFLa"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46v7vP4Qftz9sPJ for ; Thu, 17 Oct 2019 23:36:31 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=g+nKnrqdMMe+K0gVcXkDt4BXN2/EIf/GNgagnvN0lgfaWiMy5o npXYUtmV0twoJghdZyy3NCSkFWNTGXoKe5DhF7Q7Qf8MUHdR43atpu+RaJt5yPCU QvprWC4QUVYrhSEg7ebw+gi8yqLBwN28NCAy7pQ/fmNAPb/t0Ex2/NUM4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=5cC04Y6vQYP4jOjS/et+w8P1Wlw=; b=fDvcyFLacsI4xRxQmjut 0svBo/GP/1aWdR4jBrf0lFxi+dvGulA/oPUhuDg9tnCIkpVVjClmFlFVdhzSmPhy WoKvirMfyKx8z+VPl8E+eXnhSUQnhC5QiLdcjsJCbKsQqlidW/s27fzt1YhhlZru C6JO2QWDW1t4mkVIB3AHB8Q= Received: (qmail 98990 invoked by alias); 17 Oct 2019 12:36:24 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 98981 invoked by uid 89); 17 Oct 2019 12:36:24 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy=21756 X-HELO: foss.arm.com Received: from Unknown (HELO foss.arm.com) (217.140.110.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 17 Oct 2019 12:36:23 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 47FA91D6F for ; Thu, 17 Oct 2019 05:36:15 -0700 (PDT) Received: from [10.2.206.37] (e107157-lin.cambridge.arm.com [10.2.206.37]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0EB7E3F718 for ; Thu, 17 Oct 2019 05:36:14 -0700 (PDT) To: gcc-patches From: "Andre Vieira (lists)" Subject: [committed][vect] Be consistent in versioning threshold use Message-ID: <57322ba1-fa42-1747-8491-983dcc58751d@arm.com> Date: Thu, 17 Oct 2019 13:36:14 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 X-IsSubscribed: yes Hi, This piece of code was pre-approved by richi. Retested by bootstrapping and regression testing on x86_64 (AVX512) and aarch64. Committed in revision r277105. gcc/ChangeLog: 2019-10-17 Andre Vieira * tree-vect-loop.c (vect_analyze_loop_2): Use same condition to decide when to use versioning threshold. diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index b00d68b9de938148c24e088024b2e01bdceb2e81..72b80f46b1a9fa0bc8392809c286b5fac9a74451 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -2155,6 +2155,7 @@ start_over: if (LOOP_REQUIRES_VERSIONING (loop_vinfo)) { poly_uint64 niters_th = 0; + unsigned int th = LOOP_VINFO_COST_MODEL_THRESHOLD (loop_vinfo); if (!vect_use_loop_mask_for_alignment_p (loop_vinfo)) { @@ -2175,6 +2176,14 @@ start_over: /* One additional iteration because of peeling for gap. */ if (LOOP_VINFO_PEELING_FOR_GAPS (loop_vinfo)) niters_th += 1; + + /* Use the same condition as vect_transform_loop to decide when to use + the cost to determine a versioning threshold. */ + if (th >= vect_vf_for_cost (loop_vinfo) + && !LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo) + && ordered_p (th, niters_th)) + niters_th = ordered_max (poly_uint64 (th), niters_th); + LOOP_VINFO_VERSIONING_THRESHOLD (loop_vinfo) = niters_th; }