John R. Hauser
2018 January 20
timesoftfloat program provides a simple way to evaluate the
speed of the floating-point operations of the Berkeley SoftFloat library.
timesoftfloat is included with the Berkeley TestFloat
package, a small collection of programs for testing that an implementation of
floating-point conforms to the IEEE Standard for Binary Floating-Point
timesoftfloat does not test floating-point correctness
like the other TestFloat programs, nevertheless
timesoftfloat is a
partner to TestFloat’s
For more about TestFloat generally and
timesoftfloat will measure a function’s speed
separately for each of the five rounding modes defined by the IEEE
Floating-Point Standard, one after the other, plus possibly a sixth mode,
round to odd (depending on the options selected when
timesoftfloat was compiled).
If an operation is not supposed to require rounding, it will by default be
timed only with the rounding mode set to
In the same way, if an operation is affected by the way in which underflow
tininess is detected,
timesoftfloat times the function with
tininess detected both before rounding and after rounding.
timesoftfloat also times the function
for each of the three rounding precision modes, one after the other.
Evaluation of a function can be limited to a single rounding mode, a single
tininess mode, and/or a single rounding precision with appropriate command-line
For each function and mode evaluated,
timesoftfloat reports the
measured speed of the function in Mop/s, or “millions of operations per
The speeds reported by
timesoftfloat may be affected somewhat by
other software executing at the same time as
Be aware also that the exact execution time of any SoftFloat function depends
partly on the values of arguments and the state of the processor’s caches
at the time the function is called.
Your actual experience with SoftFloat may differ from the speeds reported by
timesoftfloat for all these reasons.
Note that the remainder operations for larger formats (
f128_rem) can be markedly slower than
other operations, particularly for double-extended-precision
extF80_rem) and quadruple precision (
This is inherent to the remainder operation itself and is not a failing of the
timesoftfloat program is executed as a command with this
Square brackets (timesoftfloat [<option>...] <function>
[ ]) denote optional arguments,
<option>is a supported option, and
<function>is the name of either a testable function or a function set. The available options and function sets are documented below. If
timesoftfloatis executed without any arguments, a summary of usage is written.
timesoftfloat program accepts several command options.
If mutually contradictory options are given, the last one has priority.
-help option causes a summary of program usage to be written,
after which the program exits.
-precision32, -precision64, -precision80
-precision32 option restricts
timing of an operation to only the cases in which the rounding precision is
-precision64 fixes the rounding precision to
-precision80 fixes the rounding precision to the full
-rnear_even, -rnear_maxMag, -rminMag, -rmin, -rmax, -rodd
-rnear_even option restricts timing of an operation to only
the cases in which the rounding mode is nearest/even.
Other rounding mode choices are not timed.
-rnear_maxMag forces rounding to nearest/maximum
-rminMag forces rounding to minimum
magnitude (toward zero),
-rmin forces rounding to minimum (down,
toward negative infinity),
-rmax forces rounding to maximum (up,
toward positive infinity), and
-rodd, if supported, forces
rounding to odd.
These options are ignored for operations that are exact and thus do not round.
-tininessbefore option restricts timing of an operation to
only the cases in which tininess on underflow is detected before rounding.
-tininessafter restricts measurement to only the cases
in which tininess on underflow is detected after rounding.
For functions that round to an integer (conversions to integer types and the
roundToInt functions), the
-notexact option restricts
timing of an operation to only the cases for which the
exact operand (specifying whether the inexact
exception flag may be raised) is
-exact option restricts measurement to only the
cases for which the
exact operand is
timesoftfloat can time a function for all five or six
rounding modes in sequence, multiple functions can be timed with a single
Three sets are recognized:
-all1 is all one-operand operations,
all two-operand operations, and
-all is obviously all operations.
A function set is used in place of a function name in the
timesoftfloat command line, such as
timesoftfloat [<option>...] -all1
For the purpose of deciding the number of operands of an operation, any
exact arguments are
(Such arguments specify the rounding mode and whether the inexact
exception flag may be raised, respectively.)
Thus, functions that convert to integer type and the
functions are included in the set of one-operand operations timed by