🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Clark Cooper Thu, 29 Sep 1988 17:57
Loop optimization in GCC 1.28
#1727
Author: Clark Cooper
Date: Thu, 29 Sep 1988 17:57
56 lines
1747 bytes
Symptom:
	GCC 1.28 with -O seems to be missing an obvious loop optimization.

Configurtion:
	md -> m68k.md
	tm.h -> tm-sun3.h
	aux-output.c -> output-m68k.c

Test File:
===========================
static char syn_tab[256];

static void
test ()
{
   register int c;

   for (c = 'a'; c <= 'z'; c++)
     syn_tab[c] = 1;
}
===========================

Compilation script:
===========================
gecrux% gcc -v -g -O -S junk.c
gcc version 1.28
 /usr/sculptorq/gnu/src/gcc/cpp -v -undef -D__GNU__ -D__GNUC__ -Dmc68000 -Dsun -Dunix -D__OPTIMIZE__ -D__HAVE_FPU__-Dmc68020 junk.c /tmp/cca08120.cpp
GNU CPP version 1.28
 /usr/sculptorq/gnu/src/gcc/cc1 /tmp/cca08120.cpp -quiet -dumpbase junk.c -g -O -version -o junk.s
GNU C version 1.28 (68k, MIT syntax) compiled by CC.
===========================

Portion of .s file:
===========================
...
_test:
	.stabd 68,0,5
	link a6,#0
LBB2:
	.stabd 68,0,8
	moveq #97,d0
	lea _syn_tab,a0		<--
L5:				  |
	.stabd 68,0,9		  |
	moveb #1,a0@(d0:l)	  |
	.stabd 68,0,8		  |
	addql #1,d0		  |
	moveq #122,d1		--  Why isn't this outside the loop ?
	cmpl d0,d1
	jge L5
LBE2:
...
===========================
Clark Cooper       cooper@gecrux.steinmetz.ge.com, coopercc@crd.ge.com,
                   coopercc@ge-crd.arpa, ...!uunet!steinmetz!cooper
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