This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFA: fix bugs in likely_spilled_retval_1 / likely_spilled_retval_p


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]