Jul 94 Dialogue Box
Volume Number: 10
Issue Number: 7
Column Tag: Dialogue Box
Dialogue Box
By Scott T Boyd, Editor
In The Cornfield == In The Weeds?
You raised many fine points about the need (or lack thereof) to write assembly
language for Power PC. I would have appreciated more detail to illustrate the points
you made. For instance, I would like to know what the two lines of code that sped up the
search algorithm by a factor of three did, in general. Also, a simple example of Power
PC code you saw rewritten by someone else where the rewrite ran slower. Or, an
example where a Power PC rewrite looks faster but did not run faster. Some of your
points raised big question marks for me.
The article as a whole appeared directed toward the C programmer, but very
little of how to write C that is compiled to good Power PC code was addressed.
A cursory examination of the PowerPC instruction set shows that it is not a C
machine; there are instructions that do not match well to C, as well as C constructs
that do not map well to PowerPC instructions. For instance, the expression: unsigned
char c = f; where f is a float compiles to over 20 instructions on an RS6000 using the
xlc compiler with the O3 optimization (the highest level), regardless of the rounding
convention chosen. This is in part because there are no instructions that move data
between the general purpose registers and the floating point registers, and in part
because both the unsigned char data type and the float data type, while supported on the
Power PC in theory, are not natural data types; at least the compiler does not think so.
Another example true for both 68K and Power PC is that while the processors
make overflow detection easy, the C language does not provide any natural method to
write code that detects arithmetic overflow in integer arithmetic. Thus, while 68K and