This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: asm() statements


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~

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]