From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 121178 invoked by alias); 11 Aug 2017 16:49:27 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 120832 invoked by uid 89); 11 Aug 2017 16:49:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=creep X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 11 Aug 2017 16:49:00 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B1BABC0079B6; Fri, 11 Aug 2017 16:48:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B1BABC0079B6 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=law@redhat.com Received: from localhost.localdomain (ovpn-116-95.phx2.redhat.com [10.3.116.95]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7955696156; Fri, 11 Aug 2017 16:48:43 +0000 (UTC) Subject: Re: [03/77] Allow machine modes to be classes To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org References: <8760ewohsv.fsf@linaro.org> <87shi0n33j.fsf@linaro.org> From: Jeff Law Message-ID: <044ff24d-155e-8133-ce30-71d67a049dc6@redhat.com> Date: Fri, 11 Aug 2017 17:02:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <87shi0n33j.fsf@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2017-08/txt/msg00802.txt.bz2 On 07/13/2017 02:38 AM, Richard Sandiford wrote: > This patch makes various changes that allow modes like SImode to be > classes rather than enums. > > Firstly, it adds inline functions for all mode size properties, > with the macros being simple wrappers around them. This is necessary > for the __builtin_constant_p trick to continue working effectively when > the mode arguments are slightly more complex (but still foldable at > compile time). > > These inline functions are trivial and heavily used. There's not much > point keeping them out-of-line at -O0: if anything it would make > debugging harder rather than easier, and it would also slow things down. > The patch therefore marks them as "always_inline", if that's available. > Later patches use this approach too. > > Using inline functions means that it's no longer possible to pass > an int to GET_MODE_PRECISION etc. The Fortran and powerpcspe-c.c > parts are needed to avoid instances of that. > > The patch continues to use enums for gencondmd.c, so that more > mode comparisons are integer constant expressions when checking > for always-true or always-false conditions. This is the only > intended use of USE_ENUM_MODES. > > The patch also enforces the previous replacement of case statements > by defining modes as: > > #define FOOmode ((void) 0, E_FOOmode) > > This adds no overhead but makes sure that new uses of "case FOOmode:" > don't accidentally creep in when FOOmode has no specific class associated > with it. > > 2017-07-13 Richard Sandiford > Alan Hayward > David Sherwood > > gcc/ > * genconditions.c (write_header): Add a "#define USE_ENUM_MODES". > * genmodes.c (emit_insn_modes_h): Define FOOmode to E_FOOmode if > USE_ENUM_MODES is defined and to ((void) 0, E_FOOmode) otherwise. > * machmode.h (mode_size): Move earlier in file. > (mode_precision): Likewise. > (mode_inner): Likewise. > (mode_nunits): Likewise. > (mode_unit_size): Likewise. > (unit_unit_precision): Likewise. > (mode_wider): Likewise. > (mode_2xwider): Likewise. > (machine_mode): New class. > (mode_to_bytes): New function. > (mode_to_bits): Likewise. > (mode_to_precision): Likewise. > (mode_to_inner): Likewise. > (mode_to_unit_size): Likewise. > (mode_to_unit_precision): Likewise. > (mode_to_nunits): Likewise. > (GET_MODE_SIZE): Use mode_to_bytes. > (GET_MODE_BITSIZE): Use mode_to_bits. > (GET_MODE_PRECISION): Use mode_to_precision. > (GET_MODE_INNER): Use mode_to_inner. > (GET_MODE_UNIT_SIZE): Use mode_to_unit_size. > (GET_MODE_UNIT_PRECISION): Use mode_to_unit_precision. > (GET_MODE_NUNITS): Use mode_to_nunits. > * system.h (ALWAYS_INLINE): New macro. > * config/powerpcspe/powerpcspe-c.c > (altivec_resolve_overloaded_builtin): Use machine_mode instead of > int for arg1_mode and arg2_mode. > > gcc/fortran/ > * trans-types.c (gfc_init_kinds): Use machine_mode instead of int > for "mode". OK. Jeff