From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11151 invoked by alias); 17 Oct 2011 08:30:21 -0000 Received: (qmail 11104 invoked by uid 22791); 17 Oct 2011 08:30:13 -0000 X-SWARE-Spam-Status: No, hits=-6.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 17 Oct 2011 08:29:54 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p9H8TrtX029490 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 17 Oct 2011 04:29:54 -0400 Received: from zebedee.pink (ovpn-113-55.phx2.redhat.com [10.3.113.55]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p9H8Tqnk032231; Mon, 17 Oct 2011 04:29:53 -0400 Message-ID: <4E9BE77F.5090508@redhat.com> Date: Mon, 17 Oct 2011 08:30:00 -0000 From: Andrew Haley User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.23) Gecko/20110928 Fedora/3.1.15-1.fc14 Thunderbird/3.1.15 MIME-Version: 1.0 To: gcc-help@gcc.gnu.org Subject: Re: gcc optimises out test of value in register-only loop References: <4E97FBC1.9080006@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2011-10/txt/msg00146.txt.bz2 On 10/15/2011 04:19 AM, Ian Lance Taylor wrote: > Andrew Haley writes: > >> On 10/14/2011 05:41 AM, Ian Lance Taylor wrote: >>> MikeW writes: >>> >>>> volatile register int stop_loop __asm("r5")__; >>> >>> gcc does not support volatile register variables. I think it could be >>> meaningful, but it has never worked. >> >> It would be really nasty to implement: we'd have to check for volatility >> on every access to a hard register. The benefits don't seem worth it, >> IMO. > > No, it's not that bad. At the tree level, we would only have to check > on every reference to a DECL for which DECL_REGISTER is true. When > expanding to RTL, we would replace each reference with a special > UNSPEC_VOLATILE which we handle specially when generating asm code. Or > perhaps simply expand each reference to a specially handled asm > statement. Ah yes, that would indeed work. Still doesn't seem worth it! :-) Andrew.