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
db758254
Commit
db758254
authored
Dec 10, 2013
by
yb9976
Browse files
Try to adapt Cmp relation before creating a Mux.
parent
d012a76d
Changes
1
Show whitespace changes
Inline
Side-by-side
ir/ir/iropt.c
View file @
db758254
...
...
@@ -5464,6 +5464,24 @@ static bool ir_is_optimizable_mux_set(const ir_node *cond, ir_relation relation)
ir_node
*
right
=
get_Cmp_right
(
cond
);
relation
&=
~
ir_relation_unordered
;
/* Try to use an appropriate relation. */
if
(
relation
==
ir_relation_equal
)
{
ir_relation
possible
=
ir_get_possible_cmp_relations
(
left
,
right
);
if
(
!
(
possible
&
ir_relation_less
))
{
relation
|=
ir_relation_less
;
}
else
if
(
!
(
possible
&
ir_relation_greater
))
{
relation
|=
ir_relation_greater
;
}
}
else
if
(
relation
==
ir_relation_less_greater
)
{
ir_relation
possible
=
ir_get_possible_cmp_relations
(
left
,
right
);
if
(
!
(
possible
&
ir_relation_less
))
{
relation
&=
~
ir_relation_less
;
}
else
if
(
!
(
possible
&
ir_relation_greater
))
{
relation
&=
~
ir_relation_greater
;
}
}
if
(
get_mode_size_bits
(
mode
)
>=
get_mode_size_bits
(
dest_mode
))
{
/* Due to possible overflows, we can only transform compares with special constants. */
if
(
!
mode_is_signed
(
mode
)
||
!
is_Const
(
right
))
...
...
@@ -5595,6 +5613,24 @@ static ir_node *transform_Mux_set(ir_node *n)
ir_node
*
right
=
get_Cmp_right
(
cond
);
ir_relation
relation
=
get_Cmp_relation
(
cond
)
&
~
ir_relation_unordered
;
/* Try to use an appropriate relation. */
if
(
relation
==
ir_relation_equal
)
{
ir_relation
possible
=
ir_get_possible_cmp_relations
(
left
,
right
);
if
(
!
(
possible
&
ir_relation_less
))
{
relation
|=
ir_relation_less
;
}
else
if
(
!
(
possible
&
ir_relation_greater
))
{
relation
|=
ir_relation_greater
;
}
}
else
if
(
relation
==
ir_relation_less_greater
)
{
ir_relation
possible
=
ir_get_possible_cmp_relations
(
left
,
right
);
if
(
!
(
possible
&
ir_relation_less
))
{
relation
&=
~
ir_relation_less
;
}
else
if
(
!
(
possible
&
ir_relation_greater
))
{
relation
&=
~
ir_relation_greater
;
}
}
if
(
get_mode_size_bits
(
mode
)
>=
get_mode_size_bits
(
dest_mode
))
{
/* Due to possible overflows, we can only transform compares with special constants. */
if
(
!
mode_is_signed
(
mode
)
||
!
is_Const
(
right
))
...
...
Write
Preview
Supports
Markdown
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