[PATCH, testsuite]: PR 58757: Check for FP denormal values without triggering denormal exceptions

Uros Bizjak ubizjak@gmail.com
Wed Sep 24 08:03:00 GMT 2014


On Tue, Sep 23, 2014 at 8:40 PM, Marc Glisse <marc.glisse@inria.fr> wrote:

>>>>> Attached patch avoids triggering denormal exceptions when FP insns are
>>>>> used to check for non-zero denormal values.
>>>>
>>>>
>>>> But I thought the point of the test was to verify that the compiler's
>>>> understanding of existence of subnormal values was consistent with the
>>>> processor.  If the processor is in a mode supporting such values, the
>>>> exceptions should be masked.  That is, the present test should pass
>>>> unconditionally, if it doesn't pass that indicates a bug (which might be
>>>> appropriate for XFAILing).
>>>
>>>
>>> Alpha needs special instruction mode to process denormals. Without
>>> this special mode the insn traps as soon as denormal value is
>>> processed.
>>
>>
>> Yes, but I thought the point of that PR was that unless -mieee was given
>> to support such values, *_TRUE_MIN should be the same as *_MIN, reflecting
>> that they aren't supported.  And so the failure is showing that this bug
>> is present (and so XFAILing with a comment referring to the bug is
>> appropriate, rather than changing the test to pass).
>
>
> That's also my understanding, I am sorry Uros that I wasn't clear enough in
> the PR...

I see the intention now.

However, alpha *does* support all IEEE features, the only problem is
in its default model, which is for some reason "High-Performance
IEEE-Format Arithmetic" (please see alpha AHB [1], section 4.7.6.5).
This model "does not require the overhead of an operating system
completion handler and can be the fastest of the three IEEE models.".
Unfortunately, this model also "notifies applications of all
exceptional floating-point operations". Denormals are considered
non-finite IEEE values, so they trap.

When the target is in certain "high-speed" mode, it is up to the user
to obey all the limitations, in this particular case, that only IEEE
finite numbers are provided. This is not the case with the original
testcase, so I'd say that the test is out of specs. It beats me, why
-mieee is not the default on alpha, since current default suits
-ffast-math more, but it looks that we have to live with this mess.

To avoid traps on denormals, -mieee has to be specified. This option
enables FP software completion that completes denormal handling, so
there is no need to "notify application ...". IMO, instead of XFAILing
the test, we should simply provide "-mieee". __*_DENORM_MIN__ should
indeed apply to the underlying FP format, not to sme target-dependent
model and its implementation details.

[1] http://www.compaq.com/cpq-alphaserver/technology/literature/alphaahb.pdf

Uros.



More information about the Gcc-patches mailing list