From patchwork Mon Oct 23 17:25:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 116806 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp4889981qgn; Mon, 23 Oct 2017 10:25:38 -0700 (PDT) X-Received: by 10.84.232.76 with SMTP id f12mr10709801pln.269.1508779538557; Mon, 23 Oct 2017 10:25:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508779538; cv=none; d=google.com; s=arc-20160816; b=nCyV0vKmFYtps32HyAKBV1JsKnOt6GFfPP/bSIyjb2gZDA+Dj2TbnCj8Iz0C42p9zg 0vvN5OLVoCGdQjGl/MvI/jtCd8+tFzrI/hTFUgR0IFFLBKoDBBUA04tqs01B3+yjb1D6 h+hJIqRPVBku5Y5tcRdNOo27jqIUNkqfEIPVVJssgxdfZ5nsUJfbCWp2gcIxNmrNd5vU t5qLH4lsqWa8x6UseuDSEkkDVYvF9vcmrov4TtUWWkKIp0ceBxdQmsE9Gk1wn5ZcBCF/ IBwKIAyRYqRzkAiPytgr+CuzguBrChcdxT7BHXZE2yoBdwXf5JkPNEt1zhyyI6vsXSz2 VzJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:message-id:in-reply-to:date:references :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=UUHfuPyefdBDs/M8znGJ5LR2EngMx3f2YOFLyj8gUL4=; b=v01xsB9BCYcR3GKKhS0sOeuNRByC0kIwjFvNraL1xxl+D3ylQ3OBwm3H8jy6YFP9pT p0NACgNUcrEe3rPM4q2gjShtst+/imG/lDzuXD3w/IVP2ZTVmf2ujxWIwwYuFs9QmBbq ZgCHMe0/jbB0k9DRQ1qoG5Rh7EeHTVfMo7r2DFXC0KgGd2iVdeaNl0xPb5bZNDiKdIok 1Tpnookje/pDgHncvIshGiqPizKBZoW5TS3vHDIIuOEisnkVFEvnUz8Sl+NOITnztztk GupoAlmXf0Xw3AVPXQcsrHCYgJ6slppUbnAA+KZXTky8dd/G522eL0eWFIeA2fACkdkl TUeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=T2vXqb5g; spf=pass (google.com: domain of gcc-patches-return-464837-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-464837-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 5si5621157pfx.414.2017.10.23.10.25.38 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Oct 2017 10:25:38 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-464837-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=T2vXqb5g; spf=pass (google.com: domain of gcc-patches-return-464837-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-464837-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:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=default; b=ML0DiLaINikIJXSrIy2WOE/fyd/LG HnJBAt8yWxB6meoYHCAE7ZViz0ErmHSzksFgkkz/4XVKK05sW54Yf/3mrbytudv3 +z6CPBOOlSX5fGrX99BTlUcNTgL+3foqBiQirJlQ7uYBwpdN9MKzNt0SZQ6BPO+4 g9HGKQS4hWoQ+A= 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:references:date:in-reply-to:message-id:mime-version :content-type; s=default; bh=GD6pDg+lcZV6phPOz5KssL85qY0=; b=T2v Xqb5g8ItWBLJsIFWFLq0U4pmwtxWZBGEn7upHBBGoUCl+ZmnH0xCRITlZx8DM6k2 1kEVuF0oXWGBpGmuQtlFyVgvZafAFzKVkzkdr0MqXNrY2WdEMm/wc8E1cw4lNN3+ y12rmmITMZruP8GS7SfUV0mTXmdgSgA/btNs6AfE= Received: (qmail 69281 invoked by alias); 23 Oct 2017 17:25:26 -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 68950 invoked by uid 89); 23 Oct 2017 17:25:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.7 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=N1, 061 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; Mon, 23 Oct 2017 17:25:25 +0000 Received: by mail-wr0-f179.google.com with SMTP id r79so18182644wrb.13 for ; Mon, 23 Oct 2017 10:25:24 -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=UUHfuPyefdBDs/M8znGJ5LR2EngMx3f2YOFLyj8gUL4=; b=VYC0lJKkV7wy230xoiVmRt8Z0skBTBVK6q0bzMuXtKinqcYLyLw4wllJeb64GV7Znb 7c6zD096vZSJnes6C0bGoMnlrbi8o4iiqmwgVY71Siw2kKXI8uumYuY7CmJHnZ1CImqm ySXRw741XReuNCuDeHWZFnwn7gvWHcGD2/xZbtZJphTwlU+2siDpRpB4+vD/eXjtVful Nl0qzRSKeMXqXVMmvav1s+CLW8ogt0l5ks8bxoVvxT+ern+Enr/y+n9LeSADyBSbQ74h eXhUdo/fLl3r6rElD6ea6Wjl6zcgBHeoSxV04qzFa2Dy/clq05Fokz9CkLjtxVzmzgEA Z9yw== X-Gm-Message-State: AMCzsaVLDbz+9YUbgZSCF6Xsx7Xdr1JL0Sv85qoEjeyt6WpHREy9lS0I w9q9ZuD+qVwpkJ7gyoswXcwdN56yZ40= X-Google-Smtp-Source: ABhQp+Q/jn7prytfx0tm+kB2I6YOQOjtz6zsIxwutCDmfMOZpnuS5zHneALT0cBVPB0z4LPlR1VhkQ== X-Received: by 10.223.160.86 with SMTP id l22mr3067214wrl.187.1508779522882; Mon, 23 Oct 2017 10:25:22 -0700 (PDT) Received: from localhost ([2.26.27.199]) by smtp.gmail.com with ESMTPSA id m19sm3610310wma.24.2017.10.23.10.25.21 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2017 10:25:22 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [061/nnn] poly_int: compute_data_ref_alignment References: <871sltvm7r.fsf@linaro.org> Date: Mon, 23 Oct 2017 18:25:21 +0100 In-Reply-To: <871sltvm7r.fsf@linaro.org> (Richard Sandiford's message of "Mon, 23 Oct 2017 17:54:32 +0100") Message-ID: <87k1zlkc8u.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 This patch makes vect_compute_data_ref_alignment treat DR_INIT as a poly_int and handles cases in which the calculated misalignment might not be constant. 2017-10-23 Richard Sandiford Alan Hayward David Sherwood gcc/ * tree-vect-data-refs.c (vect_compute_data_ref_alignment): Treat drb->init as a poly_int. Fail if its misalignment wrt vector_alignment isn't known. Index: gcc/tree-vect-data-refs.c =================================================================== --- gcc/tree-vect-data-refs.c 2017-10-23 17:22:18.234826257 +0100 +++ gcc/tree-vect-data-refs.c 2017-10-23 17:22:24.456074525 +0100 @@ -944,8 +944,8 @@ vect_compute_data_ref_alignment (struct DR_VECT_AUX (dr)->base_misaligned = true; base_misalignment = 0; } - unsigned int misalignment = (base_misalignment - + TREE_INT_CST_LOW (drb->init)); + poly_int64 misalignment + = base_misalignment + wi::to_poly_offset (drb->init).force_shwi (); /* If this is a backward running DR then first access in the larger vectype actually is N-1 elements before the address in the DR. @@ -955,7 +955,21 @@ vect_compute_data_ref_alignment (struct misalignment += ((TYPE_VECTOR_SUBPARTS (vectype) - 1) * TREE_INT_CST_LOW (drb->step)); - SET_DR_MISALIGNMENT (dr, misalignment & (vector_alignment - 1)); + unsigned int const_misalignment; + if (!known_misalignment (misalignment, vector_alignment, + &const_misalignment)) + { + if (dump_enabled_p ()) + { + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Non-constant misalignment for access: "); + dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, ref); + dump_printf (MSG_MISSED_OPTIMIZATION, "\n"); + } + return true; + } + + SET_DR_MISALIGNMENT (dr, const_misalignment); if (dump_enabled_p ()) {