Berkeley TestFloat Release 3e: timesoftfloat

John R. Hauser
2018 January 20

Overview

The timesoftfloat program provides a simple way to evaluate the speed of the floating-point operations of the Berkeley SoftFloat library. Program 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 Arithmetic. Although timesoftfloat does not test floating-point correctness like the other TestFloat programs, nevertheless timesoftfloat is a partner to TestFloat’s testsoftfloat program. For more about TestFloat generally and testsoftfloat specifically, see file TestFloat-general.html.

Ordinarily, 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 near_even (nearest/even). 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. For 80-bit double-extended-precision operations affected by rounding precision control, 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 options.

For each function and mode evaluated, timesoftfloat reports the measured speed of the function in Mop/s, or “millions of operations per second”. The speeds reported by timesoftfloat may be affected somewhat by other software executing at the same time as timesoftfloat. 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 (f64_rem, extF80_rem, and f128_rem) can be markedly slower than other operations, particularly for double-extended-precision (extF80_rem) and quadruple precision (f128_rem). This is inherent to the remainder operation itself and is not a failing of the SoftFloat implementation.

Command Syntax

The timesoftfloat program is executed as a command with this syntax:

timesoftfloat [<option>...] <function>
Square brackets ([ ]) 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 timesoftfloat is executed without any arguments, a summary of usage is written.

Options

The timesoftfloat program accepts several command options. If mutually contradictory options are given, the last one has priority.

-help

The -help option causes a summary of program usage to be written, after which the program exits.

-precision32, -precision64, -precision80

For 80-bit double-extended-precision funcions affected by rounding precision control, the -precision32 option restricts timing of an operation to only the cases in which the rounding precision is 32 bits, equivalent to 32-bit single-precision. Other rounding precision choices are not timed. Likewise, -precision64 fixes the rounding precision to 64 bits, equivalent to 64-bit double-precision; and -precision80 fixes the rounding precision to the full 80 bits of the double-extended-precision format. All these options are ignored for operations not affected by rounding precision control.

-rnear_even, -rnear_maxMag, -rminMag, -rmin, -rmax, -rodd

The -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. Likewise, -rnear_maxMag forces rounding to nearest/maximum magnitude (nearest-away), -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, -tininessafter

The -tininessbefore option restricts timing of an operation to only the cases in which tininess on underflow is detected before rounding. Likewise, -tininessafter restricts measurement to only the cases in which tininess on underflow is detected after rounding.

-notexact, -exact

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 false. Likewise, the -exact option restricts measurement to only the cases for which the exact operand is true.

Function Sets

Just as timesoftfloat can time a function for all five or six rounding modes in sequence, multiple functions can be timed with a single execution of timesoftfloat. Three sets are recognized: -all1, -all2, and -all. The set -all1 is all one-operand operations, -all2 is 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 roundingMode and exact arguments are ignored. (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 roundToInt functions are included in the set of one-operand operations timed by -all1.