Path: 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 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