wasted optimizations; this time on VAX
David G. Hough
dgh
Fri Jun 29 13:17:04 PDT 1990
In IEEE arithmetic, generating floating-point exceptions is
optional for floating-point moves, negation, and abs; the
optional exception is an invalid for signaling NaN operand.
Consequently they
may be accomplished either as integer bit field operations or
by using a floating-point data path. As far as I know, simple
expressions like y = x and y = -x and y = abs(x) are usually
compiled into forms that won't generate exceptions. The
original SPARC gate array implementation, for instance, executes
fmoves faster than fadds, although they take the same time
in some subsequent implementations.
My understanding is that VAX reserved operands will generate
traps in those circumstances if compilers generate floating-point
moves or other ops. -x and abs(x) can't be accomplished
with simple bit maneuvers on VAX, so I expect traps occur
on all attempts on reserved operands. I'm curious about
y = x for a reserved operand x; do VAX compilers conventionally
trap this by generating floating-point ops for the move?
That's consistent with -x and abs(x), but did any customers
care? I wouldn't expect so since reserved operands aren't
generated by default.
A related practice is the ancient one of moving data such as
character strings rapidly by equivalencing to an array
of double-precision floating-point variables. If that code
that worked on a number of previous systems generates
floating-point exceptions on a VAX or some IEEE systems, whose
fault is it?
Side effects of floating-point arithmetic are inconvenient from
a number of points of view but essential to providing robust,
efficient, portable [after NCEG] code.
They can only be avoided by explicit
testing at all critical points which slows down all executions
to detect the few exceptional ones, or by relying on recovery
after traps, which is even less portable. Providing the capability
of complete recovery after traps is even more expensive on high
performance systems than maintaining the IEEE accrued
exception-occurred bits.
More information about the Numeric-interest
mailing list