On Mon, 2 Aug 2010, Bingfeng Mei wrote:
> Hi, > I ran a small test to see how the trunk/4.5 works > with the rewritten restrict qualified pointer code. But it doesn't > seem to work on both x86-64 and our port. > > tst.c: > void foo (int * restrict a, int * restrict b, > int * restrict c, int * restrict d) > { > *c = *a + 1; > *d = *b + 1; > } [snip] > foo: > .LFB0: > .cfi_startproc > movl (%rdi), %eax > addl $1, %eax > movl %eax, (%rdx) > movl (%rsi), %eax > addl $1, %eax > movl %eax, (%rcx) > ret > > In the finally generated code, the second load should have > been moved before the first store if restrict qualifiers > are handled correctly. > > Am I missing something here? Thanks. The second load is moved for me with -fschedule-insns, -frename-registers or -fselective-scheduling2 (all of which are disabled by default on x86-64 -O2). Without those flags, second scheduler alone cannot lift the load due to dependency on %eax. Hope that helps. Alexander