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
d7fdfbf0
Commit
d7fdfbf0
authored
Jan 24, 2016
by
Christoph Mallon
Browse files
iropt: Simplify the transformation for 'a + a -> a * 2'.
parent
b0560fb4
Changes
1
Show whitespace changes
Inline
Side-by-side
ir/opt/iropt.c
View file @
d7fdfbf0
...
@@ -3004,14 +3004,8 @@ static ir_node *transform_node_Add(ir_node *n)
...
@@ -3004,14 +3004,8 @@ static ir_node *transform_node_Add(ir_node *n)
ir_node
*
const
block
=
get_nodes_block
(
n
);
ir_node
*
const
block
=
get_nodes_block
(
n
);
if
(
!
irg_is_constrained
(
irg
,
IR_GRAPH_CONSTRAINT_ARCH_DEP
))
{
if
(
!
irg_is_constrained
(
irg
,
IR_GRAPH_CONSTRAINT_ARCH_DEP
))
{
/* a + a -> a * 2 */
/* a + a -> a * 2 */
ir_tarval
*
tv_two
;
ir_tarval
*
const
tv_one
=
get_mode_one
(
mode
);
if
(
get_mode_arithmetic
(
mode
)
==
irma_twos_complement
)
{
ir_tarval
*
const
tv_two
=
tarval_add
(
tv_one
,
tv_one
);
tv_two
=
new_tarval_from_long
(
2
,
mode
);
}
else
{
assert
(
mode_is_float
(
mode
));
tv_two
=
new_tarval_from_long
(
2
,
mode_Is
);
tv_two
=
tarval_convert_to
(
tv_two
,
mode
);
}
ir_node
*
const
two
=
new_r_Const
(
irg
,
tv_two
);
ir_node
*
const
two
=
new_r_Const
(
irg
,
tv_two
);
n
=
new_rd_Mul
(
dbgi
,
block
,
a
,
two
,
mode
);
n
=
new_rd_Mul
(
dbgi
,
block
,
a
,
two
,
mode
);
DBG_OPT_ALGSIM0
(
oldn
,
n
);
DBG_OPT_ALGSIM0
(
oldn
,
n
);
...
...
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