From: Jeffrey A Law <law@hurl.cygnus.com>
To: Christof Petig <christof.petig@wtal.de>
Cc: linux-kernel@vger.rutgers.edu, egcs@cygnus.com
Subject: Re: egcs 1.0.1 miscompiles Linux 2.0.33
Date: Wed, 04 Mar 1998 11:26:40 -0700 [thread overview]
Message-ID: <2620.889036000@hurl.cygnus.com> (raw)
In-Reply-To: Your message of Tue, 03 Mar 1998 10:19:10 MST. <34FBCB0C.42D8AD1C@wtal.de>
In message <34FBCB0C.42D8AD1C@wtal.de>you write:
> Dear Jeff,
>
> I was a shocked by these misunderstandings. Seems that you never tried
> to use an asm() on an i386 computer.
No, I don't use x86 asms a lot. But I've had the "pleasure" of
working with asms on various machines and developing gcc for about
9 years now. So I have more than a clue about how things are
supposed to work :-)
> What we would like to do is:
>
> - setup register ecx with (-1), esi with (cs).
> - execute run the asm-statements
> - tell gcc that ecx and esi do no longer contain the values (-1) and
> (cs)
>
> What would be the correct way to tell this to gcc if not by inputs and
> clobbers?
As folks have stated, the proper way to do this is to set up matching
input/output operands with the output as an earlyclobber. The manual
needs updating in this regard since it is ambigious.
Any asm which sets up a case where a clobber must match an input
is wrong. Plain and simple, it is wrong.
> come on ... this doesn't touch the problem at the head of this message
> (we need to pass a value that is clobbered.) Unless you recommend
> pushing all passed values on the stack and restoring them before we
> leave the asm(). This would make the asm() statement needless, since it
> would never _optimize_ anything for a certain machine.
Yes it does. By claiming its a dummy output the compiler will not
try to use that register to hold any other values across the asm
statement.
By having the an input match the output, you can pass a value to
the asm in a register.
And finally, the earlyclobber on the output prevents the compiler
from associating any unrelated input with the given output.
This mechanism is designed to do exactly what you want it to do
modulo any bugs.
> Or is the question:
> - is it valid to use a asm() for machine specific optimizations?
>
> Sorry for answering this emotionally but I can't understand why this
> need is not obvious to compiler designers.
The need for the mechanism is obvious, the mechanism currently used
by Linux is wrong.
jeff
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
next parent reply other threads:[~1998-03-04 17:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <34FBCB0C.42D8AD1C@wtal.de>
1998-03-04 18:26 ` Jeffrey A Law [this message]
[not found] <199803050021.TAA10868@saturn.cs.uml.edu>
1998-03-05 0:34 ` egcs 1.0.1 miscompiles Linux 2.0.33 Jeffrey A Law
[not found] <34FE6DB6.4D2CCA22@wtal.de>
1998-03-09 6:27 ` Jeffrey A Law
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2620.889036000@hurl.cygnus.com \
--to=law@hurl.cygnus.com \
--cc=christof.petig@wtal.de \
--cc=egcs@cygnus.com \
--cc=law@cygnus.com \
--cc=linux-kernel@vger.rutgers.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox