🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #2152

minor optimizations missed for identity and zero values

#2152
From: Ken Raeburn
Date: Sat, 14 Jan 1989 22:43
23 lines
1073 bytes
It appears that gcc doesn't optimize the following code as much as it
could in some cases:

	void foo (n) int *n; {
		int y;
		y = 0;
		y op= frep ();
		*n = y;
	}

where "op" is "*", "&", or "|"... it zeros a register (one which has
to be preserved around the function call) and uses it.  It does
properly fold things for "+" though.

I haven't checked with other identity or zero elements for other
operations (such as ~0 for '&' and '|').

I'm using version 1.32 on the vax, with optimization and
-fstrength-reduce and -fcombine-regs, though the same result is
produced with the two -f options turned off.

-- Ken
Technical Details
Message-ID: <8901142243.AA01176@PROMETHEUS.MIT.EDU>
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!lll-winken!killer!mit-eddie!bloom-beacon!tut.cis.ohio-state.edu!ATHENA.MIT.EDU!raeburn

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!lll-winken!killer!mit-eddie!bloom-beacon!tut.cis.ohio-state.edu!ATHENA.MIT.EDU!raeburn
From: raeburn@ATHENA.MIT.EDU (Ken Raeburn)
Newsgroups: gnu.gcc.bug
Subject: minor optimizations missed for identity and zero values
Message-ID: <8901142243.AA01176@PROMETHEUS.MIT.EDU>
Date: 14 Jan 89 22:43:24 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 23