(more) missed optimizations in pcc

Dave Martindale dmmartindale at watcgl.UUCP
Wed Nov 21 15:04:34 AEST 1984


> Index: lib/pcc/local.c 4.2 Fix
> 
> Description:
> 	The machine dependent expression optimizer doesn't handle
> 	"%" or "%=" by the constants which are powers of two.  These
> 	can be done more simply as "&" or "&=".

But "fixing" this gives you an answer that is different from what you
would have gotten had you done the divide/multiply/subtract in cases
where the "dividend" is negative.  For example, if the variable "i"
contains the value -7 and "j" contains "4", then i%j is -3 while
i%4 is 1 (with your optimization).  Are you sure you want to introduce
an inconsistency like this?  I don't like it.



More information about the Comp.bugs.4bsd.ucb-fixes mailing list