From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24159 invoked by alias); 18 Feb 2004 13:55:36 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 24150 invoked by uid 48); 18 Feb 2004 13:55:35 -0000 Date: Wed, 18 Feb 2004 13:55:00 -0000 From: "hoogerbrugge at hotmail dot com" To: gcc-bugs@gcc.gnu.org Message-ID: <20040218135530.14192.hoogerbrugge@hotmail.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug middle-end/14192] New: Restrict pointers don't help X-Bugzilla-Reason: CC X-SW-Source: 2004-02/txt/msg01801.txt.bz2 List-Id: I have two problems. It could be that they are related. First. In the following code there is no dependence between the two stores which is what I would expect: void restricttest2(int *restrict p, int *restrict q) { *p = 0; *q = 0; } However, if only one of the two pointers is restrict then gcc generates a dependence. void restricttest1(int *restrict p, int *q) { *p = 0; *q = 0; } According to my interpretation of the restrict spec this is not necessary. Also, two other (non-gcc) compilers that I have as a reference don't generate this dependence. The second case is the following loop: void copy(int *restrict pb, int *restrict qb) { int i; for(i = 0; i < 100; i++) { qb[i] = pb[i]; i++; qb[i] = pb[i]; i++; qb[i] = pb[i]; i++; qb[i] = pb[i]; } } When compiled with -fno-unroll-loops I see lots of dependences between the loads and stores. _copy: .function /***************************/ ident r6 -> r35 ident r5 -> r34 ident r0 -> r33 iaddi(99) r0 -> r36 L5: asli(2) r33 -> r51 iaddi(1) r33 -> r52 asli(2) r52 -> r46 iaddi(2) r33 -> r47 iadd r51 r34 -> r50 asli(2) r47 -> r41 iaddi(3) r33 -> r42 iadd r51 r35 -> r48 ld32 r50 -> r49 [ID=1125][REGION=2] iadd r46 r34 -> r45 st32 r48 r49 [ID=1031][REGION=2] asli(2) r42 -> r37 iadd r46 r35 -> r43 ld32 r45 -> r44 [ID=1126][REGION=2] iadd r41 r34 -> r40 st32 r43 r44 [ID=1040][REGION=2] iadd r41 r35 -> r38 ld32 r40 -> r39 [ID=1127][REGION=2] iadd r37 r34 -> r9 st32 r38 r39 [ID=1049][REGION=2] iaddi(4) r33 -> r33 iadd r37 r35 -> r8 ld32 r9 -> r7 [ID=1128][REGION=2] st32 r8 r7 [ID=1058][REGION=2] igtr r33 r36 -> r6 if !r6 ijmpi(L5) [PROB=96] /***************************/ ijmpf r0 r2 /* return */ .depend 1128 -> 1058 .depend 1049 -> 1058 .depend 1127 -> 1049 .depend 1040 -> 1049 1058 .depend 1126 -> 1040 .depend 1031 -> 1040 1049 1058 .depend 1125 -> 1031 .endfunction (The .depend line indicate dependences between instructions (IDs)) However, in this loop there are no dependences at all: void zero(int *restrict qb) { int i; for(i = 0; i < 100; i++) { qb[i] = 0; i++; qb[i] = 0; i++; qb[i] = 0; i++; qb[i] = 0; } } I use "gcc version 3.5.0 20040119 (experimental)" I observe the dependences in the INSN_DEPEND(insn) list in sched_finish(). -- Summary: Restrict pointers don't help Product: gcc Version: 3.5.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: middle-end AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: hoogerbrugge at hotmail dot com CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: linux GCC host triplet: linux GCC target triplet: trimedia http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14192