From patchwork Wed Feb 27 00:27:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kenneth Zadeck X-Patchwork-Id: 223435 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 2E6DF2C0079 for ; Wed, 27 Feb 2013 11:28:23 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1362529704; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: References:In-Reply-To:Content-Type:Mailing-List:Precedence: List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=JpGdCnEJE6csHV9nEX1suHZ2y9s=; b=ItrCXn+AnszjqWZ nUx0cYUm0qIsGQDzV6noWooHqPW+BFmWpI01aHi+U8zFSMgIHWe/CeLfTpNdWRrc tJk2hMjBnaYDQT2VYzkf/8ZbjXKnD1nuZCNcQaV5ook8dUUgeP+vzXFeu0EVrj5O lgJn1awvn5hjwwnubFrbGFKABHQ0= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:X-Google-DKIM-Signature:X-Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:X-Gm-Message-State:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=ZkGjmRM7OYgDsq3gwH8Hs84ReeDjTTXzQTrBJNvleTamrZF0AhO00dSdifceQG U/SjjdI+oYjokEddl0Spap8/aIitkuEcGLKpe8z7dRdHZeMF5OLjuZ1slrvvOBgF 4UMc/8f/FPs69g7sSB44dySHgnfmjKkgb8pbnLILBwPy8=; Received: (qmail 30374 invoked by alias); 27 Feb 2013 00:28:13 -0000 Received: (qmail 30363 invoked by uid 22791); 27 Feb 2013 00:28:09 -0000 X-SWARE-Spam-Status: No, hits=-3.3 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-qa0-f51.google.com (HELO mail-qa0-f51.google.com) (209.85.216.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 27 Feb 2013 00:28:03 +0000 Received: by mail-qa0-f51.google.com with SMTP id cr7so77863qab.3 for ; Tue, 26 Feb 2013 16:28:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:cc :subject:references:in-reply-to:content-type:x-gm-message-state; bh=ZxETC0l3qKMMEuD63kSe0FGnKBOvJYZf9IBeCLCoOuE=; b=gI/s+zBSE2vITTOuAvVOvTZz7Ws+2WewPQZttr4R9J0DIchz+wTxvegBSZ5VJsTb46 lrfHUjdhfA5XwT9D62WE7TUUZ3iSrFlX9qWaj7XM963zYpzseu2aY4gRK95PbqiMCueP YhMOa7Hblo0ED1/V03cPd85daUsaXJeWqkhyJNxc4rP9iXr/DgwIY3Mk1oGXWSJco95f b7In56cPyyv1DScN3KUNqqOhLK/iGxoeuKc7iJps5ffkoKGSzwwyxrUuRP0/oYgSnzen jojC3/Z+2+pgs/S6LIabin+CiDiVL6ExwxnJrU3un4JdSbc//cWoYnhpEmyqFFj620AT JJxA== X-Received: by 10.49.70.165 with SMTP id n5mr482769qeu.16.1361924882619; Tue, 26 Feb 2013 16:28:02 -0800 (PST) Received: from [192.168.1.10] (pool-108-46-172-132.nycmny.fios.verizon.net. [108.46.172.132]) by mx.google.com with ESMTPS id hn9sm4943762qab.8.2013.02.26.16.27.59 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 26 Feb 2013 16:28:00 -0800 (PST) Message-ID: <512D530E.5050204@naturalbridge.com> Date: Tue, 26 Feb 2013 19:27:58 -0500 From: Kenneth Zadeck User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130221 Thunderbird/17.0.3 MIME-Version: 1.0 To: Kenneth Zadeck CC: Richard Guenther , Mike Stump , gcc-patches , rdsandiford@googlemail.com, Ian Lance Taylor Subject: Re: patch to fix constant math - second small patch -patch ping for next stage 1 References: <506C72C7.7090207@naturalbridge.com> <506D9544.7020408@naturalbridge.com> <506DD085.7080608@naturalbridge.com> <87txuaox52.fsf@talisman.home> <87lifli6oj.fsf@sandifor-thinkpad.stglab.manchester.uk.ibm.com> <87ehldi2kr.fsf@sandifor-thinkpad.stglab.manchester.uk.ibm.com> <87a9w1hzq1.fsf@sandifor-thinkpad.stglab.manchester.uk.ibm.com> <506F0C1A.5010705@naturalbridge.com> <87lifkhlo9.fsf@sandifor-thinkpad.stglab.manchester.uk.ibm.com> <506F5B50.2040800@naturalbridge.com> <506F63CC.40507@naturalbridge.com> In-Reply-To: <506F63CC.40507@naturalbridge.com> X-Gm-Message-State: ALoCoQnzQkzn0ETAgkWELIdDyiTVmXfE2hIMZc99SqulX6ZnnF14tvOdgFZlITPr7DmWMa83XvQD 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 Here is the second of my wide int patches with the patch rot removed. I would like to get these pre approved for the next stage 1. On 10/05/2012 06:48 PM, Kenneth Zadeck wrote: > This patch adds machinery to genmodes.c so that largest possible sizes > of various data structures can be determined at gcc build time. These > functions create 3 symbols that are available in insn-modes.h: > MAX_BITSIZE_MODE_INT - the bitsize of the largest int. > MAX_BITSIZE_MODE_PARTIAL_INT - the bitsize of the largest partial int. > MAX_BITSIZE_MODE_ANY_INT - the largest bitsize of any kind of int. 2013-2-26 Kenneth Zadeck * genmodes.c (emit_max_int): New function. (emit_insn_modes_h): Added call to emit_max_function. * doc/rtl.texi (MAX_BITSIZE_MODE_INT, MAX_BITSIZE_MODE_PARTIAL_INT, MAX_BITSIZE_MODE_ANY_INT, MAX_BITSIZE_MODE_ANY_MODE): Added doc. * machmode.def: Fixed comment. diff --git a/gcc/doc/rtl.texi b/gcc/doc/rtl.texi index b0b0723..095a642 100644 --- a/gcc/doc/rtl.texi +++ b/gcc/doc/rtl.texi @@ -1456,6 +1456,28 @@ Returns the number of units contained in a mode, i.e., Returns the narrowest mode in mode class @var{c}. @end table +The following 4 variables are defined on every target. They can be +used to allocate buffers that are guaranteed to be large enough to +hold any value that can be represented on the target. + +@table @code +@findex MAX_BITSIZE_MODE_INT +@item MAX_BITSIZE_MODE_INT +The bitsize of the largest integer mode defined on the target. + +@findex MAX_BITSIZE_MODE_PARTIAL_INT +@item MAX_BITSIZE_MODE_PARTIAL_INT +The bitsize of the largest partial integer mode defined on the target. + +@findex MAX_BITSIZE_MODE_ANY_INT +@item MAX_BITSIZE_MODE_ANY_INT +The maximum of MAX_BITSIZE_MODE_INT and MAX_BITSIZE_MODE_PARTIAL_INT. + +@findex MAX_BITSIZE_MODE_ANY_MODE +@item MAX_BITSIZE_MODE_ANY_MODE +The bitsize of the largest mode on the target. +@end table + @findex byte_mode @findex word_mode The global variables @code{byte_mode} and @code{word_mode} contain modes diff --git a/gcc/genmodes.c b/gcc/genmodes.c index 9907d69..f822dcd 100644 --- a/gcc/genmodes.c +++ b/gcc/genmodes.c @@ -848,6 +848,38 @@ calc_wider_mode (void) #define print_closer() puts ("};") +/* Compute the max bitsize of some of the classes of integers. It may + be that there are needs for the other integer classes, and this + code is easy to extend. */ +static void +emit_max_int (void) +{ + unsigned int max, mmax; + struct mode_data *i; + int j; + + puts (""); + for (max = 1, i = modes[MODE_INT]; i; i = i->next) + if (max < i->bytesize) + max = i->bytesize; + printf ("#define MAX_BITSIZE_MODE_INT %d*BITS_PER_UNIT\n", max); + mmax = max; + for (max = 1, i = modes[MODE_PARTIAL_INT]; i; i = i->next) + if (max < i->bytesize) + max = i->bytesize; + printf ("#define MAX_BITSIZE_MODE_PARTIAL_INT %d*BITS_PER_UNIT\n", max); + if (max > mmax) + mmax = max; + printf ("#define MAX_BITSIZE_MODE_ANY_INT %d*BITS_PER_UNIT\n", mmax); + + 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); +} + static void emit_insn_modes_h (void) { @@ -912,6 +944,7 @@ enum machine_mode\n{"); #endif printf ("#define CONST_MODE_IBIT%s\n", adj_ibit ? "" : " const"); printf ("#define CONST_MODE_FBIT%s\n", adj_fbit ? "" : " const"); + emit_max_int (); puts ("\ \n\ #endif /* insn-modes.h */"); diff --git a/gcc/machmode.def b/gcc/machmode.def index 4b58150..1062f18 100644 --- a/gcc/machmode.def +++ b/gcc/machmode.def @@ -179,8 +179,11 @@ RANDOM_MODE (BLK); FRACTIONAL_INT_MODE (BI, 1, 1); /* Basic integer modes. We go up to TI in generic code (128 bits). - The name OI is reserved for a 256-bit type (needed by some back ends). - FIXME TI shouldn't be generically available either. */ + TImode is needed here because the some front ends now genericly + support __int128. If the front ends decide to generically support + larger types, then corresponding modes must be added here. The + name OI is reserved for a 256-bit type (needed by some back ends). + */ INT_MODE (QI, 1); INT_MODE (HI, 2); INT_MODE (SI, 4);