This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/14192] Restrict pointers don't help
- From: "hoogerbrugge at hotmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Feb 2004 14:02:51 -0000
- Subject: [Bug middle-end/14192] Restrict pointers don't help
- References: <20040218135530.14192.hoogerbrugge@hotmail.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From hoogerbrugge at hotmail dot com 2004-02-19 14:02 -------
I can demonstrate the problem on ia64. Here are three cases:
int zero_restrict_pointers(int *p, int *q)
{
*p = 0;
return *q;
}
int one_restrict_pointer(int *restrict p, int *q)
{
*p = 0;
return *q;
}
int two_restrict_pointers(int *restrict p, int *restrict q)
{
*p = 0;
return *q;
}
This gives the following ia64 code (version 20040217):
.pred.safe_across_calls p1-p5,p16-p63
.text
.align 16
.global zero_restrict_pointers#
.proc zero_restrict_pointers#
zero_restrict_pointers:
.prologue
.body
.mmb
nop 0
st4 [r32] = r0
nop 0
.mbb
ld4 r8 = [r33]
nop 0
br.ret.sptk.many b0
.endp zero_restrict_pointers#
.align 16
.global one_restrict_pointer#
.proc one_restrict_pointer#
one_restrict_pointer:
.prologue
.body
.mmb
nop 0
st4 [r32] = r0
nop 0
.mbb
ld4 r8 = [r33]
nop 0
br.ret.sptk.many b0
.endp one_restrict_pointer#
.align 16
.global two_restrict_pointers#
.proc two_restrict_pointers#
two_restrict_pointers:
.prologue
.body
.mmb
nop 0
ld4 r8 = [r33]
nop 0
.mbb
st4 [r32] = r0
nop 0
br.ret.sptk.many b0
.endp two_restrict_pointers#
.ident "GCC: (GNU) 3.5.0 20040217 (experimental)"
As you can imagine, the scheduler wants to schedule the long latency
load above the store. As you can see, this only happens in the case
of two restrict pointers. I would also like to see it happen in the
case of one restrict pointer.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14192