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 and "cc" "memory" volatile etc.. (slightly offtopic)


On Tue, Nov 11, 1997 at 10:59:21AM -0700, Jeffrey A Law wrote:
>   > Is there some way to say gcc, that is just updates given block of memory
>   > (rtl expression for memcpy dont say clobbers:memory but says set BLK...
>   > is there any way to write this in asm?)
> I'm not aware of any way to selectively tell gcc that only a certain block
> of memory is read/clobbered by an asm (or any BLKmode instruction).

The following has been found to be effective.

	struct large_struct { unsigned long buf[1234]; };
	#define m(x) (*(struct large_struct *)(x))
	
	extern inline int test_bit(int nr, void *addr)
	{
		int ret;
		__asm__("btl %2,%1\n\tsbbl %0,%0"
			: "=r"(ret)
			: "m"(m(addr)), "ir"(nr));
		return ret;
	}


r~


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