Commit ac007947 authored by Moritz Kroll's avatar Moritz Kroll
Browse files

Conv(X) & all_one(mode(X)) = Conv(X)

[r25185]
parent c9312956
......@@ -1168,13 +1168,28 @@ static ir_node *equivalent_node_And(ir_node *n) {
DBG_OPT_ALGSIM0(oldn, n, FS_OPT_AND);
return n;
}
/* constants are cormalized to right, check this site first */
/* constants are normalized to right, check this site first */
tv = value_of(b);
if (tarval_is_all_one(tv)) {
n = a;
DBG_OPT_ALGSIM1(oldn, a, b, n, FS_OPT_AND);
return n;
}
if (tv != get_tarval_bad()) {
ir_mode *mode = get_irn_mode(n);
if (!mode_is_signed(mode) && is_Conv(a)) {
ir_node *convop = get_Conv_op(a);
ir_mode *convopmode = get_irn_mode(convop);
if (!mode_is_signed(convopmode)) {
if (new_tarval_from_long(get_tarval_long(tv), convopmode) == get_mode_all_one(convopmode)) {
/* Conv(X) & all_one(mode(X)) = Conv(X) */
n = a;
DBG_OPT_ALGSIM1(oldn, a, b, n, FS_OPT_AND);
return n;
}
}
}
}
tv = value_of(a);
if (tarval_is_all_one(tv)) {
n = b;
......
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