|Re: Compiler Libraries and/or built-in routines email@example.com (1992-10-07)|
|Re: run-time libraries firstname.lastname@example.org (1992-10-08)|
|From:||email@example.com (Richard Gorton)|
|Date:||Thu, 8 Oct 1992 14:20:27 GMT|
firstname.lastname@example.org (John D. Mitchell) writes:
>I would suspect that anybody who doesn't implement a reasonable math
>library was just lazy. :-? ...> Depending on the hardware/software/OS/etc.
>it can be trivial to reasonably difficult to efficiently support both
>hardware based floating point and software emulation.
Case in point being the writing of math routines to support Extended
precision floating point (96 bit) for the first time. How DOES one
represent those things in an implementation language which doesn't
inherently handle it? A structure of 3-32 bit integers and fiddle the bits
accordingly? Seems straightforward, but remember, the resulting routines
_have_ to be correct, and fast. A bit of chicken & egg problem. Does the
compiler understand the datatype first or do the appropriate routines get
Things like extended precision COMPLEX operations for FORTRAN are fairly
complicated to do, as well as adding a lot more complexity to the datatype
conversion area. Additionally, the compiler itself has to emit the
correct operators/datatype information about built-ins, and understand the
If one isn't very careful about the runtime issues, innocuous looking
code can be performance bottlenecks. For example (this is an actual excerpt
from GCC's strstr() routine)
1: register int len = strlen (s2);
3: for (; (p = strchr (p, *s2)) != 0; p++)
5: if (strncmp (p, s2, len) == 0)
7: return (p);
10: return (0);
Seems innocuous enough, right? However, the strlen on line 1 causes the
entire string s2 to be traversed an additional (unnecessary) time. The
point is not to do GCC bashing, but rather that carefully crafted
run-times are also critical to achieve maximal performance.
Richard Gorton Alpha Migration Tools - Digital Equipment Corp.
[In fairness, though, many CISC machines such as the 80x86 and Vax have
instructions that implement strlen(), strchr(), and strncmp() very
efficiently so this code could be faster than looking at each character
once in a loop. -John]
Return to the
Search the comp.compilers archives again.