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
54e64ba3
Commit
54e64ba3
authored
Sep 22, 2014
by
yb9976
Browse files
Added local optimization: (x & 0x7F...F) - x -> x & 0x80...0.
parent
45a36b41
Changes
1
Hide whitespace changes
Inline
Side-by-side
ir/ir/iropt.c
View file @
54e64ba3
...
...
@@ -3451,6 +3451,23 @@ restart:
ir_node
*
not
=
new_rd_Not
(
dbgi
,
block
,
add
,
mode
);
return
not
;
}
/* (x & 0x7F...F) - x -> x & 0x80...0 */
if
(
is_And
(
a
)
&&
get_And_left
(
a
)
==
b
)
{
ir_node
*
ab
=
get_And_right
(
a
);
if
(
is_Const
(
ab
))
{
ir_tarval
*
tv
=
get_Const_tarval
(
ab
);
ir_tarval
*
all_one
=
get_mode_all_one
(
mode
);
ir_tarval
*
expected
=
tarval_shr_unsigned
(
all_one
,
1
);
if
(
tv
==
expected
)
{
dbg_info
*
const
dbgi
=
get_irn_dbg_info
(
n
);
ir_node
*
const
block
=
get_nodes_block
(
n
);
ir_graph
*
const
irg
=
get_irn_irg
(
n
);
ir_tarval
*
const
tv_not
=
tarval_not
(
tv
);
ir_node
*
const
not_c
=
new_rd_Const
(
dbgi
,
irg
,
tv_not
);
return
new_rd_And
(
dbgi
,
block
,
b
,
not_c
,
mode
);
}
}
}
/* x-(x&y) = x & ~y */
if
(
is_And
(
b
))
{
ir_node
*
and_left
=
get_And_left
(
b
);
...
...
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