On Wed, May 29, 2013 at 10:33 AM, Eric Botcazou <ebotca...@adacore.com> wrote:
> Hi,
>
> on most platforms the Ada compiler doesn't enable trap-on-FP-exceptions, so
> it's appropriate to set -fno-trapping-math there, which has been done in
>   http://gcc.gnu.org/ml/gcc-patches/2013-05/msg01461.html
>
> However doing so can have an adverse effect if the architecture doesn't have a
> sufficiently rich set of FP comparison instructions because -fno-trapping-math
> allows the middle-end and the optimizers to turn the negation of signaling FP
> comparison operators into quiet FP unordered operators, e.g. not(<) into !>=
> and the quiet unordered operators aren't supported universally.  The effect is
> that you need 2 comparisons instead of just 1 to achieve the desired result.
>
> The first (surprising) example is the IA-64, which has ORDERED and UNORDERED
> but not UNLT/UNLE/UNGT/UNGE because the unordered comparison instructions are
> signaling (since they are the negation of the signaling ordered comparisons).
> Therefore the fix is to make it possible to use these unordered comparison
> instructions, which are signaling, for the quiet unordered operators when the
> flag -fno-trapping-math is in effect.  As a matter of fact, the support was
> already there (e.g. in ia64_print_operand) but it was rightfully disabled.
>
> Tested on IA-64/Linux and IA-64/HP-UX, OK for the mainline?

Did you check that this doesn't cause traps on SPEC CPU 2000 / 2006
when compiled with -ffast-math (something we generally want to support,
even if it is on the border of validity)?

Thanks,
Richard.

> 2013-05-29  Eric Botcazou  <ebotca...@adacore.com>
>
>         * config/ia64/predicates.md (ia64_cbranch_operator): Accept unordered
>         comparison operators when -fno-trapping-math is in effect.
>         * config/ia64/ia64.c (ia64_expand_compare): Add support for unordered
>         comparison operators in TFmode and assert that unsupported operators
>         cannot reach here.
>         (ia64_print_operand): Likewise.
>
>
> --
> Eric Botcazou

Reply via email to