expmed.c (expand_divmod): Always use a comparison for a division by a large unsigned integer.

2009-04-09  Paolo Bonzini  <bonzini@gnu.org>

	* expmed.c (expand_divmod): Always use a comparison for a division
	by a large unsigned integer.

        * fold-const.c (tree_single_nonzero_warnv_p): Always treat decls
        for things others than variables or functions as nonzero.

testsuite:
2009-04-09  Paolo Bonzini  <bonzini@gnu.org>

        * gcc.dg/pr27150-1.c: Change to a link test.

From-SVN: r145846
This commit is contained in:
Paolo Bonzini 2009-04-09 16:07:43 +00:00 committed by Paolo Bonzini
parent 9332c6ebd1
commit b45f0e58d7
5 changed files with 60 additions and 8 deletions

View File

@ -1,3 +1,11 @@
2009-04-09 Paolo Bonzini <bonzini@gnu.org>
* expmed.c (expand_divmod): Always use a comparison for a division
by a large unsigned integer.
* fold-const.c (tree_single_nonzero_warnv_p): Always treat decls
for things others than variables or functions as nonzero.
2009-04-09 Nick Clifton <nickc@redhat.com>
* unwind-compat.c: Change copyright header to refer to version
@ -338,6 +346,41 @@
2009-04-09 Paolo Bonzini <bonzini@gnu.org>
* config/i386/i386.md (cmpcc): New.
* config/i386/sync.md (sync_compare_and_swap*): Set FLAGS_REG.
(sync_compare_and_swap_cc*): Delete.
* config/s390/s390.c (s390_compare_emitted): Remove.
(s390_emit_compare): Handle MODE_CC s390_compare_op0 like
s390_compare_emitted used to be handled. Assert that modes match.
(s390_emit_compare_and_swap): Use s390_emit_compare, do not
refer to sync_compare_and_swap_ccsi.
* config/s390/s390.h (s390_compare_emitted): Remove.
* config/s390/s390.md (seq): Look for MODE_CC s390_compare_op0
instead of s390_compare_emitted.
(stack_protect_test, sync_compare_and_swap_cc): Set s390_compare_op0
instead of s390_compare_emitted.
* config/s390/s390.md (cmpcc): New.
(sync_compare_and_swapqi, sync_compare_and_swaphi): Clobber
CC_REGNUM, do not pretend it's set.
(sync_compare_and_swap_cc*): Delete.
* config/s390/predicates.md (cc_reg_operand): New.
* expr.c (sync_compare_and_swap_cc): Delete.
* optabs.h (sync_compare_and_swap_cc): Delete.
* optabs.c (prepare_cmp_insn): Ignore which specific CCmode
is being used with can_compare_p.
(emit_cmp_and_jump_insn_1): Likewise when looking in the optab.
(find_cc_set): New.
(expand_bool_compare_and_swap): Do not use sync_compare_and_swap_cc,
look for a MODE_CC set instead. Use emit_store_flag.
(expand_compare_and_swap_loop): Likewise, with some additional
complication to avoid a force_reg when useless. Use
emit_cmp_and_jump_insns.
* genopinit.c (optabs): Delete sync_compare_and_swap_cc.
* doc/md.texi (sync_compare_and_swap_cc): Merge with
sync_compare_and_swap documentation.
=======
* config/i386/i386.md (cmpcc): New.
* config/i386/sync.md (sync_compare_and_swap*): Set FLAGS_REG.
(sync_compare_and_swap_cc*): Delete.

View File

@ -3998,10 +3998,8 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode,
{
/* Most significant bit of divisor is set; emit an scc
insn. */
quotient = emit_store_flag (tquotient, GEU, op0, op1,
compute_mode, 1, 1);
if (quotient == 0)
goto fail1;
quotient = emit_store_flag_force (tquotient, GEU, op0, op1,
compute_mode, 1, 1);
}
else
{

View File

@ -15018,8 +15018,8 @@ tree_single_nonzero_warnv_p (tree t, bool *strict_overflow_p)
return false;
/* Weak declarations may link to NULL. */
if (VAR_OR_FUNCTION_DECL_P (base))
return !DECL_WEAK (base);
if (DECL_P (base) && flag_delete_null_pointer_checks)
return !VAR_OR_FUNCTION_DECL_P (base) || !DECL_WEAK (base);
/* Constants are never weak. */
if (CONSTANT_CLASS_P (base))

View File

@ -1,3 +1,7 @@
2009-04-09 Paolo Bonzini <bonzini@gnu.org>
* gcc.dg/pr27150-1.c: Change to a link test.
2009-04-09 Jakub Jelinek <jakub@redhat.com>
* g++.dg/lookup/using2.C: Change copyright header to refer to version

View File

@ -1,7 +1,14 @@
/* { dg-do compile } */
/* { dg-do link } */
/* { dg-options "-O2" } */
extern int link_error ();
int g(int f)
{
return (&f)!=0;
int a = ((&f)!=0);
if (!a) link_error ();
return a;
}
int main()
{
g(10);
}