This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Restrict qualifier still not working?
- From: Alexander Monakov <amonakov at ispras dot ru>
- To: Bingfeng Mei <bmei at broadcom dot com>
- Cc: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>, Richard Guenther <richard dot guenther at gmail dot com>
- Date: Mon, 2 Aug 2010 20:47:57 +0400 (MSD)
- Subject: Re: Restrict qualifier still not working?
- References: <7FB04A5C213E9943A72EE127DB74F0ADA6898CBA4F@SJEXCHCCR02.corp.ad.broadcom.com>
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