From patchwork Sat Nov 9 11:09:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 289985 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 33BF42C00AD for ; Sat, 9 Nov 2013 22:09:57 +1100 (EST) 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:date:message-id:mime-version:content-type; q=dns; s=default; b=uSG5Y5r3mo8KOSfSrbXv4kyq2DN4OmM8Kibt+tQUBI90zd+Pgj yaJYQtKOIh4si+U6FDaITSK0o3vfiCDM2uwtg2sJWQ5fZ7yt3NjaX1iP3rTizxmg bcob5ZejemhFYIy3YGAebP6ZmS44gJ4QwxPUvgxWOnhR8U1r69kVOuC20= 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:date:message-id:mime-version:content-type; s= default; bh=BhzZww8mWu5CCN6GcI4YZJ99aJ4=; b=mm460X02BVNYSVE0z/QY qwfwoZsMuClZfG07AnGRH6c1yMTmI6nrina3aw+qvRnJk4mLKMO4ssFNOA3eOZUo rDtqWNLxQo6L16LVZjOi3FIXt5KLLNd1V/MPhEKgj6g0JymaeyJ5n83iOC3YUoyC TgV7GRn0pv2LagtQk1iWSiI= Received: (qmail 17239 invoked by alias); 9 Nov 2013 11:09:46 -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 17230 invoked by uid 89); 9 Nov 2013 11:09:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.2 required=5.0 tests=AWL, BAYES_50, FREEMAIL_FROM, RDNS_NONE, SPF_PASS, URIBL_BLOCKED autolearn=no version=3.3.2 X-HELO: mail-we0-f181.google.com Received: from Unknown (HELO mail-we0-f181.google.com) (74.125.82.181) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sat, 09 Nov 2013 11:09:42 +0000 Received: by mail-we0-f181.google.com with SMTP id t60so2922201wes.40 for ; Sat, 09 Nov 2013 03:09:32 -0800 (PST) X-Received: by 10.180.12.45 with SMTP id v13mr5543555wib.57.1383995372648; Sat, 09 Nov 2013 03:09:32 -0800 (PST) Received: from localhost ([2.28.235.51]) by mx.google.com with ESMTPSA id i8sm14114199wiy.6.2013.11.09.03.09.31 for (version=TLSv1.2 cipher=AES128-GCM-SHA256 bits=128/128); Sat, 09 Nov 2013 03:09:32 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, zadeck@naturalbridge.com, mikestump@comcast.net, rdsandiford@googlemail.com Cc: zadeck@naturalbridge.com, mikestump@comcast.net Subject: [wide-int] Documentation and comment tweaks Date: Sat, 09 Nov 2013 11:09:31 +0000 Message-ID: <874n7lg7bo.fsf@talisman.default> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Some minor tweaks to the documentation and commentary. The hyphenation and "non zero"->"nonzero" changes are supposed to be per guidelines: http://gcc.gnu.org/codingconventions.html#Spelling Hope I got them right. OK to install? This is the last of the patches I had lined up. These patches are also awaiting review: http://gcc.gnu.org/ml/gcc-patches/2013-11/msg00663.html http://gcc.gnu.org/ml/gcc-patches/2013-11/msg00666.html Thanks, Richard Index: gcc/dfp.c =================================================================== --- gcc/dfp.c 2013-11-09 09:50:47.392396760 +0000 +++ gcc/dfp.c 2013-11-09 11:07:22.754160541 +0000 @@ -605,8 +605,8 @@ decimal_real_to_integer (const REAL_VALU return real_to_integer (&to); } -/* Likewise, but returns a wide_int with PRECISION. Fail - is set if the value does not fit. */ +/* Likewise, but returns a wide_int with PRECISION. *FAIL is set if the + value does not fit. */ wide_int decimal_real_to_integer (const REAL_VALUE_TYPE *r, bool *fail, int precision) Index: gcc/doc/rtl.texi =================================================================== --- gcc/doc/rtl.texi 2013-11-09 09:50:47.392396760 +0000 +++ gcc/doc/rtl.texi 2013-11-09 11:07:22.755160549 +0000 @@ -1542,11 +1542,10 @@ Similarly, there is only one object for @findex const_double @item (const_double:@var{m} @var{i0} @var{i1} @dots{}) This represents either a floating-point constant of mode @var{m} or -(on ports older ports that do not define +(on older ports that do not define @code{TARGET_SUPPORTS_WIDE_INT}) an integer constant too large to fit into @code{HOST_BITS_PER_WIDE_INT} bits but small enough to fit within -twice that number of bits (GCC does not provide a mechanism to -represent even larger constants). In the latter case, @var{m} will be +twice that number of bits. In the latter case, @var{m} will be @code{VOIDmode}. For integral values constants for modes with more bits than twice the number in @code{HOST_WIDE_INT} the implied high order bits of that constant are copies of the top bit of @@ -1576,25 +1575,25 @@ the precise bit pattern used by the targ This contains an array of @code{HOST_WIDE_INTS} that is large enough to hold any constant that can be represented on the target. This form of rtl is only used on targets that define -@code{TARGET_SUPPORTS_WIDE_INT} to be non zero and then -@code{CONST_DOUBLES} are only used to hold floating point values. If +@code{TARGET_SUPPORTS_WIDE_INT} to be nonzero and then +@code{CONST_DOUBLE}s are only used to hold floating-point values. If the target leaves @code{TARGET_SUPPORTS_WIDE_INT} defined as 0, @code{CONST_WIDE_INT}s are not used and @code{CONST_DOUBLE}s are as they were before. -The values are stored in a compressed format. The higher order +The values are stored in a compressed format. The higher-order 0s or -1s are not represented if they are just the logical sign extension of the number that is represented. @findex CONST_WIDE_INT_VEC @item CONST_WIDE_INT_VEC (@var{code}) Returns the entire array of @code{HOST_WIDE_INT}s that are used to -store the value. This macro should be rarely used. +store the value. This macro should be rarely used. @findex CONST_WIDE_INT_NUNITS @item CONST_WIDE_INT_NUNITS (@var{code}) The number of @code{HOST_WIDE_INT}s used to represent the number. -Note that this generally be smaller than the number of +Note that this generally is smaller than the number of @code{HOST_WIDE_INT}s implied by the mode size. @findex CONST_WIDE_INT_ELT Index: gcc/doc/tm.texi =================================================================== --- gcc/doc/tm.texi 2013-11-09 09:50:47.392396760 +0000 +++ gcc/doc/tm.texi 2013-11-09 11:07:22.757160564 +0000 @@ -9683,10 +9683,9 @@ Returns the negative of the floating poi Returns the absolute value of @var{x}. @end deftypefn -@deftypefn Macro void REAL_VALUE_FROM_INT (REAL_VALUE_TYPE @var{x}, HOST_WIDE_INT @var{val}, enum machine_mode @var{mode}) -Converts a double-precision integer found in @var{val}, -into a floating point value which is then stored into @var{x}. The -value is truncated to fit in mode @var{mode}. +@deftypefn Macro void REAL_VALUE_FROM_INT (REAL_VALUE_TYPE @var{x}, const wide_int_ref &@var{val}, enum machine_mode @var{mode}) +Converts integer @var{val} into a floating-point value which is then +stored into @var{x}. The value is truncated to fit in mode @var{mode}. @end deftypefn @node Mode Switching @@ -11497,15 +11496,15 @@ The default value of this hook is based @defmac TARGET_SUPPORTS_WIDE_INT On older ports, large integers are stored in @code{CONST_DOUBLE} rtl -objects. Newer ports define @code{TARGET_SUPPORTS_WIDE_INT} to be non -zero to indicate that large integers are stored in +objects. Newer ports define @code{TARGET_SUPPORTS_WIDE_INT} to be nonzero +to indicate that large integers are stored in @code{CONST_WIDE_INT} rtl objects. The @code{CONST_WIDE_INT} allows very large integer constants to be represented. @code{CONST_DOUBLE} -are limited to twice the size of host's @code{HOST_WIDE_INT} +is limited to twice the size of the host's @code{HOST_WIDE_INT} representation. Converting a port mostly requires looking for the places where -@code{CONST_DOUBLES} are used with @code{VOIDmode} and replacing that +@code{CONST_DOUBLE}s are used with @code{VOIDmode} and replacing that code with code that accesses @code{CONST_WIDE_INT}s. @samp{"grep -i const_double"} at the port level gets you to 95% of the changes that need to be made. There are a few places that require a deeper look. @@ -11535,7 +11534,7 @@ The rtx costs may have to be adjusted to constants that are represented as @code{CONST_WIDE_INT}. @end itemize -All and all it does not takes long to convert ports that the +All and all it does not take long to convert ports that the maintainer is familiar with. @end defmac Index: gcc/doc/tm.texi.in =================================================================== --- gcc/doc/tm.texi.in 2013-11-09 09:50:47.392396760 +0000 +++ gcc/doc/tm.texi.in 2013-11-09 11:07:22.758160572 +0000 @@ -7345,10 +7345,9 @@ Returns the negative of the floating poi Returns the absolute value of @var{x}. @end deftypefn -@deftypefn Macro void REAL_VALUE_FROM_INT (REAL_VALUE_TYPE @var{x}, HOST_WIDE_INT @var{val}, enum machine_mode @var{mode}) -Converts a double-precision integer found in @var{val}, -into a floating point value which is then stored into @var{x}. The -value is truncated to fit in mode @var{mode}. +@deftypefn Macro void REAL_VALUE_FROM_INT (REAL_VALUE_TYPE @var{x}, const wide_int_ref &@var{val}, enum machine_mode @var{mode}) +Converts integer @var{val} into a floating-point value which is then +stored into @var{x}. The value is truncated to fit in mode @var{mode}. @end deftypefn @node Mode Switching @@ -8404,15 +8403,15 @@ and the associated definitions of those @defmac TARGET_SUPPORTS_WIDE_INT On older ports, large integers are stored in @code{CONST_DOUBLE} rtl -objects. Newer ports define @code{TARGET_SUPPORTS_WIDE_INT} to be non -zero to indicate that large integers are stored in +objects. Newer ports define @code{TARGET_SUPPORTS_WIDE_INT} to be nonzero +to indicate that large integers are stored in @code{CONST_WIDE_INT} rtl objects. The @code{CONST_WIDE_INT} allows very large integer constants to be represented. @code{CONST_DOUBLE} -are limited to twice the size of host's @code{HOST_WIDE_INT} +is limited to twice the size of the host's @code{HOST_WIDE_INT} representation. Converting a port mostly requires looking for the places where -@code{CONST_DOUBLES} are used with @code{VOIDmode} and replacing that +@code{CONST_DOUBLE}s are used with @code{VOIDmode} and replacing that code with code that accesses @code{CONST_WIDE_INT}s. @samp{"grep -i const_double"} at the port level gets you to 95% of the changes that need to be made. There are a few places that require a deeper look. @@ -8442,7 +8441,7 @@ The rtx costs may have to be adjusted to constants that are represented as @code{CONST_WIDE_INT}. @end itemize -All and all it does not takes long to convert ports that the +All and all it does not take long to convert ports that the maintainer is familiar with. @end defmac Index: gcc/dwarf2out.c =================================================================== --- gcc/dwarf2out.c 2013-11-09 10:32:42.708323557 +0000 +++ gcc/dwarf2out.c 2013-11-09 11:07:22.762160602 +0000 @@ -348,7 +348,7 @@ #define DUMP_GSTRUCT(type, usage, criter #endif -/* Get the number of host wide ints needed to represent the precision +/* Get the number of HOST_WIDE_INTs needed to represent the precision of the number. */ static unsigned int Index: gcc/emit-rtl.c =================================================================== --- gcc/emit-rtl.c 2013-11-09 09:50:47.392396760 +0000 +++ gcc/emit-rtl.c 2013-11-09 11:07:22.763160609 +0000 @@ -547,8 +547,8 @@ rtx_to_double_int (const_rtx cst) #endif #if TARGET_SUPPORTS_WIDE_INT -/* Determine whether WIDE_INT, already exists in the hash table. If - so, return its counterpart; otherwise add it to the hash table and +/* Determine whether CONST_WIDE_INT WINT already exists in the hash table. + If so, return its counterpart; otherwise add it to the hash table and return it. */ static rtx @@ -562,11 +562,11 @@ lookup_const_wide_int (rtx wint) } #endif -/* V contains a wide_int. A CONST_INT or CONST_WIDE_INT (if - TARGET_SUPPORTS_WIDE_INT is defined) or CONST_DOUBLE if - TARGET_SUPPORTS_WIDE_INT is not defined is produced based on the - number of HOST_WIDE_INTs that are necessary to represent the value - in compact form. */ +/* Return an rtx constant for V, given that the constant has mode MODE. + The returned rtx will be a CONST_INT if V fits, otherwise it will be + a CONST_DOUBLE (if !TARGET_SUPPORTS_WIDE_INT) or a CONST_WIDE_INT + (if TARGET_SUPPORTS_WIDE_INT). */ + rtx immed_wide_int_const (const wide_int &v, enum machine_mode mode) { Index: gcc/tree.c =================================================================== --- gcc/tree.c 2013-11-09 09:58:55.587688532 +0000 +++ gcc/tree.c 2013-11-09 11:07:56.499414021 +0000 @@ -1252,7 +1252,7 @@ int_cst_hash_eq (const void *x, const vo /* Create an INT_CST node of TYPE and value CST. The returned node is always shared. For small integers we use a per-type vector cache, for larger ones we use a single hash table. - The value is extended from it's precision according to the sign of + The value is extended from its precision according to the sign of the type to be a multiple of HOST_BITS_PER_WIDE_INT. This defines the upper bits and ensures that hashing and value equality based upon the underlying HOST_WIDE_INTs works without masking. */ @@ -2018,7 +2018,9 @@ build_case_label (tree low_value, tree h return t; } -/* Build a newly constructed INETEGER_CST node of length LEN. */ +/* Build a newly constructed INTEGER_CST node. LEN and EXT_LEN are the + values of TREE_INT_CST_NUNITS and TREE_INT_CST_EXT_NUNITS respectively. + The latter determines the length of the HOST_WIDE_INT vector. */ tree make_int_cst_stat (int len, int ext_len MEM_STAT_DECL) Index: gcc/tree.h =================================================================== --- gcc/tree.h 2013-11-09 09:58:55.588688539 +0000 +++ gcc/tree.h 2013-11-09 11:07:22.765160624 +0000 @@ -3129,10 +3129,10 @@ omp_clause_elt_check (const_tree __t, in #endif -/* Checks that X is integer constant that can be expressed in signed - HOST_WIDE_INT without loss of precision. This function differs - from the tree_fits_* versions in that the signedness of the - type of X is not considered. */ +/* Checks that X is an integer constant that can be expressed in a signed + HOST_WIDE_INT without loss of precision. This function differs from + the tree_fits_* versions in that the signedness of the type of X is + not considered. */ static inline bool cst_fits_shwi_p (const_tree x) @@ -3143,10 +3143,10 @@ cst_fits_shwi_p (const_tree x) return TREE_INT_CST_NUNITS (x) == 1; } -/* Checks that X is integer constant that can be expressed in signed - HOST_WIDE_INT without loss of precision. This function differs - from the tree_fits_* versions in that the signedness of the - type of X is not considered. */ +/* Checks that X is an integer constant that can be expressed in an unsigned + HOST_WIDE_INT without loss of precision. This function differs from + the tree_fits_* versions in that the signedness of the type of X is + not considered. */ static inline bool cst_fits_uhwi_p (const_tree x)