From patchwork Fri Jan 12 13:34:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 859925 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-470981-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="dxMUmtlH"; 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 3zJ3d11mySz9s9Y for ; Sat, 13 Jan 2018 00:34:28 +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:cc:subject:references:date:in-reply-to:message-id :mime-version:content-type; q=dns; s=default; b=YAWXrzO8sxGeal4I H6DqfsynZWwHlx0qs9nwgnfwC2wSJjtW88i/jSf6iJ57drI2rSCSBX2UnqpJOUCo QDY1Z5iTLvgZe8XqUny2GnjgYUODc1xJyB4lOqVAsqdzpvKC35yKyruSPDBU4gp/ c/71bS+G/Zwx+cBXUejiOJsYbcs= 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:cc:subject:references:date:in-reply-to:message-id :mime-version:content-type; s=default; bh=eU8qTtVvnXLwkXg23ve9eE ObdCU=; b=dxMUmtlH6Qrd+EV43mwWiBTVv9UEAJFoppqiq/ANErVU2XrI6ttBwm z2xd6FUCCXZ9f6zryRP4mgTP3RneMXRAIGbl9PE88gZqN2K4fStX21O2EIM+hpoU 2TIJ63p7pgQzI9Wm5302eKjWQIS8WMtN0zD15fI4XvBcbS50LD+A0= Received: (qmail 110023 invoked by alias); 12 Jan 2018 13:34:21 -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 110011 invoked by uid 89); 12 Jan 2018 13:34:21 -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, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wr0-f170.google.com Received: from mail-wr0-f170.google.com (HELO mail-wr0-f170.google.com) (209.85.128.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 12 Jan 2018 13:34:19 +0000 Received: by mail-wr0-f170.google.com with SMTP id p6so5344431wrd.0 for ; Fri, 12 Jan 2018 05:34:19 -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:cc:subject:references :date:in-reply-to:message-id:user-agent:mime-version; bh=bLEUYFqR9G5l1y4+OSQF6/JRuQWF8VIpVwH1Fh/bUW4=; b=rPOdXeYRez9wByuTTv1X7coXHKCpK+27N+jRGIcSbPTw7ZX2OvmXqkvwvlXML8CJiE 6k27N0n2P5tCJ61p+WKHiSmaUGLEBAjE79yb+xGHg+gKIZ8kjnJ+4AXyBrTCMl+L3MaX JGrH2VdHwFt69LCFXXxQJpnH72Tthkc+lV1wN1YZAP0mAp9xax9knAY2hZeeejo+VBvF mppJTLliqTvyPx6CfI+yMHcL/9qZnUkGARNwaHqPsELRrE+5XKzFgt+JYO3qUZIXjnkE pRtQHu+Gih8X8EKM89L6neKyW4zsuYxPMBt4FZgrvbgZQzqhdLyWxM1Kiwng0mQPZuLh +acQ== X-Gm-Message-State: AKwxytc2aYtctnNM0EzYJWf45ZJ0ET3mapxeT+IuEB2ZbOV5NWZoxmH1 EBhzyw9PyyNT0QkRFlOyr3UcuPSIKL0= X-Google-Smtp-Source: ACJfBovigIHaAaD2aW6RKpHh6FYh0k/r1LJi3uUnweEw3b065copdYaWKt2cLKMmIuO1UtPp4X5gww== X-Received: by 10.223.166.41 with SMTP id k38mr4677926wrc.242.1515764057579; Fri, 12 Jan 2018 05:34:17 -0800 (PST) Received: from localhost ([95.144.14.233]) by smtp.gmail.com with ESMTPSA id s5sm19581173wra.65.2018.01.12.05.34.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 12 Jan 2018 05:34:16 -0800 (PST) From: Richard Sandiford To: Jeff Law Mail-Followup-To: Jeff Law , gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Cc: gcc-patches@gcc.gnu.org Subject: Handle poly_int vector sizes in get_vec_alignment_for_array_type References: <87r2qyc1ww.fsf@linaro.org> <87y3l31se3.fsf@linaro.org> <87po6f19w2.fsf@linaro.org> Date: Fri, 12 Jan 2018 13:34:16 +0000 In-Reply-To: <87po6f19w2.fsf@linaro.org> (Richard Sandiford's message of "Fri, 12 Jan 2018 13:31:25 +0000") Message-ID: <87h8rr19rb.fsf_-_@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 get_vectype_for_scalar_type returns a variable-length vector type for SVE, whereas get_vec_alignment_for_array_type assumed it would always be an INTEGER_CST. This is needed to build libstdc++-v3/src/closures.cc for SVE (and probably many other places besides -- this was just the first hit). Tested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64le-linux-gnu. Also tested by comparing the before-and-after assembly output for at least one target per CPU directory. OK to install? Thanks, Richard 2018-01-12 Richard Sandiford gcc/ * tree-vectorizer.c (get_vec_alignment_for_array_type): Handle polynomial type sizes. Index: gcc/tree-vectorizer.c =================================================================== --- gcc/tree-vectorizer.c 2018-01-10 08:43:40.053367209 +0000 +++ gcc/tree-vectorizer.c 2018-01-12 12:56:30.428743723 +0000 @@ -1015,12 +1015,13 @@ static unsigned get_vec_alignment_for_ty get_vec_alignment_for_array_type (tree type) { gcc_assert (TREE_CODE (type) == ARRAY_TYPE); + poly_uint64 array_size, vector_size; tree vectype = get_vectype_for_scalar_type (strip_array_types (type)); if (!vectype - || !TYPE_SIZE (type) - || TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST - || tree_int_cst_lt (TYPE_SIZE (type), TYPE_SIZE (vectype))) + || !poly_int_tree_p (TYPE_SIZE (type), &array_size) + || !poly_int_tree_p (TYPE_SIZE (vectype), &vector_size) + || maybe_lt (array_size, vector_size)) return 0; return TYPE_ALIGN (vectype);