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
33c65969
Commit
33c65969
authored
Jul 02, 2014
by
yb9976
Browse files
Added local optimizations: And(x, 0x80000000) ==/!= 0 ==> x >=/< 0.
parent
c0f41499
Changes
1
Hide whitespace changes
Inline
Side-by-side
ir/ir/iropt.c
View file @
33c65969
...
@@ -5015,7 +5015,8 @@ is_bittest: {
...
@@ -5015,7 +5015,8 @@ is_bittest: {
* And(x, C1) == C2 ==> FALSE if C2 & C1 != C2
* And(x, C1) == C2 ==> FALSE if C2 & C1 != C2
* And(x, C1) != C2 ==> TRUE if C2 & C1 != C2
* And(x, C1) != C2 ==> TRUE if C2 & C1 != C2
*/
*/
ir_tarval
*
mask
=
tarval_and
(
get_Const_tarval
(
c1
),
tv
);
ir_tarval
*
tv1
=
get_Const_tarval
(
c1
);
ir_tarval
*
mask
=
tarval_and
(
tv1
,
tv
);
if
(
mask
!=
tv
)
{
if
(
mask
!=
tv
)
{
/* TODO: move to constant evaluation */
/* TODO: move to constant evaluation */
c1
=
create_bool_const
(
irg
,
!
is_relation_equal
);
c1
=
create_bool_const
(
irg
,
!
is_relation_equal
);
...
@@ -5043,6 +5044,20 @@ is_bittest: {
...
@@ -5043,6 +5044,20 @@ is_bittest: {
DBG_OPT_ALGSIM0
(
n
,
n
,
FS_OPT_CMP_CNST_MAGN
);
DBG_OPT_ALGSIM0
(
n
,
n
,
FS_OPT_CMP_CNST_MAGN
);
}
}
}
}
if
(
mode_is_signed
(
mode
)
&&
get_mode_arithmetic
(
mode
)
==
irma_twos_complement
&&
get_mode_min
(
mode
)
==
tv1
&&
tarval_is_null
(
tv
))
{
/*
* And(x, 0x80000000) == 0 ==> x >= 0
* And(x, 0x80000000) != 0 ==> x < 0
*/
left
=
get_And_left
(
left
);
relation
=
is_relation_equal
?
ir_relation_greater_equal
:
ir_relation_less
;
changedc
=
true
;
}
}
}
break
;
break
;
case
iro_Or
:
case
iro_Or
:
...
...
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