aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@gcc.gnu.org>2015-10-26 17:02:48 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2015-10-26 17:02:48 +0000
commitf6c1575958f7bf97c543943f18e7461cb17e43d5 (patch)
tree668aeb9f2a1030de3b15dcc446ab7c5adfdd5069 /gcc
parentf52a73a48ee7123e3db494c6b0ac72d0d4359ad9 (diff)
downloadgcc-f6c1575958f7bf97c543943f18e7461cb17e43d5.zip
gcc-f6c1575958f7bf97c543943f18e7461cb17e43d5.tar.gz
gcc-f6c1575958f7bf97c543943f18e7461cb17e43d5.tar.bz2
match.pd (fold_widened_comparison): Apply simplifications to all integral types.
* match.pd (fold_widened_comparison): Apply simplifications to all integral types. From-SVN: r229384
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog12
-rw-r--r--gcc/match.pd5
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/gcc.dg/atomic-noinline-aux.c5
-rw-r--r--gcc/testsuite/gcc.dg/atomic-noinline.c19
-rw-r--r--gcc/testsuite/gnat.dg/opt51.adb20
-rw-r--r--gcc/testsuite/gnat.dg/opt51_pkg.ads5
7 files changed, 53 insertions, 20 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b2be8cf..f90887f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,4 +1,9 @@
-2015-10-26 Simon Dardis <simon.dardis@imgtec.com>
+2015-10-26 Eric Botcazou <ebotcazou@adacore.com>
+
+ * match.pd (fold_widened_comparison): Apply simplifications to all
+ integral types.
+
+2015-10-26 Simon Dardis <simon.dardis@imgtec.com>
* target.def (TARGET_NO_SPECULATION_IN_DELAY_SLOTS_P): New hook.
* doc/tm.texi.in (TARGET_NO_SPECULATION_IN_DELAY_SLOTS_P): Document.
@@ -9,9 +14,8 @@
2015-10-26 Jeff Law <law@redhat.com>
PR tree-optimization/68013
- * tree-ssa-threadbackward.c
- (fsm_find_control_statement_thread_paths): Make sure the first block
- in the path is in VISITED_BBs.
+ * tree-ssa-threadbackward.c (fsm_find_control_statement_thread_paths):
+ Make sure the first block in the path is in VISITED_BBs.
2015-10-26 Richard Biener <rguenther@suse.de>
Dominik Vogt <vogt@linux.vnet.ibm.com>
diff --git a/gcc/match.pd b/gcc/match.pd
index fa927b0..6535b59 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -2099,12 +2099,11 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
&& (TYPE_UNSIGNED (TREE_TYPE (@00))
== TYPE_UNSIGNED (TREE_TYPE (@10))))
|| (TREE_CODE (@10) == INTEGER_CST
- && (TREE_CODE (TREE_TYPE (@00)) == INTEGER_TYPE
- || TREE_CODE (TREE_TYPE (@00)) == BOOLEAN_TYPE)
+ && INTEGRAL_TYPE_P (TREE_TYPE (@00))
&& int_fits_type_p (@10, TREE_TYPE (@00)))))
(cmp @00 (convert @10))
(if (TREE_CODE (@10) == INTEGER_CST
- && TREE_CODE (TREE_TYPE (@00)) == INTEGER_TYPE
+ && INTEGRAL_TYPE_P (TREE_TYPE (@00))
&& !int_fits_type_p (@10, TREE_TYPE (@00)))
(with
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 04700fb..db008b2 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2015-10-26 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc.dg/atomic-noinline.c: Change test on __atomic_is_lock_free.
+ * gcc.dg/atomic-noinline-aux.c: Adjust accordingly.
+ * gnat.dg/opt51.adb: New test.
+ * gnat.dg/opt51_pkg.ads: New helper.
+
2015-10-26 Simon Dardis <simon.dardis@imgtec.com>
* gcc.target/mips/ds-schedule-1.c: New.
diff --git a/gcc/testsuite/gcc.dg/atomic-noinline-aux.c b/gcc/testsuite/gcc.dg/atomic-noinline-aux.c
index deab7ae..9798979 100644
--- a/gcc/testsuite/gcc.dg/atomic-noinline-aux.c
+++ b/gcc/testsuite/gcc.dg/atomic-noinline-aux.c
@@ -64,7 +64,8 @@ __atomic_fetch_nand_1 (unsigned char *p, unsigned char v, int i)
return ret;
}
-int __atomic_is_lock_free (int i, void *p)
+bool __atomic_is_lock_free (int i, void *p)
{
- return 10;
+ *(short *)p = 1;
+ return true;
}
diff --git a/gcc/testsuite/gcc.dg/atomic-noinline.c b/gcc/testsuite/gcc.dg/atomic-noinline.c
index b3490ea..99912cc 100644
--- a/gcc/testsuite/gcc.dg/atomic-noinline.c
+++ b/gcc/testsuite/gcc.dg/atomic-noinline.c
@@ -11,13 +11,13 @@
#include <stdlib.h>
#include <stdbool.h>
-extern void abort();
+extern void abort (void);
-short as,bs,cs;
+short as,bs,cs,ds;
char ac,bc,cc;
int
-main ()
+main (void)
{
ac = __atomic_exchange_n (&bc, cc, __ATOMIC_RELAXED);
@@ -42,14 +42,9 @@ main ()
/* This should be translated to __atomic_fetch_add for the library */
as = __atomic_add_fetch (&cs, 10, __ATOMIC_RELAXED);
-
if (cs != 1)
abort ();
- /* The fake external function should return 10. */
- if (__atomic_is_lock_free (4, 0) != 10)
- abort ();
-
/* PR 51040 was caused by arithmetic code not patching up nand_fetch properly
when used an an external function. Look for proper return value here. */
ac = 0x3C;
@@ -57,8 +52,10 @@ main ()
if (bc != ac)
abort ();
+ if (!__atomic_is_lock_free (2, &ds))
+ abort ();
+ if (ds != 1)
+ abort ();
+
return 0;
}
-
-
-
diff --git a/gcc/testsuite/gnat.dg/opt51.adb b/gcc/testsuite/gnat.dg/opt51.adb
new file mode 100644
index 0000000..0d2c820
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt51.adb
@@ -0,0 +1,20 @@
+-- { dg-do compile }
+-- { dg-options "-O2 -fdump-tree-optimized" }
+
+with Opt51_Pkg; use Opt51_Pkg;
+
+procedure Opt51 (E: Enum; F : out Float) is
+begin
+ case (E) is
+ when One =>
+ F := 1.0;
+ when Two =>
+ F := 2.0;
+ when Three =>
+ F := 3.0;
+ when others =>
+ raise Program_Error;
+ end case;
+end;
+
+-- { dg-final { scan-tree-dump-not "check_PE_Explicit_Raise" "optimized" } }
diff --git a/gcc/testsuite/gnat.dg/opt51_pkg.ads b/gcc/testsuite/gnat.dg/opt51_pkg.ads
new file mode 100644
index 0000000..8ce1817
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt51_pkg.ads
@@ -0,0 +1,5 @@
+package Opt51_Pkg is
+
+ type Enum is (One, Two, Three);
+
+end Opt51_Pkg;