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: 860939 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-471273-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="L97Nytny"; 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 3zKxfx0fBmz9sRm for ; Tue, 16 Jan 2018 02:12:40 +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:from :to:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=BLa7LqmO63sZMbUCW+XyZiUy8xBTubPxi+FNrqCRPRVZsWObm+3Gg Db50f5e9X67Dd8bPJhl9z/jhZ84mVYXXt+CLVTPHoAGJrXNCMelyJk3Yx2KkMHa0 wklVpZmcN4JUYWOP7pYyX1OtyLKAOuDaDfKWbaDuEW6ql1mbc/WZxc= 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=L97NytnykHQAhY8cKjO9 Q/HxLJfQ7fAPagUp6Ad5OY0ChHvTS5etZhXizfitMik23AhsNdPf5G9v1Z9FZlcK 7jHVCCScrqAZTcyOjCSV00aIa9HNK1VYM68jnYGAC8KJ1dwU5XSa3M222DFh4V9M BYQ6Zc3+hrS+piA5tze3Y34= 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-Google-Smtp-Source: ACJfBov6GQkKFEgeh1gE0PV+R3LCUBt5WvC6XMXiymLiDKpIZretLSnUzLkQKAUC/nYjLmx5oF+ogA== 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; + } +}