This is the mail archive of the gcc@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: MIPS: 2'nd pass of ira, causes weird register allocation for 2-op mult


Hi Vladimir,

I took some time to benchmark the patch you posted to gcc-patches-

On Mon, Jun 4, 2012 at 11:50 PM, Klaus Pedersen <projectu@gmail.com> wrote:
> On Mon, Jun 4, 2012 at 1:44 AM, Richard Sandiford
> <rdsandiford@googlemail.com> wrote:
[...]
>> As Vlad says, the behaviour you're seeing with the second pass isn't
>> deliberate.
>
> I am happy to test patches.

Here goes:

The patch seem to fix the 2nd ira pass. But some things confuses me.

I have listed the gain (in number of generated asm-lines) for each of
the discussed patches.
I have excluded data and empty lines. The number in () show the
number of  non-NOP instructions:

ira-no_2nd_pass:	1079	(1356)
uniform:		1474	(1681)
gpr_acc_cost_3:		1758	(1922)
uniform+gpr_acc_cost_3:	1850	(1961)
Total lines:		626781	(581016)

(Is 10% of mips code really nop's?)

As can be seen - the uniform patch is better than disabling 2nd pass, but
worse than fixing the cost of acc. Uniform + fixing cost of acc gives
the best results.

Surprisingly, it seems that most(all?) the cases where the uniform patch
does worse than the later combination, the the ira pass is the same.

I have attached one interesting case. (attached, I really tried to reduce
it, so the code doesn't make much sense now).

		Lines	nops	ACC	2ND	UNI	UNI+ACC
mifpoly.c	834	37	-61	-84	0	-61

Interestingly *skipping* 2nd pass generate 10% smaller code than both
of the 2nd pass ira algorithms.

Original code (and new IRA) (Check registers $10/$11):
	beq	$2,$0,.L13
	nop
.L40:
	sw	$10,72($sp)
	jal	__floatsidf
	sw	$11,76($sp)

	lw	$10,72($sp)
	lw	$11,76($sp)
	nop
	move	$7,$11
.L44:
	move	$6,$10
	move	$5,$3
	move	$4,$2
	sw	$10,72($sp)
	jal	__adddf3
	sw	$11,76($sp)
...
.L13:
	move	$4,$9
	sw	$10,72($sp)
	jal	__floatsidf
	sw	$11,76($sp)

	lw	$11,76($sp)
	lw	$10,72($sp)
	j	.L44
	move	$7,$11

The other versions look something like this:
	bne	$2,$0,.L36
	nop
	move	$4,$9
.L36:
	jal	__floatsidf
	nop

	lw	$7,44($sp)
	lw	$6,40($sp)
	move	$5,$3
	jal	__adddf3
	move	$4,$2

I am confused because the problem is in reload - and I can not
see why that happens (actually why disabling the 2nd pass of ira
would solve the problem in reload, when output of ira is identical!).

I have attached the files needed to investigate and reproduce the
problem. Compile with gcc-4.7 "-mips1 -O2"

I compressed the log files because the new ira is somewhat
chatty - as in 500KB log to compile 2K source...


Thanks, Klaus


>
>
> BR, ?Klaus

Attachment: evidence.tar.gz
Description: GNU Zip compressed data


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