From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28457 invoked by alias); 23 Oct 2017 17:31:50 -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 27932 invoked by uid 89); 23 Oct 2017 17:31:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.8 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wr0-f169.google.com Received: from mail-wr0-f169.google.com (HELO mail-wr0-f169.google.com) (209.85.128.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 23 Oct 2017 17:31:48 +0000 Received: by mail-wr0-f169.google.com with SMTP id p96so4312836wrb.7 for ; Mon, 23 Oct 2017 10:31:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:mail-followup-to:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=SO9HmulE46275AIkErdBGO6bHWyq/NV/a2or3Tl7WGM=; b=NTW+9V/fmj+UgNGy9qsoZv7s6SC7BN/MYbpvaPFstXsnxht0u79Zi0Hj8jkMtDfowq CUCZf5P9IcdpMd2h1HYDN5ngbTajYUhOnj3MfV+wLSIGZkyGNwWsrvV+nUzG0ewCRNDv O74NOKHzavv+qbp6oWIEmQ1LUG1Si/hXVCPspVZtOqWN1cvd+O2ZwGE2snypDC/P/EkB n9bjumSJ+SuuQUaxmviKIJSadgfceyGvKOsupSatb0ViwTt0EZqa1+H9G8/PhsHXj8NM 8i1b9q3Nhubg2bcV5i8wVNA4BQQ/4aB1fijEC/8DHNVgFo4Qgk1MB+3V6PItGJspnV4b KDoA== X-Gm-Message-State: AMCzsaVW2XWNalPnesxCFwXHcUuACOzBxhmZCqiqyIhCqdsgfecpBFFU C8yfZGYTx47DfJco8YDDqZjnRK2fx1w= X-Google-Smtp-Source: ABhQp+Rk1AEuSRcj09iEOq26uUIddNghCyWerrTCxZRZrX6hPrJGs4avJjKLhFGm1aLisnP2rC50WA== X-Received: by 10.223.175.232 with SMTP id y40mr12889225wrd.207.1508779906199; Mon, 23 Oct 2017 10:31:46 -0700 (PDT) Received: from localhost ([2.26.27.199]) by smtp.gmail.com with ESMTPSA id l130sm1436435wmd.47.2017.10.23.10.31.45 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2017 10:31:45 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [078/nnn] poly_int: two-operation SLP References: <871sltvm7r.fsf@linaro.org> Date: Mon, 23 Oct 2017 17:32:00 -0000 In-Reply-To: <871sltvm7r.fsf@linaro.org> (Richard Sandiford's message of "Mon, 23 Oct 2017 17:54:32 +0100") Message-ID: <87inf5hitb.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2017-10/txt/msg01579.txt.bz2 This patch makes two-operation SLP handle but reject variable-length vectors. Adding support for this is a post-GCC8 thing. 2017-10-23 Richard Sandiford Alan Hayward David Sherwood gcc/ * tree-vect-slp.c (vect_build_slp_tree_1): Handle polynomial numbers of units. (vect_schedule_slp_instance): Likewise. Index: gcc/tree-vect-slp.c =================================================================== --- gcc/tree-vect-slp.c 2017-10-23 17:22:42.827179461 +0100 +++ gcc/tree-vect-slp.c 2017-10-23 17:22:43.865071801 +0100 @@ -903,10 +903,19 @@ vect_build_slp_tree_1 (vec_info *vinfo, /* If we allowed a two-operation SLP node verify the target can cope with the permute we are going to use. */ + poly_uint64 nunits = TYPE_VECTOR_SUBPARTS (vectype); if (alt_stmt_code != ERROR_MARK && TREE_CODE_CLASS (alt_stmt_code) != tcc_reference) { - unsigned int count = TYPE_VECTOR_SUBPARTS (vectype); + unsigned HOST_WIDE_INT count; + if (!nunits.is_constant (&count)) + { + if (dump_enabled_p ()) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Build SLP failed: different operations " + "not allowed with variable-length SLP.\n"); + return false; + } auto_vec_perm_indices sel (count); for (i = 0; i < count; ++i) { @@ -3796,6 +3805,7 @@ vect_schedule_slp_instance (slp_tree nod /* VECTYPE is the type of the destination. */ vectype = STMT_VINFO_VECTYPE (stmt_info); + poly_uint64 nunits = TYPE_VECTOR_SUBPARTS (vectype); group_size = SLP_INSTANCE_GROUP_SIZE (instance); if (!SLP_TREE_VEC_STMTS (node).exists ()) @@ -3858,13 +3868,16 @@ vect_schedule_slp_instance (slp_tree nod unsigned k = 0, l; for (j = 0; j < v0.length (); ++j) { - unsigned int nunits = TYPE_VECTOR_SUBPARTS (vectype); - auto_vec melts (nunits); - for (l = 0; l < nunits; ++l) + /* Enforced by vect_build_slp_tree, which rejects variable-length + vectors for SLP_TREE_TWO_OPERATORS. */ + unsigned int const_nunits = nunits.to_constant (); + auto_vec melts (const_nunits); + for (l = 0; l < const_nunits; ++l) { if (k >= group_size) k = 0; - tree t = build_int_cst (meltype, mask[k++] * nunits + l); + tree t = build_int_cst (meltype, + mask[k++] * const_nunits + l); melts.quick_push (t); } tmask = build_vector (mvectype, melts);