From dd53d197a2b19dc53efe7937a793b3909830d767 Mon Sep 17 00:00:00 2001 From: Marc Glisse Date: Mon, 2 May 2016 16:32:53 +0200 Subject: [PATCH] Canonicalize X u< X to UNORDERED_EXPR 2016-05-02 Marc Glisse gcc/ * match.pd (X u< X, X u> X): New transformations. gcc/testsuite/ * gcc.dg/tree-ssa/unord.c: New testcase. From-SVN: r235761 --- gcc/ChangeLog | 4 ++++ gcc/match.pd | 4 ++++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.dg/tree-ssa/unord.c | 7 +++++++ 4 files changed, 19 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/unord.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 10bf855f351..435a9622761 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2016-05-02 Marc Glisse + + * match.pd (X u< X, X u> X): New transformations. + 2016-05-02 Marc Glisse * flag-types.h (enum warn_strict_overflow_code): Move ... diff --git a/gcc/match.pd b/gcc/match.pd index f1b1f154125..8de8858b151 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -1921,6 +1921,10 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (simplify (cmp @0 @0) { constant_boolean_node (true, type); })) +(for cmp (unlt ungt) + (simplify + (cmp @0 @0) + (unordered @0 @0))) (simplify (ltgt @0 @0) (if (!flag_trapping_math) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f4075843284..2ea3d7700e3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2016-05-02 Marc Glisse + + * gcc.dg/tree-ssa/unord.c: New testcase. + 2016-05-02 Marc Glisse * gcc.dg/tree-ssa/20040305-1.c: Adjust. diff --git a/gcc/testsuite/gcc.dg/tree-ssa/unord.c b/gcc/testsuite/gcc.dg/tree-ssa/unord.c new file mode 100644 index 00000000000..e0927925d5a --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/unord.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-optimized" } */ + +int f(double a){double b=a;return !__builtin_islessequal(a,b);} +int g(double a){double b=a;return !__builtin_isgreaterequal(a,b);} + +/* { dg-final { scan-tree-dump-times " unord " 2 "optimized" } } */ -- 2.30.2