[comp.arch] Integer multiply in address arithmetic

rang@cs.wisc.edu (Anton Rang) (09/11/90)

In article <1990Sep10.162839.19226@cs.rochester.edu> crowl@cs.rochester.edu (Lawrence Crowl) writes:
>In article <1660@s6.Morgan.COM> amull@Morgan.COM (Andrew P. Mullhaupt) writes:
>>Some machines (like i486, RS/6000) have integer multiplies and some (SPARC)
>>do not. Now the compilers of the world can get rid of integer multiplies in
>>address arithmetic _if_ they can figure out the sizes of the arrays.
>
>This is incorrect.  Compilers can get rid of integer multiplies (actually
>implement them as shifts and adds) when the sizes of the array ELEMENTS are
>known.

  For one-dimensional arrays, this is true.  But in matrix operations,
for instance, what do you do with an array parameter which looks like

	REAL MYARY(N,N)

where M and N are parameters of the subroutine?  Hopefully strength
reduction can remove most of the multiplications needed to access
elements of the array, but there are some loops where it may not be
practical to do this (and many compilers which don't, anyway).
   
+---------------------------+------------------+-------------+
| Anton Rang (grad student) | rang@cs.wisc.edu | UW--Madison |
+---------------------------+------------------+-------------+