Defect report from : Joanna Farley , Sun Microsystems
(Please direct followup comments direct to yyyyyyyyyyyyyy@xxxxxxxxxxxxx)
@ page 264 line 9399 to 9406 section math.h objection {jf-al-FP_FAST-150403}
Problem:
Edition of Specification (Year): 2001
Defect code : 3. Clarification required
One of the VSX testsuite tests has the following test assertion and test
strategy:
/tset/C99.hdr/misc/math_1/T.math_1 7
Test Description:
The header file contains macro definitions(if required) FP_FAST_FMA,
FP_FAST_FMAF and FP_FAST_FMAL.
Test Strategy:
CALL clock() to get starting CPU usage
PERFORM direct multiply-add operation 10000/SPEEDFACTOR times
CALL clock() to get ending CPU usage
CALL clock() to get starting CPU usage
PERFORM the same 10000/SPEEDFACTOR multiply-add operations using fma()
CALL clock() to get ending CPU usage
IF FP_FAST_FMA is defined
VERIFY that the fma() operations used time less than the CPU time
that the direct operations used
ELSE
VERIFY that the fma() operations used time more than the CPU time
that the direct operations used
It is our assertion that test strategy is not correct in testing when
FP_FAST_FMA is not defined that is the test:
ELSE
VERIFY that the fma() operations used time more than the CPU time
that the direct operations used
is not supported by the C99 specification or the Base Specifications
Issue 6 which should mirror the C99 specification in intent.
The C99 specification says:
7.12 Mathematics <math.h>
...
[#7] The macro
FP_FAST_FMA
is optionally defined. If defined, it indicates that the
fma function generally executes about as fast as, or faster
than, a multiply and an add of double operands.193) The
macros
FP_FAST_FMAF
FP_FAST_FMAL
are, respectively, float and long double analogs of
FP_FAST_FMA.
...
____________________
193Typically, the FP_FAST_FMA macro is defined if and only
if the fma function is implemented directly with a
hardware multiply-add instruction. Software
implementations are expected to be substantially slower.
Base Specifications Issue 6 does have different wording. It says on
lines 9399 to 9406:
The following optional macros indicate whether the fma()
family of functions are fast compared with direct code:
FP_FAST_FMA
FP_FAST_FMAF
FP_FAST_FMAL
The FP_FAST_FMA macro shall be defined to indicate that
the fma() function generally executes about as fast as, or
faster than, a multiply and an add of double operands. The
other macros have the equivalent meaning for the float and
long double versions.
The Base Specifications Issue 6 language when taken with the C99
specification language does not imply the test
ELSE
VERIFY that the fma() operations used time more than the CPU time
that the direct operations used
The test should not test for anything if any of the FP_FAST_* macros are
not defined. The language "indicate whether the fma() family of
functions are fast compared with direct code", has been used to imply
that the macro is a switch on two types of behaviour which is not the
C99 intent.
Action:
To clarify the intent change the lines 9399 to 9406 to:
The following optional macros indicate whether the fma()
family of functions are fast compared with direct code:
FP_FAST_FMA
FP_FAST_FMAF
FP_FAST_FMAL
If defined, the FP_FAST_FMA macro shall indicate that
the fma() function generally executes about as fast as, or
faster than, a multiply and an add of double operands. If
undefined it is unspecified what the speed of execution is.
The other macros have the equivalent meaning for the float
and long double versions.
|