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: 829486 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-464837-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="s83JWgYW"; 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 3yLNb250rnz9t6C for ; Tue, 24 Oct 2017 04:25:33 +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:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=default; b=Zfhq2NKaCd9rG4jgiJvJly8yRB9hl JRldwjBrhSFr6OQNfT8l1hBQI74XDQ7PG5MRtXkMPW2Xehd6QoabUs7fQzYddYfC Zo76ogXExSbmb4qEeJsM771qKrfWQA60rzuV8h7vyvbQWSz5re4vK2tZlzz12Lwq c0/T0Y+gTFgcV8= 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=s83 JWgYWWFx+Wc80WCh4vubXaggcGb9rRSjXlf6bMObL5Ofg9jycyfvXREUcDzjdRyp clpRyHYQNSIoLTctKL1DW+esgImlPeTGmgb+TEzSEb0JQ44ci1wuB8QKCGs8ypRi FwWSCgzM796a1mWNUn8lYKdEyOoc7ZCkEqfhDbUw= 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 ()) {