🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #10359

Aztec compiler ineffeciencies

#10359
From: Karl Lehenbauer
Date: Fri, 25 Nov 1988 06:21
38 lines
1068 bytes
I've been examining the output of Aztec 3.6a and have discovered that it does
no optimization on divides, such as turning divides by constants into shifts
and adds, even when the divisor is a power of 2!  This is probably Not News
to a lot of you, but it was a shocker for me.

The code:

main()
{
	register int x = 17441;

	x /= 2;
}

generates (for the divide):

	move.l	#2,d1
	move.l	d4,d0
	jsr	.divs#		; <-- a subroutine call!
	move.l	d0,d4


With a shift:

main()
{
	register int x = 17441;

	x >>= 1;
}

generates (for the shift)...

	asr.l	#1,d4
-- 
-- "We've been following your progress with considerable interest, not to say
-- contempt."  -- Zaphod Beeblebrox IV
-- uunet!sugar!karl, Unix BBS (713) 438-5018
Technical Details
Message-ID: <3013@sugar.uu.net>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!husc6!cmcl2!rutgers!bellcore!texbell!sugar!karl

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!husc6!cmcl2!rutgers!bellcore!texbell!sugar!karl
From: karl@sugar.uu.net (Karl Lehenbauer)
Newsgroups: comp.sys.amiga.tech
Subject: Aztec compiler ineffeciencies
Message-ID: <3013@sugar.uu.net>
Date: 25 Nov 88 06:21:13 GMT
Organization: Sugar Land Unix - Houston, TX
Lines: 38