John Love-Jensen wrote:
Hi Wouter, What happens if you tell the compiler than the two cannot alias? I think this is sufficient to do that... ----------------------- /* -DT=short or -DT=char */ int count; T f(T* restrict p) { count += 2; T t = *p; count += 3; return t; } ----------------------- gcc -std=iso9899:1999 -DT=char -O3 -S test.c -o test-char.s gcc -std=iso9899:1999 -DT=short -O3 -S test.c -o test-short.s vi -d test-char.s test-short.s
I already tried this, but unfortunately it doesn't work for me :( > gcc -std=iso9899:1999 -DT=char -O3 -S test.c -o test-char.s > cat test-char.s ... movl count(%rip), %edx leal 2(%rdx), %eax addl $5, %edx movl %eax, count(%rip) movzbl (%rdi), %eax movl %edx, count(%rip) ret ... > gcc --version gcc (GCC) 4.3.0 20071119 (experimental) ... > uname -a Linux argon 2.6.22-3-amd64 #1 SMP Sun Nov 4 18:18:09 UTC 2007 x86_64 GNU/Linux But thanks anyway. Wouter