Summary: [PATCH] Faster +-*/ involving a floating-pointing
Keywords: patch, performance
The front-end converts all floating-point literals into 80-bit real values, if
they are specified either (1) with an L suffix, or (2) they are involved in an
operation with a 'real'. It does this _even if the number could be represented
as a double without loss of precision_. Unfortunately, the x87 can only do
fused load-and-multiply, load-and-add, etc of float and double operands, so
mixed-precision operations are a bit slower than they could be.
So, something like "x + 3.0" (where x is real), becomes:
static real THREE=3.0;
fld real ptr THREE;
faddp ST(1), ST;
and with this patch it becomes:
static double THREE=3.0;
fadd ST, double ptr THREE;
The patch is only applied in the case of +,-,*,/, so that something like
will continue to work correctly.
The patch also includes the patch for 2888; they are very closely related.