This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: asm() statements
- To: Dan Hovang <dan at wespot dot com>
- Subject: Re: asm() statements
- From: Richard Henderson <rth at cygnus dot com>
- Date: Wed, 16 Aug 2000 01:19:53 -0700
- Cc: gcc at gcc dot gnu dot org
- References: <399A460F.3AF3828F@wespot.net>
On Wed, Aug 16, 2000 at 09:43:12AM +0200, Dan Hovang wrote:
> asm("adcs %0, %1, %2 lsl #1" : "=r"(n) : "r"(d), "0"(n) : "cc");
> asm("rsbcc %0, %1, %2" : "=r"(n) : "r"(d), "0"(n));
> asm("adcs %0, %1, %1" : "=r"(q) : "0"(q) : "cc");
>
> My problem is that the optimizer removes the top two instructions...
The proper way to do this is to put all three instructions
in the same asm block:
asm ("adcs %1, %2, %1 lsl #1\n\t"
"rsbcc %1, %2, %1\n\t"
"adcs %0, %0, %0"
: "=r"(q), "=r"(n)
: "r"(d), "0"(q), "1"(n)
: "cc");
r~