From patchwork Mon Aug 21 09:54:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 110510 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp3847802obb; Mon, 21 Aug 2017 02:54:49 -0700 (PDT) X-Received: by 10.84.141.1 with SMTP id 1mr19263789plu.141.1503309289413; Mon, 21 Aug 2017 02:54:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503309289; cv=none; d=google.com; s=arc-20160816; b=tF0vwk541K2vdSFEDmICRAoDbegex1tfplcfwsGBCx4JmgytGaehrAK25PjJgVKsQM zSdW+2t1Ps0agwD60Nyu9CpdWXYEWUv8OS4xFp7dCyB5SvlbXnM86GUT0mS+bAykn/9/ 9pn1A7/kjE1PDvRhUlKWLXy+hY99iPPsFuCDFQYgK5hUaU9zHploLMV0hRBJEo2tFcHn 92C5hwAXnIkRZ91awin1fANy+/SQahWAEUqfVl8cqU0JoRymHtn8EcCc0RiUMZ+++1u9 uTKgIoxW27uOgh1ahIqDUNJMQFJgIQVpLvlq/2Af2S4JzYJ/iOO7xnl8ieg2k/d7OBjw F6Hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:message-id:date: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=Bzo546qsABMGENJC4N7MDTjUsfnsgFwHPPyAGOJmN2o=; b=I6U/tuXJwX4M1rhQLvnof4VSFCW2UijMTF9H/xxEolBmgBhcDBw/dTbZJZOYWR28yC wgq2n+N17SIeiPlCCKKuNEgTtrGTFrU/5arGuNfgh5r8CKJsxLnu8QhNeQPVjw+0DdyK 3W9dBxyQWWMN3HS7AA8BU4j+VAMzbJOqMsqeeAYtxeIrlhRGP0KV3kxSvF4OV8cXHDVL eys0WcaKTk7Rtunv1Z8Y5m0iouRQI6GlFLTbLRQi/FaF4BbnmbEEm0phIhrRwgo4o1S1 Y/ZbIBJCwlBHqso7CGUNFm4a2/D1b1gpIqfCVYGH/mYu9JsCZwbjxfrw4AGFJ9vaHHNd YpJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=rbGet7vR; spf=pass (google.com: domain of gcc-patches-return-460625-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-460625-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 w70si6881488pgw.700.2017.08.21.02.54.49 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Aug 2017 02:54:49 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-460625-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=rbGet7vR; spf=pass (google.com: domain of gcc-patches-return-460625-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-460625-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:date:message-id:mime-version:content-type; q=dns; s= default; b=rACpI3qmD5HbjWXycvyKgMXmY/wvvD0I9U1VYQOzwyuonIf876rrw uChuFi5+ugbX8wy52oOgGpi0DxH94x4mpXY1dCWbFCFs2eOxy9Yqe8NNocdksS0u SKeV9zigHJUJ68wFDbPjZgnVy7HvIuHmOspai0pSZxu3d2Co0SXTqk= 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=MkCxkMdZRTnUAwblOuU6FV+28Lc=; b=rbGet7vRKnBTPcW03F64 +SwLjUCrDRQesz7JxIjUXh5+U4K3YNw6Eso5Qni0/CiE+j/ORpIN2XD6QCOWYTgx M4bnQhQx2fQEp0hz5zzWSFGGTT/2o1244yDvIbAb/3eZ1si1AwceWeSd7POOOyNp AJIYECORRnH0JvVuw1H9adg= Received: (qmail 95557 invoked by alias); 21 Aug 2017 09:54:27 -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 95544 invoked by uid 89); 21 Aug 2017 09:54:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wr0-f174.google.com Received: from mail-wr0-f174.google.com (HELO mail-wr0-f174.google.com) (209.85.128.174) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 21 Aug 2017 09:54:25 +0000 Received: by mail-wr0-f174.google.com with SMTP id 30so21644618wrk.0 for ; Mon, 21 Aug 2017 02:54: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:date:message-id :user-agent:mime-version; bh=Bzo546qsABMGENJC4N7MDTjUsfnsgFwHPPyAGOJmN2o=; b=HV2GVem8Qmml6xjf1AK3IMhBLFmuUN9BP0A7ZwVRTQSmsAAF8AB2Rkq9myjG/6Ew5r ye9QNQDH34gA11YqidKZuo3CdAiK7mWRPykDfdNo7VroqQGvrgkfv95KCpx48XeJ0fld Hp6ntbjxH+KdAMVs8wET79ZTiumShZaX7EW+8fFBLqw+Kjes+AcSPiWXspOKwmBzSriN GyqZcklU5yHYjmN71HTX1UNZbr/PQrbfAZPy3/WfWEGy+3KJWqGNPlUuY84k37M/3W5p WuRhG/RVYKzgRLEDy1/kEPEa5AEmORpr8VI71RG2XIiTyqWB3iSwhTP6zTLFnvvedoSm znMg== X-Gm-Message-State: AHYfb5gV+bLtzgSZGs/E4cnZ9Ru6cxByLEDMa21B9NS77WYEflC/IHkT yXvh7w/Co78wlVQbJbvcdA== X-Received: by 10.223.131.102 with SMTP id 93mr8097117wrd.54.1503309262904; Mon, 21 Aug 2017 02:54:22 -0700 (PDT) Received: from localhost (92.40.249.204.threembb.co.uk. [92.40.249.204]) by smtp.gmail.com with ESMTPSA id u7sm3620606wmf.33.2017.08.21.02.54.21 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 Aug 2017 02:54: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: Move vector_type_mode to tree.c Date: Mon, 21 Aug 2017 10:54:18 +0100 Message-ID: <87k21xdz5h.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 ...so that it's possible to use TYPE_MODE in tree.h. Tested on aarch64-linux-gnu and x86_64-linux-gnu. OK to install? Richard 2017-08-21 Richard Sandiford gcc/ * stor-layout.h (vector_type_mode): Move to... * tree.h (vector_type_mode): ...here. * stor-layout.c (vector_type_mode): Move to... * tree.c (vector_type_mode): ...here. Include rtl.h and regs.h. Index: gcc/stor-layout.h =================================================================== --- gcc/stor-layout.h 2017-02-23 19:54:15.000000000 +0000 +++ gcc/stor-layout.h 2017-08-21 10:52:43.715019857 +0100 @@ -114,7 +114,4 @@ extern void relayout_decl (tree); belongs to a function parameter. */ extern tree variable_size (tree); -/* Vector types need to check target flags to determine type. */ -extern machine_mode vector_type_mode (const_tree); - #endif // GCC_STOR_LAYOUT_H Index: gcc/tree.h =================================================================== --- gcc/tree.h 2017-08-21 10:42:04.341552187 +0100 +++ gcc/tree.h 2017-08-21 10:52:43.717019857 +0100 @@ -1852,7 +1852,8 @@ #define TYPE_MODE(NODE) \ #define SET_TYPE_MODE(NODE, MODE) \ (TYPE_CHECK (NODE)->type_common.mode = (MODE)) -extern machine_mode element_mode (const_tree t); +extern machine_mode element_mode (const_tree); +extern machine_mode vector_type_mode (const_tree); /* The "canonical" type for this type node, which is used by frontends to compare the type for equality with another type. If two types are Index: gcc/stor-layout.c =================================================================== --- gcc/stor-layout.c 2017-08-21 10:42:05.814707501 +0100 +++ gcc/stor-layout.c 2017-08-21 10:52:43.715019857 +0100 @@ -2494,45 +2494,6 @@ min_align_of_type (tree type) } return align / BITS_PER_UNIT; } - -/* Vector types need to re-check the target flags each time we report - the machine mode. We need to do this because attribute target can - change the result of vector_mode_supported_p and have_regs_of_mode - on a per-function basis. Thus the TYPE_MODE of a VECTOR_TYPE can - change on a per-function basis. */ -/* ??? Possibly a better solution is to run through all the types - referenced by a function and re-compute the TYPE_MODE once, rather - than make the TYPE_MODE macro call a function. */ - -machine_mode -vector_type_mode (const_tree t) -{ - machine_mode mode; - - gcc_assert (TREE_CODE (t) == VECTOR_TYPE); - - mode = t->type_common.mode; - if (VECTOR_MODE_P (mode) - && (!targetm.vector_mode_supported_p (mode) - || !have_regs_of_mode[mode])) - { - machine_mode innermode = TREE_TYPE (t)->type_common.mode; - - /* For integers, try mapping it to a same-sized scalar mode. */ - if (GET_MODE_CLASS (innermode) == MODE_INT) - { - mode = mode_for_size (TYPE_VECTOR_SUBPARTS (t) - * GET_MODE_BITSIZE (innermode), MODE_INT, 0); - - if (mode != VOIDmode && have_regs_of_mode[mode]) - return mode; - } - - return BLKmode; - } - - return mode; -} /* Create and return a type for signed integers of PRECISION bits. */ Index: gcc/tree.c =================================================================== --- gcc/tree.c 2017-08-21 10:42:04.340629158 +0100 +++ gcc/tree.c 2017-08-21 10:52:43.717019857 +0100 @@ -64,6 +64,8 @@ Software Foundation; either version 3, o #include "selftest.h" #include "stringpool.h" #include "attribs.h" +#include "rtl.h" +#include "regs.h" /* Tree code classes. */ @@ -12598,9 +12600,47 @@ element_mode (const_tree t) t = TREE_TYPE (t); return TYPE_MODE (t); } - -/* Veirfy that basic properties of T match TV and thus T can be a variant of +/* Vector types need to re-check the target flags each time we report + the machine mode. We need to do this because attribute target can + change the result of vector_mode_supported_p and have_regs_of_mode + on a per-function basis. Thus the TYPE_MODE of a VECTOR_TYPE can + change on a per-function basis. */ +/* ??? Possibly a better solution is to run through all the types + referenced by a function and re-compute the TYPE_MODE once, rather + than make the TYPE_MODE macro call a function. */ + +machine_mode +vector_type_mode (const_tree t) +{ + machine_mode mode; + + gcc_assert (TREE_CODE (t) == VECTOR_TYPE); + + mode = t->type_common.mode; + if (VECTOR_MODE_P (mode) + && (!targetm.vector_mode_supported_p (mode) + || !have_regs_of_mode[mode])) + { + machine_mode innermode = TREE_TYPE (t)->type_common.mode; + + /* For integers, try mapping it to a same-sized scalar mode. */ + if (GET_MODE_CLASS (innermode) == MODE_INT) + { + mode = mode_for_size (TYPE_VECTOR_SUBPARTS (t) + * GET_MODE_BITSIZE (innermode), MODE_INT, 0); + + if (mode != VOIDmode && have_regs_of_mode[mode]) + return mode; + } + + return BLKmode; + } + + return mode; +} + +/* Verify that basic properties of T match TV and thus T can be a variant of TV. TV should be the more specified variant (i.e. the main variant). */ static bool