From patchwork Wed Jan 3 21:46:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 123343 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp10676411qgn; Wed, 3 Jan 2018 13:46:21 -0800 (PST) X-Google-Smtp-Source: ACJfBouz5Biu2NKhTeaddBadQNj17LKnhhMtNIEHB29xceCCHszE28g/6eCnxkkua4R2ibmM5Bex X-Received: by 10.98.252.7 with SMTP id e7mr2656294pfh.12.1515015981661; Wed, 03 Jan 2018 13:46:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515015981; cv=none; d=google.com; s=arc-20160816; b=O4SxLZbgd26T1WbEXGeULbbWJoWU2C2UiLD/YYi+dh/PPXw7jpjyvV7jnTdfmzXEVv ytlHbNh1WiOxIy2WanVmYCkZ6SX0ebslDnORgbQOcUWiC0gOWu3zO2J5aj44b4w+GHXS u6N+C23tkpUydwUI84PqzoE6ChM3DqjbTppsyXQWx6SOdWifbrcowPYQGrrP7McglivZ smkWazb9BmGEr5uBgoC7t3W9GV1acjgICSF15CH5PpDIsxAtROegzmj++PlmXcgn1heU ClI92io0Ebtui+wJKjH+EZWl8vjwvmeAZ8MhNjXUmm03FoLxR+XkzrxxYh9kGQs3b2ZN yq+Q== 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=l2fjsSdY/Uyng+KN24Yt3E7Gb4HXu695yI3MTifVQW8=; b=xrMRuGQC+cNmtxiyeKQ+Z/LWCIewY6DzPmRcgEcJvonimHaPqEFt2i/4dW/V06v/KF voC4ZJ4J5+BI8QX4BfbrK3qJxDQ7giQfH9MtBp1XbDUy4Cxp95N98BZ2Z+PiiBvWvwmg 5fa1laKCj2xBsr5TmmjfC6Yys0/PbylQjNi+W8NTmqFrkTq0s+RXW8Vvd2MTDhFwxTsc B0oczIIKMTH6CNfXcN8OnFp2nY4Onz6tSCwsDA1pMyBCc31fm9WG1puxbzABqy3ZK6EK 66G5gZ6Ml1IYJqeNmgoRRrRl/EbqHK+8vXEkZTkicHhkL5qCHRf17Ru3p7cz6xlw1Fd/ ERHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=hlG9W5X7; spf=pass (google.com: domain of gcc-patches-return-470112-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-470112-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 m19si1143599pgc.190.2018.01.03.13.46.21 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Jan 2018 13:46:21 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-470112-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=hlG9W5X7; spf=pass (google.com: domain of gcc-patches-return-470112-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-470112-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=GM9t36+4xBNSwfsNJXOlbF+V0092lDVbqdKpOioc6SaCBDXxEIpdq H5ffdLeDhio149pF7rIBiRMNFfzHacPOO56SyccgdSXmz6VHxZOTQT0eXdv/Ufch +bszIC9UiOj6FqCmKwuqifVcQjlsa17cv/DIcf5kcVf0LY0NLkyAdE= 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=amd3SLzjrUbgilaPUojA/d9P54A=; b=hlG9W5X72axfhaqHvh6w Kzt2Ps4rfBn5RtbZiAHmGkNplH7i1A1d6I/8fZbs/Ph1P6CXwzLzahXJBbhkisWe 2J/zWuH8m6HAmrTzTdggCZ8itXSmui/7qdDgoMQjd2qztOtbSOtyQg2j6q1bTif9 ynPfr/d7kj4w6tnzaPWiB8U= Received: (qmail 32636 invoked by alias); 3 Jan 2018 21:46:08 -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 32140 invoked by uid 89); 3 Jan 2018 21:46:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-15.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wr0-f175.google.com Received: from mail-wr0-f175.google.com (HELO mail-wr0-f175.google.com) (209.85.128.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 03 Jan 2018 21:46:06 +0000 Received: by mail-wr0-f175.google.com with SMTP id o101so3208810wrb.6 for ; Wed, 03 Jan 2018 13:46:05 -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:subject:date:message-id :user-agent:mime-version; bh=l2fjsSdY/Uyng+KN24Yt3E7Gb4HXu695yI3MTifVQW8=; b=MCSXsxhYI6/yDNi02SjCDQAMeXuJ9AUeO+1evKrz83Epzb2DbFtqnDjYbcXafh/a2Q OgaF9yzEmvPS7P3afBbqag0Gvv1pmoQV0w3a3vtHjBqBkzYbASUB85DKDh5A0jbTqolP taYyspMMaQONf0cM8JMgW7SnxCIgBu4ShAuki1s9Vt7rytT3oCO4fqTRXSsO1MsQusAp cwl/lYPEz7RN6Z1qclTPSPyRMM/BXUHMao5wf9cRWyWb8pZDR/9KpDrvAEZVkuNw6SRK 1bvp7R4SU7Y8EGskDTSd8+v9fW4Mea+afJGmkqY4NOaJ4eXNynx8IadmzPHsr/zubyrr RiZA== X-Gm-Message-State: AKGB3mKyUOcdiHujFIT2GMUk0i02VXqjOvNbXPDyPmLWKKil/feksq3B eDWuy4PUpQj4pqx8V9fjOOsA/wgSK50= X-Received: by 10.223.136.210 with SMTP id g18mr2816376wrg.86.1515015963903; Wed, 03 Jan 2018 13:46:03 -0800 (PST) Received: from localhost ([95.144.14.233]) by smtp.gmail.com with ESMTPSA id k19sm1524918wre.92.2018.01.03.13.46.02 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 03 Jan 2018 13:46:03 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [committed] Allow the target to set MAX_BITSIZE_MODE_ANY_MODE Date: Wed, 03 Jan 2018 21:46:01 +0000 Message-ID: <87wp0yipk6.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 The default value of MAX_BITSIZE_MODE_ANY_MODE is calculated from the initial mode sizes specified in the modes.def file. The target needs to be able to override it if ADJUST_BYTESIZE & co. can choose a bigger size. 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. Applied (as a gen* patch). Richard 2018-01-03 Richard Sandiford gcc/ * doc/rtl.texi (MAX_BITSIZE_MODE_ANY_MODE): Describe how the default is calculated and how it can be overridden. * genmodes.c (max_bitsize_mode_any_mode): New variable. (create_modes): Initialize it from MAX_BITSIZE_MODE_ANY_MODE, if defined. (emit_max_int): Use it to set the output MAX_BITSIZE_MODE_ANY_MODE, if nonzero. Index: gcc/doc/rtl.texi =================================================================== --- gcc/doc/rtl.texi 2018-01-03 09:44:10.691921247 +0000 +++ gcc/doc/rtl.texi 2018-01-03 09:44:10.854914708 +0000 @@ -1509,7 +1509,12 @@ compute integer values. @findex MAX_BITSIZE_MODE_ANY_MODE @item MAX_BITSIZE_MODE_ANY_MODE -The bitsize of the largest mode on the target. +The bitsize of the largest mode on the target. The default value is +the largest mode size given in the mode definition file, which is +always correct for targets whose modes have a fixed size. Targets +that might increase the size of a mode beyond this default should define +@code{MAX_BITSIZE_MODE_ANY_MODE} to the actual upper limit in +@file{@var{machine}-modes.def}. @end table @findex byte_mode Index: gcc/genmodes.c =================================================================== --- gcc/genmodes.c 2018-01-03 09:44:10.691921247 +0000 +++ gcc/genmodes.c 2018-01-03 09:44:10.854914708 +0000 @@ -792,6 +792,7 @@ #define ADJUST_FBIT(M, X) _ADD_ADJUST ( static int bits_per_unit; static int max_bitsize_mode_any_int; +static int max_bitsize_mode_any_mode; static void create_modes (void) @@ -811,6 +812,12 @@ create_modes (void) #else max_bitsize_mode_any_int = 0; #endif + +#ifdef MAX_BITSIZE_MODE_ANY_MODE + max_bitsize_mode_any_mode = MAX_BITSIZE_MODE_ANY_MODE; +#else + max_bitsize_mode_any_mode = 0; +#endif } #ifndef NUM_POLY_INT_COEFFS @@ -989,12 +996,18 @@ emit_max_int (void) else printf ("#define MAX_BITSIZE_MODE_ANY_INT %d\n", max_bitsize_mode_any_int); - mmax = 0; - for (j = 0; j < MAX_MODE_CLASS; j++) - for (i = modes[j]; i; i = i->next) - if (mmax < i->bytesize) - mmax = i->bytesize; - printf ("#define MAX_BITSIZE_MODE_ANY_MODE (%d*BITS_PER_UNIT)\n", mmax); + if (max_bitsize_mode_any_mode == 0) + { + mmax = 0; + for (j = 0; j < MAX_MODE_CLASS; j++) + for (i = modes[j]; i; i = i->next) + if (mmax < i->bytesize) + mmax = i->bytesize; + printf ("#define MAX_BITSIZE_MODE_ANY_MODE (%d*BITS_PER_UNIT)\n", mmax); + } + else + printf ("#define MAX_BITSIZE_MODE_ANY_MODE %d\n", + max_bitsize_mode_any_mode); } /* Emit mode_size_inline routine into insn-modes.h header. */