Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Dec 2001 07:18:42 +1100
From:      Peter Jeremy <peter.jeremy@alcatel.com.au>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        John Baldwin <jhb@FreeBSD.ORG>, current@FreeBSD.ORG
Subject:   Re: Patch Review: i386 asm cleanups in the kernel
Message-ID:  <20011214071841.Y73243@gsmx07.alcatel.com.au>
In-Reply-To: <20011206201803.Q14784-100000@gamplex.bde.org>; from bde@zeta.org.au on Thu, Dec 06, 2001 at 08:40:29PM %2B1100
References:  <XFMail.011205155406.jhb@FreeBSD.org> <20011206201803.Q14784-100000@gamplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011214071841.Y73243>