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
This commit is contained in:
Eric Botcazou 2015-10-26 17:02:48 +00:00
parent f52a73a48e
commit f6c1575958
7 changed files with 53 additions and 20 deletions

View File

@ -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>

View File

@ -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
{

View File

@ -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.

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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" } }

View File

@ -0,0 +1,5 @@
package Opt51_Pkg is
type Enum is (One, Two, Three);
end Opt51_Pkg;