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: 124347 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2068106qgn; Fri, 12 Jan 2018 05:34:32 -0800 (PST) X-Google-Smtp-Source: ACJfBouvSDKP/grmZF70xcrVblawv2dB1f5QDj89pDuTfFzY35X7waMAhoft1TQsAJEIbjmMxDrK X-Received: by 10.84.246.21 with SMTP id k21mr26744306pll.174.1515764072816; Fri, 12 Jan 2018 05:34:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515764072; cv=none; d=google.com; s=arc-20160816; b=ifI0KBjyEd1h+Jl1b4zFp8EYJHNZH3MI/X/LlijgcrDXfxfq2FHFmFM+0iyTfKDD/Z 3OTwaCHcTO2YZGkXiNsedEed0XyV2lJEFxN62mOrdw4oy/QVzl7/bAZOVFw2GP/6/VwI HmV8Su3e+ovZc5Fm1Rxz1bzc92EjKLt4v5BOnRaLY3RbhmNbEx7AjnCCkcihEMEW+CgA 8bwpWqnpMOVoee2IkcAVS/JOpRBWYIHKgHJSMaNQeyGr6QZRFqITaKrhWZTuwnWrObQP PNc35TA2or95KASTxP620AMokvM6pgXenR0lkALw4LBR+JVsPByEijYlZSJ4eVnvliLf 0NMw== 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:cc: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=bLEUYFqR9G5l1y4+OSQF6/JRuQWF8VIpVwH1Fh/bUW4=; b=uHJtlySrmEeGFZReZbKRbKI/MaEPIcNweOBMPaAm+Gkk1HK/HLl3brCH5sWES9A3vs CRcfb8NWpdrnvgTqzRYKLPAIfOhHoPBe+EfUJMQYi1EjSxJoqTJjcU7UMLR1FKXd/2Xh vv4Ba+05yBnJgbeWdLOoKtfD/te1cdoKfKXKag0MGDfEKiMndasJfeNZ+qb74yZJTKmc xMK4+BgThuB65BXf/nmupHnzuK+sJ+4bWGQHYlnsXaB1yv3lt+8iUGX73Ufo/M3z0EMH hvvky4S/rBY90xJH7rtsBpUBIu/xl2+8kr9VQ2K+chNbW2bSAWO7lSTLi/AmZK1E8v/z D85Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=W53oOmyG; spf=pass (google.com: domain of gcc-patches-return-470981-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-470981-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 j10si9388529pgc.758.2018.01.12.05.34.32 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Jan 2018 05:34:32 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-470981-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=W53oOmyG; spf=pass (google.com: domain of gcc-patches-return-470981-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-470981-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:cc:subject:references:date:in-reply-to:message-id :mime-version:content-type; q=dns; s=default; b=JGPSfc53L3HWrwFj kiC/97ZEerf0oSRPhiQptx7c01QZy2MB8ifJDBJYMiY9gFmjpm/y95bYVHCuZvds gVf5QMWvohDbaT48RhvYAwrswBI/ybjZ+uTmBOGlXOShBhG8j+Vnh2Gwi/bFsmBi SGa7ZkEPoET527YsJdia91zASD0= 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=W53oOmyGaBHpSPM83iuKVAms9XA5HCi8R/nPZ2aN1DD1DOepaDEmfm E8YmLdnabeHu+1ql7rqZgYyyYXbxDPr7bocMw+9/QMunzhAsyMHLPbErTfmSclOI Bb4qxfKwUUlJlSLhOYvT1RAhWtVFnTcMOAd2ce/Sn8YMh6w7O50us= 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-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);