Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
0bdadbb9
Commit
0bdadbb9
authored
May 27, 2011
by
Matthias Braun
Browse files
implement 'x-(x&y) => x & ~y' localopt
parent
cc3f1146
Changes
1
Hide whitespace changes
Inline
Side-by-side
ir/ir/iropt.c
View file @
0bdadbb9
...
...
@@ -2360,8 +2360,8 @@ restart:
}
if
(
get_mode_arithmetic
(
mode
)
==
irma_twos_complement
)
{
/* c - ~X = X + (c+1) */
if
(
is_Const
(
a
)
&&
is_Not
(
b
))
{
/* c - ~X = X + (c+1) */
ir_tarval
*
tv
=
get_Const_tarval
(
a
);
tv
=
tarval_add
(
tv
,
get_mode_one
(
mode
));
...
...
@@ -2374,6 +2374,24 @@ restart:
return
n
;
}
}
/* x-(x&y) = x & ~y */
if
(
is_And
(
b
))
{
ir_node
*
and_left
=
get_And_left
(
b
);
ir_node
*
and_right
=
get_And_right
(
b
);
if
(
and_right
==
a
)
{
ir_node
*
tmp
=
and_left
;
and_left
=
and_right
;
and_right
=
tmp
;
}
if
(
and_left
==
a
)
{
dbg_info
*
dbgi
=
get_irn_dbg_info
(
n
);
ir_node
*
block
=
get_nodes_block
(
n
);
ir_mode
*
mode
=
get_irn_mode
(
n
);
ir_node
*
notn
=
new_rd_Not
(
dbgi
,
block
,
and_right
,
mode
);
ir_node
*
and
=
new_rd_And
(
dbgi
,
block
,
a
,
notn
,
mode
);
return
and
;
}
}
}
return
n
;
}
/* transform_node_Sub */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment