From patchwork Mon Jan 15 15:12:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 124533 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp700720lje; Mon, 15 Jan 2018 07:12:45 -0800 (PST) X-Google-Smtp-Source: ACJfBov5dxMg5PHMo9K4Q04LJZky4t38g3OpCZnsE+KIh+PJcVtuciOMxFbUg2IAcaF4OBBqovDb X-Received: by 10.98.215.30 with SMTP id b30mr11725053pfh.50.1516029165491; Mon, 15 Jan 2018 07:12:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516029165; cv=none; d=google.com; s=arc-20160816; b=w75h60H6Y6G0ZjyZ5hvJVhj7aHRwTo5+xY4shu1eq+nFDi6qjBdcPFx3eNJW+3SDBE 8hsBHRdewOMsVFpdSzp/S3W9LRgmtRW3eMYyZFpyrj/5uYt6hzV08USqK2RBl3CcOv6w EtXNyLW4NpJeFS01kf614KjSCFL7DoAO0MIYo/O+XyToc/zHV0w6GnqvnlgIHJ7WxusW M8COQRLU9alGgfY0rGi9XEb33HC+tQTUwRC2BPxQw6h0hR+sGmpyWA5h1dA/wpkbb41W Th+hNWJ0J9owO066IxzOXX08gntN+5r0zSCKqnrI8dXP7iIShzKF/GOt4mlaSCkReAhV O+zA== 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=DUPVtHDCxpfzl3uwLs9R0MDc/bFzMqBSKFPLVykLx8M=; b=Aze0oJxZXCcY/EE0GdIgLIenKGi9VFCk+mb0PFFQudl5Iff9buZ9ipoF8kHSz0a62v Deexmq5ipdPedNFK+UPGvMVrnsVoFqAwgPNiGEHcjEV/b/o2Ah+9NQPtKASvJVQGyBZr XTX9gnJFL2SEaNb6aN+8rBnHhPq8Xd4O9SLX48O98J7dx6jfJvGOKXnBjYzEwhtBGwCy fdnKLG8ZsaS46T2FA1BB3ekbX9XQIQmyLKbcexY/KPga2X+O9YZ0b+2jTeHE97LPNzFW cBVUWAcPoG9Be/tzhsBfDeM1gkLgxJ2y4+WFWfFzWkWn9Zxc4fgCGt2op+Nvyfwzamss hSNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=u3b8bPBD; spf=pass (google.com: domain of gcc-patches-return-471273-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-471273-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 h1si20742828pfi.35.2018.01.15.07.12.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Jan 2018 07:12:45 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-471273-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=u3b8bPBD; spf=pass (google.com: domain of gcc-patches-return-471273-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-471273-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=U9Weqkd7fcZWwfsyXnrEIkjXakcojYdKha/T2aR44kt9km5O/g9g3 ///c0PHY/pxbtlisoK1DMN/pYL54YMWdqmA84cFLb7UHCmY1ElXDrdWWho13NmRx ctNvCKv6T85COR/d2TbOGqoSl9odl1vwyRyrn606YbsYQjH/jQsP0s= 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=xQt0eYqFyWJII6Z8zWTezknaXRw=; b=u3b8bPBDV9iXj7b5MqyH VXh0UkmF7lO5rSLE6lBmEU72kkDilPA2brGh/++DA6u8O0uYuT/p99nymZ4nGAak b+qNZ1SxKGD0A3hi3AQf5LxI5l0WT2/bA1+3VT6Q7mdN9pGrJWxX78QTp/8Eugu8 PyxC5EIQUgj4oHXf7b0iD3o= Received: (qmail 112107 invoked by alias); 15 Jan 2018 15:12:33 -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 111688 invoked by uid 89); 15 Jan 2018 15:12:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wm0-f46.google.com Received: from mail-wm0-f46.google.com (HELO mail-wm0-f46.google.com) (74.125.82.46) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 15 Jan 2018 15:12:31 +0000 Received: by mail-wm0-f46.google.com with SMTP id g1so2523699wmg.2 for ; Mon, 15 Jan 2018 07:12:31 -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=DUPVtHDCxpfzl3uwLs9R0MDc/bFzMqBSKFPLVykLx8M=; b=lrswdYMNoee1tJ9FdIi8JwL+9nr+xiRX6I4LjQOMmQ530hXSHISnfzsNeAHOgdAfjA G5RgoOgjHxoc/GQVP6e5a5l6J8jn5juVTCXOXJsLewhXmwe/6UOvx4MTKC3bbNkn8iBu 39L+GTu2FEBo6VaC6b6mQ0a9XgZRCPNu85svbD6ISdCiimGM3AioyEqi5dRvmTTbtNK2 +tyy8yOOmM4oDblztvGu6y5i3Gi6nr3KMdzHLzfMruCZEo7SoBi+3VuFLdy00OnYTDiX 38ppbXXGin7B+kuhhlvOI/UZ+g7LD2ydpTM3WRTueRcqn7WZSAjbzQvffFEHGnBJ4HbL V3yA== X-Gm-Message-State: AKwxytcfFSJtJkeR8E1vtDoVYjB4xHy7QK1qzEN4fwdBf2N96hXsbePA gACE5557K+t76aCc9/0h8XgXm8H2LRI= X-Received: by 10.28.235.15 with SMTP id j15mr11319016wmh.52.1516029149257; Mon, 15 Jan 2018 07:12:29 -0800 (PST) Received: from localhost (92.40.249.112.threembb.co.uk. [92.40.249.112]) by smtp.gmail.com with ESMTPSA id s20sm218680wma.45.2018.01.15.07.12.27 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 15 Jan 2018 07:12:28 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: Don't group gather loads (PR83847) Date: Mon, 15 Jan 2018 15:12:26 +0000 Message-ID: <87inc3w3z9.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 In the testcase we were trying to group two gather loads, even though that isn't supported. Fixed by explicitly disallowing grouping of gathers and scatters. This problem didn't show up on SVE because there we convert to IFN_GATHER_LOAD/IFN_SCATTER_STORE pattern statements, which fail the can_group_stmts_p check. Tested on x86_64-linux-gnu. OK to install? Richard 2018-01-15 Richard Sandiford gcc/ * tree-vect-data-refs.c (vect_analyze_data_ref_accesses): gcc/testsuite/ * gcc.dg/torture/pr83847.c: New test. Index: gcc/tree-vect-data-refs.c =================================================================== --- gcc/tree-vect-data-refs.c 2018-01-13 18:02:00.948360274 +0000 +++ gcc/tree-vect-data-refs.c 2018-01-15 12:22:47.066621712 +0000 @@ -2923,7 +2923,8 @@ vect_analyze_data_ref_accesses (vec_info data_reference_p dra = datarefs_copy[i]; stmt_vec_info stmtinfo_a = vinfo_for_stmt (DR_STMT (dra)); stmt_vec_info lastinfo = NULL; - if (! STMT_VINFO_VECTORIZABLE (stmtinfo_a)) + if (!STMT_VINFO_VECTORIZABLE (stmtinfo_a) + || STMT_VINFO_GATHER_SCATTER_P (stmtinfo_a)) { ++i; continue; @@ -2932,7 +2933,8 @@ vect_analyze_data_ref_accesses (vec_info { data_reference_p drb = datarefs_copy[i]; stmt_vec_info stmtinfo_b = vinfo_for_stmt (DR_STMT (drb)); - if (! STMT_VINFO_VECTORIZABLE (stmtinfo_b)) + if (!STMT_VINFO_VECTORIZABLE (stmtinfo_b) + || STMT_VINFO_GATHER_SCATTER_P (stmtinfo_b)) break; /* ??? Imperfect sorting (non-compatible types, non-modulo Index: gcc/testsuite/gcc.dg/torture/pr83847.c =================================================================== --- /dev/null 2018-01-12 06:40:27.684409621 +0000 +++ gcc/testsuite/gcc.dg/torture/pr83847.c 2018-01-15 12:22:47.064621805 +0000 @@ -0,0 +1,32 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=bdver4" { target i?86-*-* x86_64-*-* } } */ + +typedef struct { + struct { + int a; + int b; + } c; +} * d; +typedef struct { + unsigned e; + d f[]; +} g; +g h; +d *k; +int i(int j) { + if (j) { + *k = *h.f; + return 1; + } + return 0; +} +int l; +int m; +int n; +d o; +void p() { + for (; i(l); l++) { + n += o->c.a; + m += o->c.b; + } +}