From patchwork Tue Jan 9 11:34:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 123893 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3907525qgn; Tue, 9 Jan 2018 03:34:20 -0800 (PST) X-Google-Smtp-Source: ACJfBos6jhsi+UGtD9QYbdvSJcPNdnZwO+ub7fpAuaqqydRjd7UhWa8VtXYzQZeZp0ZbdVVOwLAp X-Received: by 10.84.129.33 with SMTP id 30mr15243000plb.187.1515497660098; Tue, 09 Jan 2018 03:34:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515497660; cv=none; d=google.com; s=arc-20160816; b=Ob3d9ct6nNrq9RLDPS2Uoz8dNkqX0r8Jho8xQw9fWpUivYn0OU3eVdscnR/jsdzXlh ffLpl/CeNlIgqN7T7oZhcCu5+AmBIO29wkfQs6R45s/4PMSzGt2wEhfuBnnDYxr4t2C/ uLqa0uoYSpUKq40xv6NN79HPuqo9OikZ/kSTZI0iEXUVAvCPfoDobnZpz3tUXmPz80Qs 4Gu1mQW/CKYWe93UiO1oPtNePJ+ga+bbFrBzZE78ZO9KZyRiJtKzmcPBeLbnWEgMfIdb 894d/iK0fy4tuhTPPsGOMiQWE+vcJO8N1wfkAjJkBlBqn+zwIxATAnKJCp3QG2k0eIwp YbAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:message-id:date:subject:mail-followup-to:to :from:delivered-to:sender:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature:arc-authentication-results; bh=Iyj6/ClKaV+g9livqocM5cPyhzGzKS6bGj605ljKbRw=; b=W0rc1R2lbX/tYzPTKz8Zzj9VbSv3yhUCInl1CR3N2/IWRNf4qZyYceU3QsUiYzpvFK ZldcfAZSAh1KepLo74wCyaf6vCux9VRgZA4luq7BsxUDVZBZR4rpw5GGD5EAKKU69Cy3 AzfI9CnP4lxvxoUyBH98tReMnq5Epk04Zx7eTEAA9UDvh7JuzDx44KIqe+8v5bmFcvv3 QOpJCqyStU+iXlYRjtbf46NR7wVcaJfrqTGwk/J1Ghg5EXxKSyvYRqyZT3CinbU7DSiG zos2p3/ctbIqVkK/wG6+T2cuodDXeSNfIHSAWepRcHnuk5Ehw5zMrnLJMts2g4Iahbvy 2uxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=ONzgi9yH; spf=pass (google.com: domain of gcc-patches-return-470522-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-470522-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id v10si10189128plp.540.2018.01.09.03.34.19 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2018 03:34:20 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-470522-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=ONzgi9yH; spf=pass (google.com: domain of gcc-patches-return-470522-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-470522-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=c6IL/yn5hkEvU17Yk82ClnDgQe3iRihfWMY3yhq2frFaRdBwF05f5 6pR2yCR978WRspejskwfS/wpf12XLu87lXbsaKgvu+crCKNUewO5UoXHb9EBT18O wnMKA02o3FxOyuzWfLzbcwGbjK1Mqsruwxh4x7eRZeDxZgavn/IEqw= 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:from :to:subject:date:message-id:mime-version:content-type; s= default; bh=5SLBjfepAjN/zdWMu+0mL3SKRNE=; b=ONzgi9yHTjndNL4ybFY+ eGgwvpWwzekDe2P09RAGXxg4gFZz2V0q1QJaNX5oIJIru3rB5+YxlDOfSzN3hkze xYNu+LnCIBvCrDqO1/lm/5TTRSlzrYYrJWpsPmsVktR/8bioZWfMDyoQ+5dXif/A aS7OAqlTTgLvqKJhtIFdUKk= Received: (qmail 62457 invoked by alias); 9 Jan 2018 11:34:09 -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 62448 invoked by uid 89); 9 Jan 2018 11:34:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wr0-f179.google.com Received: from mail-wr0-f179.google.com (HELO mail-wr0-f179.google.com) (209.85.128.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 09 Jan 2018 11:34:07 +0000 Received: by mail-wr0-f179.google.com with SMTP id 16so1281850wry.12 for ; Tue, 09 Jan 2018 03:34:07 -0800 (PST) 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:date:message-id :user-agent:mime-version; bh=Iyj6/ClKaV+g9livqocM5cPyhzGzKS6bGj605ljKbRw=; b=RTJuBReqXo9vlnQHUW7qv1wSHKqaAPmDVr1+uZIFhI7d96p4Tkr9aJkN7gJk/+1YAk B2gMPV3rKvrTeAfzBq+P7yokK6qK2poe6wH7bz2nb8JIQw3+Mkke9izD5daVYmZpnCgs ktA4mPwUTETVlbG1EwGnrzcXrYjS48twxes1/UV+AVLJODwWVmDsk57MOGgAkACLFNx7 RCMtrKwmFOS1AOrFRrwASqVbu28xnm/0bzuj/pDYx785mBeRxkvTL8QwK4oa74mVoFdW k22yad2/POtkKQUg+cP4g1hCg0R+QtaGIN8n54V0PuAKkSYNNnRcoX9GPYPbQUzZAWBB 1aPA== X-Gm-Message-State: AKGB3mI0PS17s844ECpxADwzcP+pqoDK3ibH0zp49Fh5IUdkWvyBwYjo t+yL4ye7EiVfSv4s6pmpYgH7eAWHi8E= X-Received: by 10.223.160.139 with SMTP id m11mr12940604wrm.119.1515497645026; Tue, 09 Jan 2018 03:34:05 -0800 (PST) Received: from localhost ([95.144.14.233]) by smtp.gmail.com with ESMTPSA id w16sm4658753wrc.60.2018.01.09.03.34.03 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Jan 2018 03:34:04 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: Fix permute handling when vectorising scatters Date: Tue, 09 Jan 2018 11:34:03 +0000 Message-ID: <87mv1ncllg.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 As mentioned in https://gcc.gnu.org/ml/gcc-patches/2017-11/msg01575.html , the scatter handling in vectorizable_store seems to be dead code at the moment. Enabling it with the vect_analyze_data_ref_access part of that patch triggered an ICE in the avx512f-scatter-*.c tests (which previously didn't use scatters). The problem was that the NARROW and WIDEN handling uses permute_vec_elements to marshal the inputs, and permute_vec_elements expected the lhs of the stmt to be an SSA_NAME, which of course it isn't for stores. This patch makes permute_vec_elements create a fresh variable in this case. Tested on x86_64-linux-gnu. OK to install? Richard 2018-01-09 Richard Sandiford gcc/ * tree-vect-stmts.c (permute_vec_elements): Create a fresh variable if the destination isn't an SSA_NAME. Index: gcc/tree-vect-stmts.c =================================================================== --- gcc/tree-vect-stmts.c 2018-01-03 21:47:27.956862491 +0000 +++ gcc/tree-vect-stmts.c 2018-01-09 11:30:00.578821631 +0000 @@ -6585,7 +6585,11 @@ permute_vec_elements (tree x, tree y, tr tree perm_dest, data_ref; gimple *perm_stmt; - perm_dest = vect_create_destination_var (gimple_get_lhs (stmt), vectype); + tree scalar_dest = gimple_get_lhs (stmt); + if (TREE_CODE (scalar_dest) == SSA_NAME) + perm_dest = vect_create_destination_var (scalar_dest, vectype); + else + perm_dest = vect_get_new_vect_var (vectype, vect_simple_var, NULL); data_ref = make_ssa_name (perm_dest); /* Generate the permute statement. */