Question about regrouping of operands

Mark Hall markhall at pyramid.pyramid.com
Tue May 24 03:16:23 AEST 1988


In article <7952 at brl-smoke.ARPA> gwyn at brl.arpa (Doug Gwyn (VLD/VMB) <gwyn>) writes:
>In article <19000 at watmath.waterloo.edu> rbutterworth at watmath.waterloo.edu (Ray Butterworth) writes:
>>[ a + b + c + ... + x + y + z ]
>>Now if integer overflow checking is enabled, the compiler is
>>no longer free to do the additions in any order it wants.  It
>>must do them in precisely the order that the programmer has
>>requested, since the programmer might have specificly requested
>>that order to prevent overflow.
>
>This is correct.  However, it has not been demonstrated that a
>serious loss of efficiency will necessarily result from removal
>of this kind of optimization.  
>

A `perfect' Multi-Flow type machine (or any machine which 
supports fine-grain parallel execution), is able to evaluate 
this expression (assuming N is the number of operations) in 
		log N
		   2
instructions, given no restriction on execution order.  Constraining
such a machine to the serial execution order of the above expression,
which requires N instructions, is indeed a serious loss of efficiency.

I'll concede, however, that such expressions with large N are rare.
 
Mark Hall {seismo | sun | decwrl}!pyramid!markhall



More information about the Comp.std.c mailing list