From d603877768c5a4ed26481afc0aff99e87a0a8d62 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Fri, 2 Aug 2019 11:58:04 +0200 Subject: [PATCH] re PR target/91323 (LTGT rtx produces UCOMISS instead of COMISS) PR target/91323 * config/i386/i386-expand.c (ix86_unordered_fp_compare) : Return false. testsuite/ChangeLog: PR target/91323 * gcc.dg/torture/pr91323.c: New test. From-SVN: r274005 --- gcc/ChangeLog | 6 +++ gcc/config/i386/i386-expand.c | 6 +-- gcc/testsuite/ChangeLog | 5 +++ gcc/testsuite/gcc.dg/torture/pr91323.c | 51 ++++++++++++++++++++++++++ 4 files changed, 65 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr91323.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c0e3cd84d7b..a523bf053a9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-08-02 Uroš Bizjak + + PR target/91323 + * config/i386/i386-expand.c (ix86_unordered_fp_compare) : + Return false. + 2019-08-02 Richard Biener * vec.h (vec::sort): Add gcc_qsort_r support. diff --git a/gcc/config/i386/i386-expand.c b/gcc/config/i386/i386-expand.c index 6e4ae5077f5..f6e6d68eed2 100644 --- a/gcc/config/i386/i386-expand.c +++ b/gcc/config/i386/i386-expand.c @@ -2286,16 +2286,16 @@ ix86_unordered_fp_compare (enum rtx_code code) switch (code) { - case GT: - case GE: case LT: case LE: + case GT: + case GE: + case LTGT: return false; case EQ: case NE: - case LTGT: case UNORDERED: case ORDERED: case UNLT: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 58a26d11f0f..36dbcc86812 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-08-02 Uroš Bizjak + + PR target/91323 + * gcc.dg/torture/pr91323.c: New test. + 2019-08-02 Paolo Carlini * g++.dg/cpp1z/nodiscard6.C: New. diff --git a/gcc/testsuite/gcc.dg/torture/pr91323.c b/gcc/testsuite/gcc.dg/torture/pr91323.c new file mode 100644 index 00000000000..3da2dfbe2db --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr91323.c @@ -0,0 +1,51 @@ +/* { dg-do run } */ +/* { dg-add-options ieee } */ +/* { dg-require-effective-target fenv_exceptions } */ + +#include + +int +__attribute__ ((noinline, noclone)) +f1 (float a, float b) +{ + return __builtin_isless (a, b) || __builtin_isgreater (a, b); +} + +int +__attribute__ ((noinline, noclone)) +f2 (float a, float b) +{ + return __builtin_islessgreater (a, b); +} + +int +__attribute__ ((noinline, noclone)) +f3 (float a, float b) +{ + return a < b || a > b; +} + +int +main (void) +{ + volatile int r; + + float nanf = __builtin_nanf (""); + float argf = 1.0f; + + feclearexcept (FE_INVALID); + + r = f1 (nanf, argf); + if (fetestexcept (FE_INVALID)) + __builtin_abort (); + + r = f2 (nanf, argf); + if (fetestexcept (FE_INVALID)) + __builtin_abort (); + + r = f3 (nanf, argf); + if (!fetestexcept (FE_INVALID)) + __builtin_abort (); + + return 0; +} -- 2.30.2