From patchwork Tue Apr 26 00:16:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Wohlferd X-Patchwork-Id: 614744 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 3qv3Yx2zdbz9t5w for ; Tue, 26 Apr 2016 10:17:07 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=vFDYgIhx; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=gU54QmjYeiSNUjuAX yoy3ITcz2GEaHkvJvihmh+c+XGmexNdsOQv+a3q+c+uvskGm9o3SGhVIx1jMxyxl x/XEdXtKsUC2D3ggU+m9X0yauOvOgtk/2RkNa4RiCpqsDgazhr11zr1QIUI6b3yM eJex+XxdJEUrMkhgEgTUM+m6Qw= 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 :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=hMEbyNDKbCExg+bHCZJh3/f ikzI=; b=vFDYgIhxMuOxpVLV2kOSMgWkVXjDst1AyA2j3gfIrVqW0vxy2k9Bc2G dLBNj1Qg59eacy7BCgst9NQeY00T73BEcD64OhE1vvdosrr5+gJlW9BEwhFwYF3P B3kmpa3fI6BS9IrkGgPvExPUaXzonXtvtEnJe/MJVdjH2YrvgwEM= Received: (qmail 14908 invoked by alias); 26 Apr 2016 00:16:59 -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 14892 invoked by uid 89); 26 Apr 2016 00:16:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=BAYES_20, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=HX-HELO:sk:bosmail, H*r:10.20.18, H*RU:sk:bosmail, Hx-spam-relays-external:sk:bosmail X-HELO: bosmailout01.eigbox.net Received: from bosmailout01.eigbox.net (HELO bosmailout01.eigbox.net) (66.96.189.1) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Tue, 26 Apr 2016 00:16:56 +0000 Received: from bosmailscan15.eigbox.net ([10.20.15.15]) by bosmailout01.eigbox.net with esmtp (Exim) id 1auqgQ-00088l-U4 for gcc-patches@gcc.gnu.org; Mon, 25 Apr 2016 20:16:54 -0400 Received: from [10.115.3.32] (helo=bosimpout12) by bosmailscan15.eigbox.net with esmtp (Exim) id 1auqgQ-0007QX-S8 for gcc-patches@gcc.gnu.org; Mon, 25 Apr 2016 20:16:54 -0400 Received: from bosauthsmtp18.yourhostingaccount.com ([10.20.18.18]) by bosimpout12 with id moGp1s00e0PPbB601oGsUq; Mon, 25 Apr 2016 20:16:54 -0400 X-Authority-Analysis: v=2.1 cv=Zs9jKrLG c=1 sm=1 tr=0 a=hsonH7E3nOZjOFuRJksPKA==:117 a=yaJPzSxU0ca7efuSXgrUAw==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=88b2x-oFWvEA:10 a=kziv93cY1bsA:10 a=r77TgQKjGQsHNAKrUKIA:9 a=1nAU2-cptWaP3MPRlo4A:9 a=QEXdDO2ut3YA:10 a=OXu-fC26WW81zUES9jYA:9 Received: from 72-160-94-49.dyn.centurytel.net ([72.160.94.49]:50592 helo=[192.168.1.160]) by bosauthsmtp18.eigbox.net with esmtpa (Exim) id 1auqgK-0002R2-7w; Mon, 25 Apr 2016 20:16:49 -0400 Subject: Re: [DOC Patch] Add sample for @cc constraint To: Bernd Schmidt References: <56E4E5D6.4030500@LimeGreenSocks.com> <56F40103.8080600@redhat.com> <56F85899.4010201@LimeGreenSocks.com> <56FA6B82.9080308@redhat.com> <56FF06A7.8040900@LimeGreenSocks.com> <570C29F9.5080305@LimeGreenSocks.com> <570CF2C2.1000108@redhat.com> <5711756E.4000603@LimeGreenSocks.com> <571DE898.4020905@redhat.com> Cc: "gcc-patches@gcc.gnu.org" , Richard Henderson , Sandra Loosemore , David Wohlferd From: David Wohlferd Message-ID: <245ed05c-e585-e8e8-c177-a548d7e19921@LimeGreenSocks.com> Date: Mon, 25 Apr 2016 17:16:33 -0700 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: <571DE898.4020905@redhat.com> X-EN-UserInfo: 97390230d6758ac7ebdf93f8c6197d31:931c98230c6409dcc37fa7e93b490c27 X-EN-AuthUser: dw@limegreensocks.com X-EN-OrigIP: 72.160.94.49 X-EN-OrigHost: 72-160-94-49.dyn.centurytel.net On 4/25/2016 2:51 AM, Bernd Schmidt wrote: > On 04/16/2016 01:12 AM, David Wohlferd wrote: >> There were basically 3 changes I was trying for in that doc patch. Are >> any of them worth keeping? Or are we done? >> >> 1) "Do not clobber flags if they are being used as outputs." >> 2) Output flags sample (with #if removed). >> 3) "On the x86 platform, flags are always treated as clobbered by >> extended asm whether @code{"cc"} is specified or not." >> >> I'm prepared to send an updated patch if there's anything here that >> might get approved. > > I think the updated flags sample would be nice to have. Attached. dw Index: extend.texi =================================================================== --- extend.texi (revision 235054) +++ extend.texi (working copy) @@ -8135,6 +8135,26 @@ ``not'' @var{flag}, or inverted versions of those above @end table +This example uses the @code{bt} instruction (which sets the carry flag) to +see if bit 0 of an integer is set. To see the improvement in the generated +output, make sure optimizations are enabled. + +@example +void TestEven (int value) +@{ + char CarryIsSet; + + asm ("bt $0, %[value]" + : "=@@ccc" (CarryIsSet) + : [value] "rm" (value)); + + if (CarryIsSet) + printf ("odd\n"); + else + printf ("even\n"); +@} +@end example + @end table @anchor{InputOperands}