This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFA: fix bugs in likely_spilled_retval_1 / likely_spilled_retval_p
- From: Rask Ingemann Lambertsen <rask at sygehus dot dk>
- To: Joern RENNECKE <joern dot rennecke at st dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Richard Henderson <rth at redhat dot com>
- Date: Sat, 22 Apr 2006 12:33:43 +0200
- Subject: Re: RFA: fix bugs in likely_spilled_retval_1 / likely_spilled_retval_p
- References: <42C44729.1070207@st.com> <20050701064213.GA2225@redhat.com> <42C576F5.8060702@st.com> <20060403191814.GA24245@sygehus.dk> <4433CF29.9020200@st.com>
On Wed, Apr 05, 2006 at 03:07:37PM +0100, Joern RENNECKE wrote:
> I have made this into an actual patch and successfully regression tested
> it on i686-pc-linux-gnu X sh-elf.
> I can't do a bootstrap regression test because mainline doesn't
> bootstrap on my host
I'll start a bootstrap regression test on i686-pc-linux-gnu this afternoon
on the weekly snapshot.
The patch decreases the code size of _popcountsi2() from 108 bytes to 78
bytes for my i8086 backend. That's because it has the return register(s)
in CLASS_LIKELY_SPILLED_P() and combine would therefore think it should not
try to combine any instructions. Now it will combine away three SImode
shifts and combine four zero extensions into address calculations.
Before the patch:
__popcountsi2:
.LFB2:
.LM1:
.LVL0:
pushw %cx
pushw %bx
pushw %si
pushw %di
pushw %bp
subw $6, %sp
movw %sp, %si
movw 8(%si), %dx
.LVL1:
movw 10(%si), %bx
.LM2:
movw %bx, %cx
xorb %ch, %ch
movw %cx, %si
movw $__popcount_tab, %di
movw %di, %bp
movb (%bp,%si), %al
movw %sp, %bp
movb %al, 4(%bp)
movb $0, 5(%bp)
.LVL2:
movb %dh, (%bp)
movw %bx, 1(%bp)
movb $0, 3(%bp)
movw (%bp), %cx
xorb %ch, %ch
movw %cx, %si
movw %di, %bp
movb (%bp,%si), %cl
xorb %ch, %ch
movw %sp, %si
addw %cx, 4(%si)
movw %dx, %cx
xorb %ch, %ch
movw %cx, %si
movb (%bp,%si), %cl
xorb %ch, %ch
movw %sp, %si
addw 4(%si), %cx
.LVL3:
movb %bh, %bl
xorb %bh, %bh
.LVL4:
movw %bx, %ax
xorb %ah, %ah
movw %ax, %si
movw %di, %bx
movb (%bx,%si), %al
xorb %ah, %ah
addw %cx, %ax
.LM3:
addw $6, %sp
popw %bp
popw %di
popw %si
popw %bx
popw %cx
ret
After the patch:
__popcountsi2:
.LFB2:
.LM1:
.LVL0:
pushw %cx
pushw %bx
pushw %si
pushw %di
subw $6, %sp
movw %sp, %bx
movw 8(%bx), %ax
movw %ax, 2(%bx)
.LVL1:
movw 10(%bx), %ax
movw %ax, 4(%bx)
.LM2:
movw $__popcount_tab, %si
movw %si, %bx
movw %sp, %di
movb 4(%di), %al
xlat (%bx)
movb $0, %ah
movw %sp, %bx
movw %ax, (%bx)
movw %si, %bx
movb 3(%di), %al
xlat (%bx)
movb $0, %ah
addw %ax, (%di)
movb 2(%di), %al
xlat (%bx)
movb $0, %ah
movw %ax, %dx
addw (%di), %dx
movb 5(%di), %al
xlat (%bx)
movb $0, %ah
movw %ax, %cx
addw %dx, %cx
.LM3:
movw %cx, %ax
addw $6, %sp
popw %di
popw %si
popw %bx
popw %cx
ret
--
Rask Ingemann Lambertsen