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
45a36b41
Commit
45a36b41
authored
Sep 22, 2014
by
yb9976
Browse files
Added local optimization: (x + 0x7F...F) ^ 0x7F...F -> -x.
parent
c39892b9
Changes
1
Hide whitespace changes
Inline
Side-by-side
ir/ir/iropt.c
View file @
45a36b41
...
...
@@ -2852,6 +2852,19 @@ static ir_node *transform_node_Eor_(ir_node *n)
return
n
;
}
if
(
is_Add
(
a
)
&&
get_Add_right
(
a
)
==
b
)
{
ir_tarval
*
tb
=
get_Const_tarval
(
b
);
ir_tarval
*
all_one
=
get_mode_all_one
(
mode
);
ir_tarval
*
expected
=
tarval_shr_unsigned
(
all_one
,
1
);
if
(
tb
==
expected
)
{
/* (x + 0x7F...F) ^ 0x7F...F -> -x */
dbg_info
*
dbgi
=
get_irn_dbg_info
(
n
);
ir_node
*
block
=
get_nodes_block
(
n
);
ir_node
*
aa
=
get_Add_left
(
a
);
return
new_rd_Minus
(
dbgi
,
block
,
aa
,
mode
);
}
}
if
(
is_Minus
(
a
)
&&
get_mode_arithmetic
(
mode
)
==
irma_twos_complement
)
{
ir_tarval
*
tv
=
get_Const_tarval
(
b
);
int
bits
=
(
int
)
get_mode_size_bits
(
mode
);
...
...
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