From owner-freebsd-current Thu Dec 13 12:19: 0 2001 Delivered-To: freebsd-current@freebsd.org Received: from netau1.alcanet.com.au (ntp.alcanet.com.au [203.62.196.27]) by hub.freebsd.org (Postfix) with ESMTP id 6816737B419; Thu, 13 Dec 2001 12:18:48 -0800 (PST) Received: from mfg1.cim.alcatel.com.au (mfg1.cim.alcatel.com.au [139.188.23.1]) by netau1.alcanet.com.au (8.9.3 (PHNE_22672)/8.9.3) with ESMTP id HAA19324; Fri, 14 Dec 2001 07:18:45 +1100 (EDT) Received: from gsmx07.alcatel.com.au by cim.alcatel.com.au (PMDF V5.2-32 #37640) with ESMTP id <01KBUM081E9CVMB7FB@cim.alcatel.com.au>; Fri, 14 Dec 2001 07:18:43 +1100 Received: (from jeremyp@localhost) by gsmx07.alcatel.com.au (8.11.6/8.11.6) id fBDKIgr39776; Fri, 14 Dec 2001 07:18:42 +1100 Content-return: prohibited Date: Fri, 14 Dec 2001 07:18:42 +1100 From: Peter Jeremy Subject: Re: Patch Review: i386 asm cleanups in the kernel In-reply-to: <20011206201803.Q14784-100000@gamplex.bde.org>; from bde@zeta.org.au on Thu, Dec 06, 2001 at 08:40:29PM +1100 To: Bruce Evans Cc: John Baldwin , current@FreeBSD.ORG Mail-Followup-To: Bruce Evans , John Baldwin , current@FreeBSD.ORG Message-id: <20011214071841.Y73243@gsmx07.alcatel.com.au> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-disposition: inline User-Agent: Mutt/1.2.5i References: <20011206201803.Q14784-100000@gamplex.bde.org> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Thu, Dec 06, 2001 at 08:40:29PM +1100, Bruce Evans wrote: >On Wed, 5 Dec 2001, John Baldwin wrote: > >> On 05-Dec-01 Bruce Evans wrote: >> >> - Add missing "cc" clobbers in constraints >> > >> > Does this have any effect (for i386's) except to create a lot of clutter >> > Even i386.md doesn't use it. gcc.info says: >> > ... >> > None of i386.md, alpha.md or sparc.md do this. i386's and alphas have a >> > cc0 register, but it is only mentioned for instructsions whose main (only?) >> > effect is to to set the condition codes. >> >> Hmm, so how does one clobber "eflags" if "cc" isn't "eflags"? > >Neither seems to be in gcc/config/i386/i386.h. I think "cc" is generic, so >using it in clobber lists is not wrong. To quote the "Extended Asm" section of the GCC info file: " If your assembler instruction can alter the condition code register, add `cc' to the list of clobbered registers. GNU CC on some machines represents the condition codes as a specific hardware register; `cc' serves to name this register. On other machines, the condition code is handled differently, and specifying `cc' has no effect. But it is valid no matter what the machine." >> Look at PR >> gnu/32365 which seems to indicate that "cc" does, in fact, represent "eflags" >> in the clobber list. My understanding (from the above quote) is that "cc" is a generic virtual register used to represent a processor's condition codes - independent of how the processor actually implements conditions. "eflags" is the physical i386 register containing the condition codes (amongst other things). >That gives a hint about where to look for the clobbering conventions. From >gcc/config/i386/i386.c: ... >Application asms are apparently in the "All else" set. This appears to come down to a case of the generic documentation requiring "cc" clobbers, whereas the current implementation on the i386 doesn't. >The bug in the PR could probably be fixed without updating this function >by using leal instead of addl to adjust the stack. Good point. There seem to be 3 options: 1a) Modify notice_update_cc() to recognize the RTL associated with mov[sdx]f_push and clobber the condition codes in that case. This is the approach I suggested in the PR. 1b) Modify the mov[sdx]f_push templates in i386.md to do a CC_STATUS_INIT. I have implemented this and it seems to work. I'll post it into the PR at some stage. 2) Modify the mov[sdx]f_push templates in i386.md to use leal ISO subl. This is probably the best option since it will preserve the condition code. Unfortunately, I'm not sure how to define an RTX for "-4(%esp)", a quick rummage suggests adj_offsettable_operand(), but that doesn't allow negative offsets. Peter To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message