diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b2be8cf7411..f90887f84b3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,4 +1,9 @@ -2015-10-26 Simon Dardis +2015-10-26 Eric Botcazou + + * match.pd (fold_widened_comparison): Apply simplifications to all + integral types. + +2015-10-26 Simon Dardis * 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 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 Dominik Vogt diff --git a/gcc/match.pd b/gcc/match.pd index fa927b07f56..6535b597e95 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 04700fbf842..db008b260a3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2015-10-26 Eric Botcazou + + * 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 * 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 deab7ae1de3..97989798fe5 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 b3490ea3260..99912cc87e7 100644 --- a/gcc/testsuite/gcc.dg/atomic-noinline.c +++ b/gcc/testsuite/gcc.dg/atomic-noinline.c @@ -11,13 +11,13 @@ #include #include -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 00000000000..0d2c82007bf --- /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 00000000000..8ce1817653a --- /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;