Commit 950f7f45 by Richard Guenther Committed by Richard Biener

double-int.h (double_int_and_not): New function.

2010-07-28  Richard Guenther  <rguenther@suse.de>

	* double-int.h (double_int_and_not): New function.
	* combine.c (try_combine): Use it.
	* tree-vrp.c (simplify_bit_ops_using_ranges): Likewise.

From-SVN: r162681
parent 8d074192
2010-07-28 Richard Guenther <rguenther@suse.de>
* double-int.h (double_int_and_not): New function.
* combine.c (try_combine): Use it.
* tree-vrp.c (simplify_bit_ops_using_ranges): Likewise.
2010-07-29 Bernd Schmidt <bernds@codesourcery.com> 2010-07-29 Bernd Schmidt <bernds@codesourcery.com>
PR rtl-optimization/42575 PR rtl-optimization/42575
......
...@@ -2601,7 +2601,7 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p) ...@@ -2601,7 +2601,7 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p)
i = double_int_and (i, m); i = double_int_and (i, m);
m = double_int_lshift (m, offset, HOST_BITS_PER_DOUBLE_INT, false); m = double_int_lshift (m, offset, HOST_BITS_PER_DOUBLE_INT, false);
i = double_int_lshift (i, offset, HOST_BITS_PER_DOUBLE_INT, false); i = double_int_lshift (i, offset, HOST_BITS_PER_DOUBLE_INT, false);
o = double_int_ior (double_int_and (o, double_int_not (m)), i); o = double_int_ior (double_int_and_not (o, m), i);
combine_merges++; combine_merges++;
subst_insn = i3; subst_insn = i3;
......
...@@ -158,7 +158,7 @@ static inline double_int ...@@ -158,7 +158,7 @@ static inline double_int
double_int_not (double_int a) double_int_not (double_int a)
{ {
a.low = ~a.low; a.low = ~a.low;
a.high = ~ a.high; a.high = ~a.high;
return a; return a;
} }
...@@ -182,6 +182,16 @@ double_int_and (double_int a, double_int b) ...@@ -182,6 +182,16 @@ double_int_and (double_int a, double_int b)
return a; return a;
} }
/* Returns A & ~B. */
static inline double_int
double_int_and_not (double_int a, double_int b)
{
a.low &= ~b.low;
a.high &= ~b.high;
return a;
}
/* Returns A ^ B. */ /* Returns A ^ B. */
static inline double_int static inline double_int
......
...@@ -6953,15 +6953,13 @@ simplify_bit_ops_using_ranges (gimple_stmt_iterator *gsi, gimple stmt) ...@@ -6953,15 +6953,13 @@ simplify_bit_ops_using_ranges (gimple_stmt_iterator *gsi, gimple stmt)
switch (gimple_assign_rhs_code (stmt)) switch (gimple_assign_rhs_code (stmt))
{ {
case BIT_AND_EXPR: case BIT_AND_EXPR:
mask = double_int_and (may_be_nonzero0, mask = double_int_and_not (may_be_nonzero0, must_be_nonzero1);
double_int_not (must_be_nonzero1));
if (double_int_zero_p (mask)) if (double_int_zero_p (mask))
{ {
op = op0; op = op0;
break; break;
} }
mask = double_int_and (may_be_nonzero1, mask = double_int_and_not (may_be_nonzero1, must_be_nonzero0);
double_int_not (must_be_nonzero0));
if (double_int_zero_p (mask)) if (double_int_zero_p (mask))
{ {
op = op1; op = op1;
...@@ -6969,15 +6967,13 @@ simplify_bit_ops_using_ranges (gimple_stmt_iterator *gsi, gimple stmt) ...@@ -6969,15 +6967,13 @@ simplify_bit_ops_using_ranges (gimple_stmt_iterator *gsi, gimple stmt)
} }
break; break;
case BIT_IOR_EXPR: case BIT_IOR_EXPR:
mask = double_int_and (may_be_nonzero0, mask = double_int_and_not (may_be_nonzero0, must_be_nonzero1);
double_int_not (must_be_nonzero1));
if (double_int_zero_p (mask)) if (double_int_zero_p (mask))
{ {
op = op1; op = op1;
break; break;
} }
mask = double_int_and (may_be_nonzero1, mask = double_int_and_not (may_be_nonzero1, must_be_nonzero0);
double_int_not (must_be_nonzero0));
if (double_int_zero_p (mask)) if (double_int_zero_p (mask))
{ {
op = op0; op = op0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment