From patchwork Wed Jul 16 09:46:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kyrylo Tkachov X-Patchwork-Id: 370686 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 892E014009E for ; Wed, 16 Jul 2014 19:46:56 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; q=dns; s=default; b=ocG0ubHIa5dy1xbDw hznAL7blguSQ3SplO5lhuXR9kZ3qoSuh6Lso2DlaAWd6eNqE4FZmMZtf4ZMHYcxz olbSTxPY8SRQ+iGKfzNgX54KU54g0axJ1QzFJFxAQOPWKZjPuMDfH1xs0jos4CDo Yebq398ZHSea9HiwU6Sr83P49U= 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 :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; s=default; bh=WnUMSHKfLi+JDanEToVcon/ O1Do=; b=ZCBUFRwUgCHBoqvY/LRAjTj2vtZzwLBIWmrqybOhiJvcmWpOdg1YLcq RSqcGG2HA6MfCbJVSJoO59e/QGIFuNSesyXf3g9Zs8/x43LE34A+BQMD2x5BXNHQ HyOfJOXhKEtESzCn5rANTbGdjwZSYKR7E913bT8l9ZSOZkSlfmyk= Received: (qmail 20649 invoked by alias); 16 Jul 2014 09:46:48 -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 20622 invoked by uid 89); 16 Jul 2014 09:46:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: service87.mimecast.com Received: from service87.mimecast.com (HELO service87.mimecast.com) (91.220.42.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 16 Jul 2014 09:46:45 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Wed, 16 Jul 2014 10:46:42 +0100 Received: from [10.1.208.24] ([10.1.255.212]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 16 Jul 2014 10:46:40 +0100 Message-ID: <53C64A00.7080303@arm.com> Date: Wed, 16 Jul 2014 10:46:40 +0100 From: Kyrill Tkachov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: James Greenhalgh CC: GCC Patches , "gerald@pfeifer.com" Subject: Re: [PATCH][doc] Document clrsb optab and fix some inconsistencies References: <53C63242.3010905@arm.com> <20140716082542.GA13321@arm.com> In-Reply-To: <20140716082542.GA13321@arm.com> X-MC-Unique: 114071610464221901 X-IsSubscribed: yes On 16/07/14 09:25, James Greenhalgh wrote: > On Wed, Jul 16, 2014 at 09:05:22AM +0100, Kyrill Tkachov wrote: >> Hi all, >> >> I noticed we don't document the clrsb2 optab but it does exist. >> The proposed description is based on the clrsb RTL code documentation in >> rtl.texi. >> While we're at it, clean up the wording for some other cases in the file >> which refer to an argument 'x' when they mean to refer to operand 1. >> They were probably copied over from rtl.texi which does use 'x'. >> >> Ok for trunk? >> >> 2014-07-16 Kyrylo Tkachov >> >> * doc/md.texi (clrsb): Document. >> (clz): Change reference to x into operand 1. >> (ctz): Likewise. >> (popcount): Likewise. >> (parity): Likewise. >> commit 8f0f09fbf6e8ee8136d4977f9819ee1997f82963 >> Author: Kyrylo Tkachov >> Date: Tue Jul 15 17:41:29 2014 +0100 >> >> [DOC] Document clrsb optab >> >> diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi >> index fde67d7..268f625 100644 >> --- a/gcc/doc/md.texi >> +++ b/gcc/doc/md.texi >> @@ -5316,10 +5316,17 @@ generating the instruction. >> The @code{ffs} built-in function of C always uses the mode which >> corresponds to the C data type @code{int}. >> >> +@cindex @code{clrsb@var{m}2} instruction pattern >> +@item @samp{clrsb@var{m}2} >> +Store into operand 0 the number of redundant sign bits in operand 1, starting >> +at the most significant bit position. >> +This is one less than the number of leading sign bits (either 0 or 1), >> +with no special cases. >> + > This reads unclear to me. If I have no knowledge of clrsb the sentence: > > "This is one less than the number of leading sign bits (either 0 or 1)" > > can be read as suggesting that there are either 0 or 1 leading sign bits, > with clrsb setting operand 0 to be one less than that (either -1 or 0). > > I think giving the example of what "sign bits" are is unnecessary, likewise > the "with no special cases" clause. The only term which might need introducing > is what a redundant sign bit is. I also find it polite to expand the acronym > shortly after first use. I think this hunk would read clearer as: > > "Count leading redundant sign bits. > > Store into operand 0 the number of redundant sign bits in operand 1, > starting at the most significant bit position. > > A redundant sign bit is defined as any sign bit after the first. As such, > this count will be one less than the count of leading sign bits." Hi James, You're right, the text is somewhat ambiguous, here is the patch with your suggestion. Any of the two versions can go in I guess, although this second one is clearer IMHO. Thanks, Kyrill 2014-07-16 Kyrylo Tkachov James Greenhalgh * doc/md.texi (clrsb): Document. (clz): Change reference to x into operand 1. (ctz): Likewise. (popcount): Likewise. (parity): Likewise. commit 57d892f820a8f3b233c087862fad0887cee06127 Author: Kyrylo Tkachov Date: Tue Jul 15 17:41:29 2014 +0100 [DOC] Document clrsb optab diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi index fde67d7..dd78611 100644 --- a/gcc/doc/md.texi +++ b/gcc/doc/md.texi @@ -5316,10 +5316,18 @@ generating the instruction. The @code{ffs} built-in function of C always uses the mode which corresponds to the C data type @code{int}. +@cindex @code{clrsb@var{m}2} instruction pattern +@item @samp{clrsb@var{m}2} +Count leading redundant sign bits. +Store into operand 0 the number of redundant sign bits in operand 1, starting +at the most significant bit position. +A redundant sign bit is defined as any sign bit after the first. As such, +this count will be one less than the count of leading sign bits. + @cindex @code{clz@var{m}2} instruction pattern @item @samp{clz@var{m}2} -Store into operand 0 the number of leading 0-bits in @var{x}, starting -at the most significant bit position. If @var{x} is 0, the +Store into operand 0 the number of leading 0-bits in operand 1, starting +at the most significant bit position. If operand 1 is 0, the @code{CLZ_DEFINED_VALUE_AT_ZERO} (@pxref{Misc}) macro defines if the result is undefined or has a useful value. @var{m} is the mode of operand 0; operand 1's mode is @@ -5328,8 +5336,8 @@ operand to that mode before generating the instruction. @cindex @code{ctz@var{m}2} instruction pattern @item @samp{ctz@var{m}2} -Store into operand 0 the number of trailing 0-bits in @var{x}, starting -at the least significant bit position. If @var{x} is 0, the +Store into operand 0 the number of trailing 0-bits in operand 1, starting +at the least significant bit position. If operand 1 is 0, the @code{CTZ_DEFINED_VALUE_AT_ZERO} (@pxref{Misc}) macro defines if the result is undefined or has a useful value. @var{m} is the mode of operand 0; operand 1's mode is @@ -5338,15 +5346,15 @@ operand to that mode before generating the instruction. @cindex @code{popcount@var{m}2} instruction pattern @item @samp{popcount@var{m}2} -Store into operand 0 the number of 1-bits in @var{x}. @var{m} is the +Store into operand 0 the number of 1-bits in operand 1. @var{m} is the mode of operand 0; operand 1's mode is specified by the instruction pattern, and the compiler will convert the operand to that mode before generating the instruction. @cindex @code{parity@var{m}2} instruction pattern @item @samp{parity@var{m}2} -Store into operand 0 the parity of @var{x}, i.e.@: the number of 1-bits -in @var{x} modulo 2. @var{m} is the mode of operand 0; operand 1's mode +Store into operand 0 the parity of operand 1, i.e.@: the number of 1-bits +in operand 1 modulo 2. @var{m} is the mode of operand 0; operand 1's mode is specified by the instruction pattern, and the compiler will convert the operand to that mode before generating the instruction.