🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by andrew morton Wed, 18 Nov 1992 17:03
CSE optimization opportunities missed (68k)
#1419
Author: andrew morton
Date: Wed, 18 Nov 1992 17:03
46 lines
1263 bytes
A few things I have noticed in gcc2.2.2 (m68k):

The code

foo()
{
	bar(0x12345);
	bar(0x12345);
	bar(0x12345);
	bar(0x12345);
	bar(0x12345);
}

Doesn't put the constant into a register: it seems that
constant function arguments are being missed as CSE
candidates.

Also, in the code

foo(int a, int b, int c, int d)
{
	a += 0x12345;
	b += 0x12345;
	c += 0x12345;
	d += 0x12345;
	bar(a, b, c, d);
	zot(0x12345);
}

The constants used in the additions are held in a register
but that register is not used for the call to zot(): a constant
is pushed instead.

Thirdly, there seems to be a problem with -funroll-all-loops
and -frerun-cse-after-loops.  In the code

foo()
{
	int i;

	for (i = 0; i < 10; i++)
		bar();
}

The address of bar() is not held in a register after
unrolling.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads