From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32457 invoked by alias); 2 May 2006 10:44:17 -0000 Received: (qmail 32447 invoked by uid 22791); 2 May 2006 10:44:17 -0000 X-Spam-Check-By: sourceware.org Received: from mta07-winn.ispmail.ntl.com (HELO mtaout01-winn.ispmail.ntl.com) (81.103.221.47) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 02 May 2006 10:44:14 +0000 Received: from aamtaout02-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout01-winn.ispmail.ntl.com with ESMTP id <20060502104412.XEWW29343.mtaout01-winn.ispmail.ntl.com@aamtaout02-winn.ispmail.ntl.com> for ; Tue, 2 May 2006 11:44:12 +0100 Received: from zapata.pink ([82.6.101.32]) by aamtaout02-winn.ispmail.ntl.com with ESMTP id <20060502104412.YFWT24467.aamtaout02-winn.ispmail.ntl.com@zapata.pink> for ; Tue, 2 May 2006 11:44:12 +0100 Received: from zapata.pink (localhost.localdomain [127.0.0.1]) by zapata.pink (8.13.1/8.13.1) with ESMTP id k42AiHVE005899; Tue, 2 May 2006 11:44:17 +0100 Received: (from aph@localhost) by zapata.pink (8.13.1/8.13.1/Submit) id k42AiGBV005896; Tue, 2 May 2006 11:44:16 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17495.14336.508165.471838@zapata.pink> Date: Tue, 02 May 2006 10:44:00 -0000 From: Andrew Haley To: Stas Sergeev Cc: gcc-help@gcc.gnu.org Subject: Re: clobbering input args in inline asm In-Reply-To: <4453358D.8060600@aknet.ru> References: <445298BE.8000800@aknet.ru> <17491.10538.514085.559389@zapata.pink> <4453358D.8060600@aknet.ru> X-Mailer: VM 7.19 under Emacs 21.3.1 X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2006-05/txt/msg00005.txt.bz2 Stas Sergeev writes: > Andrew Haley wrote: > > The clobber list is for physical register names such as "ebx", not for > > operands. > Yes, that's why my question was not "why it still > doesn't work", but rather "what does the "0" mean, when > put in the clobber list?" It means nothing. > gcc accepts it there, and I wasn't able to find anywhere in the > docs, what does it mean. > > This is wrong: you're clobbering one of the inputs without telling > > gcc. > Yes, but the problem is, the way to tell this to gcc > looks very strange to me. Here's only what I've been > able to find in the docs: > --- > There is no way for you to specify that an input > operand is modified without also specifying it as an output > operand. Note that if all the output operands you specify are for this > purpose (and hence unused), you will then also need to specify > |volatile| for the |asm| construct, as described below, to > prevent GCC from deleting the |asm| statement as unused. > A quick googling shows many people are confused with that, too. I > am just curious, why there wasn't a better solution to such a > problem? gcc wants me to add the dummy output var for that, and > googling reveals some discussion that a better syntax was simply > not found. But IMHO, allowing "&" modifier in the input list is the > most natural way of expressing that the input is being clobbered > after the value is taken. > > > Assuming you actually want the output, it should be: > No, what I really want, is an input. I.e. I want to put the > input in %%ebx. But then, after I already used it, I want to > re-use %%ebx in an asm code. And here's the gotcha: re-using > %%ebx also alters the input operand, but not always - that > depends on an optimization level. I find that counter-intuitive, > hence the questions. You want to use something as an input operand, and you want to clobber it as well. OK, I get the idea. But the docs already explain that "there is no way for you to specify that an input operand is modified without also specifying it as an output operand." So, you already know this, but you want to know why. I suspect the simplest answer you're likely to get is that the reload pass is complicated enough already without adding yet another operand attribute, especially one which adds very little capability. Andrew.