This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: ia64 branch register opts
- From: David Mosberger <davidm at napali dot hpl dot hp dot com>
- To: Richard Henderson <rth at twiddle dot net>
- Cc: davidm at hpl dot hp dot com, gcc-patches at gcc dot gnu dot org
- Date: Fri, 25 Jul 2003 17:11:58 -0700
- Subject: Re: ia64 branch register opts
- References: <20030725154659.GA9266@twiddle.net>
- Reply-to: davidm at hpl dot hp dot com
>>>>> On Fri, 25 Jul 2003 08:46:59 -0700, Richard Henderson <rth@twiddle.net> said:
Rich> As discussed at OLS, wrt optimizing indirect function calls.
Rich> Will you try this and see if it provides enough improvement
Rich> to warrent cleaning up properly?
Well, the initial results are encouraging! It's generating exactly
the code I was hoping for! Here is an example:
$ cat t1.c
int r;
int foo (int count, void (*fp0) (void), void (*fp1) (void)) {
int i;
for (i = 0; i < count; ++i) {
(*fp0)();
(*fp1)();
}
return r;
}
$ cc1 -O2 t1.c
$ cat t1.s
foo:
alloc r36 = ar.pfs, 3, 6, 0, 0
mov r38 = ar.lc
cmp4.ge p6, p7 = 0, r32
mov r37 = r1
sxt4 r14 = r32
mov r39 = b1 ;;
adds r14 = -1, r14
mov r40 = b2
mov r35 = b0
(p6) br.cond.dpnt .L7 ;;
mov ar.lc = r14
ld8 r15 = [r33], 8 ;;
mov b2 = r15
ld8 r15 = [r34], 8
ld8 r33 = [r33] ;;
mov b1 = r15
ld8 r34 = [r34]
.L8: mov r1 = r33
br.call.sptk.many b0 = b2 ;;
mov r1 = r34
br.call.sptk.many b0 = b1 ;;
br.cloop.sptk.few .L8
mov r1 = r37 ;;
.L7: addl r14 = @ltoff(r#), r1
mov b0 = r35 ;;
ld8 r14 = [r14]
mov b1 = r39
mov b2 = r40 ;;
ld4 r8 = [r14]
mov ar.pfs = r36
mov ar.lc = r38
br.ret.sptk.many b0
When passing empty (null) functions to fp0 and fp1, the new code
is 58% faster on McKinley. Even on Merced (which has a more
complicated indirect branch predictor) the new code is 16% faster.
I'll try it now on the Linux kernel.
Thanks,
--david