dalegass@dalcsug.UUCP (08/15/87)
Does anyone have views regarding the quality of code generated by Turbo C?
It claims to be one of the best around, but I've seen some code generated
that I consider rather disappointing.
I think my main gripe would be the code generated by the basic multiply
and divide operations. For example, consider the following code fragment:
long long_mult(int i, int j)
{
long k;
k = (long) i * j;
return k
}
Whereas Aztec C would produce code something along the lines of:
MOV AX,_i
MUL _j
Turbo C generates something like this:
MOV AX,_i
CWD
PUSH DX
PUSH AX
POP BX
POP CX
PUSH CS
CALL LXMUL@
I consider this to be a pretty basic requirement, and doing a call for
a multiply is a bit much, in my view. Even in long*long=long multiplications,
Aztec C simply puts a couple of IMUL's and ADDs inline.
Similarly, I would like
int i,j;
long k;
i = (int) (k / j)
to simply use the IDIV instruction once, rather than a call, as Turbo C does.
This poor code generation (and resulting speed degredation) has led me to
manually code time-critical parts of my programs into machine language,
which I don't think should have been necessary (and isn't in Aztec C).
One thing Turbo C does, that I consider to be important optimization is
the way the peek() and poke() calls are translated into direct memory reads
and writes, if you #include <dos.h>. This can really speed things up.
Don't get me wrong: I think Turbo C is the best C development environment
available, and I constantly use and enjoy the package.
Hopefully Version 2.0 will do a little bit better optimization...
-dalegass@dalcsug.uucp