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]
Other format: [Raw text]

restrict and char pointers


Hi,

I have a question concerning '__restrict__' :

With gcc-4.0.0 (-O3 -fomit-frame-pointer, on i686), following piece of code :


void test_1(unsigned long* __restrict__ bar, unsigned long* __restrict__ bas)
{
  unsigned long tmp = *bar;
  *bas = 0;
  *bar = tmp;
}

void test_2(unsigned long* __restrict__ bar, char* __restrict__ bas)
{
  unsigned long tmp = *bar;
  *bas = 0;
  *bar = tmp;
}


compiles to :

_Z6test_1PmS_:
	movl	8(%esp), %edx
	movl	$0, (%edx)
	ret


_Z6test_2PmPc:
	movl	4(%esp), %eax
	movl	8(%esp), %edx
	movl	(%eax), %ecx
	movb	$0, (%edx)
	movl	%ecx, (%eax)
	ret



I would expect that the second case compiles to :
	movl	8(%esp), %edx
	movb	$0, (%edx)
	ret


Greetings,
-- 
Jeroen Dobbelaere


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