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
fda57f0d
Commit
fda57f0d
authored
May 23, 2006
by
Michael Beck
Browse files
Add more special cases for Shift operations
[r7790]
parent
fe4f7796
Changes
1
Hide whitespace changes
Inline
Side-by-side
ir/lower/lower_dw.c
View file @
fda57f0d
...
...
@@ -906,15 +906,22 @@ static void lower_Shr(ir_node *node, ir_mode *mode, lower_env_t *env) {
tarval
*
tv
=
get_Const_tarval
(
right
);
if
(
tarval_is_long
(
tv
)
&&
get_tarval_long
(
tv
)
=
=
get_mode_size_bits
(
env
->
params
->
low_signed
))
{
get_tarval_long
(
tv
)
>
=
get_mode_size_bits
(
mode
))
{
ir_node
*
block
=
get_nodes_block
(
node
);
ir_node
*
left
=
get_Shr_left
(
node
);
ir_node
*
c
;
long
shf_cnt
=
get_tarval_long
(
tv
)
-
get_mode_size_bits
(
mode
);
int
idx
=
get_irn_idx
(
left
);
left
=
env
->
entries
[
idx
]
->
high_word
;
idx
=
get_irn_idx
(
node
);
env
->
entries
[
idx
]
->
low_word
=
left
;
if
(
shf_cnt
>
0
)
{
c
=
new_r_Const_long
(
current_ir_graph
,
block
,
mode_Iu
,
shf_cnt
);
env
->
entries
[
idx
]
->
low_word
=
new_r_Shr
(
current_ir_graph
,
block
,
left
,
c
,
mode
);
}
else
env
->
entries
[
idx
]
->
low_word
=
left
;
env
->
entries
[
idx
]
->
high_word
=
new_r_Const
(
current_ir_graph
,
block
,
mode
,
get_mode_null
(
mode
));
return
;
...
...
@@ -933,16 +940,23 @@ static void lower_Shl(ir_node *node, ir_mode *mode, lower_env_t *env) {
tarval
*
tv
=
get_Const_tarval
(
right
);
if
(
tarval_is_long
(
tv
)
&&
get_tarval_long
(
tv
)
=
=
get_mode_size_bits
(
env
->
params
->
low_signed
))
{
get_tarval_long
(
tv
)
>
=
get_mode_size_bits
(
mode
))
{
ir_node
*
block
=
get_nodes_block
(
node
);
ir_node
*
left
=
get_Shl_left
(
node
);
ir_node
*
c
;
long
shf_cnt
=
get_tarval_long
(
tv
)
-
get_mode_size_bits
(
mode
);
int
idx
=
get_irn_idx
(
left
);
left
=
env
->
entries
[
idx
]
->
low_word
;
idx
=
get_irn_idx
(
node
);
if
(
shf_cnt
>
0
)
{
c
=
new_r_Const_long
(
current_ir_graph
,
block
,
mode_Iu
,
shf_cnt
);
env
->
entries
[
idx
]
->
high_word
=
new_r_Shl
(
current_ir_graph
,
block
,
left
,
c
,
mode
);
}
else
env
->
entries
[
idx
]
->
high_word
=
left
;
env
->
entries
[
idx
]
->
low_word
=
new_r_Const
(
current_ir_graph
,
block
,
mode
,
get_mode_null
(
mode
));
env
->
entries
[
idx
]
->
high_word
=
left
;
return
;
}
...
...
@@ -960,17 +974,24 @@ static void lower_Shrs(ir_node *node, ir_mode *mode, lower_env_t *env) {
tarval
*
tv
=
get_Const_tarval
(
right
);
if
(
tarval_is_long
(
tv
)
&&
get_tarval_long
(
tv
)
=
=
get_mode_size_bits
(
env
->
params
->
low_signed
))
{
get_tarval_long
(
tv
)
>
=
get_mode_size_bits
(
mode
))
{
ir_node
*
block
=
get_nodes_block
(
node
);
ir_node
*
left
=
get_Shrs_left
(
node
);
long
shf_cnt
=
get_tarval_long
(
tv
)
-
get_mode_size_bits
(
mode
);
ir_node
*
c
;
int
idx
=
get_irn_idx
(
left
);
left
=
env
->
entries
[
idx
]
->
high_word
;
idx
=
get_irn_idx
(
node
);
if
(
shf_cnt
>
0
)
{
c
=
new_r_Const_long
(
current_ir_graph
,
block
,
mode_Iu
,
shf_cnt
);
env
->
entries
[
idx
]
->
low_word
=
new_r_Shrs
(
current_ir_graph
,
block
,
left
,
c
,
mode
);
}
else
env
->
entries
[
idx
]
->
low_word
=
left
;
c
=
new_r_Const_long
(
current_ir_graph
,
block
,
mode_Iu
,
get_mode_size_bits
(
mode
)
-
1
);
env
->
entries
[
idx
]
->
low_word
=
left
;
env
->
entries
[
idx
]
->
high_word
=
new_r_Shrs
(
current_ir_graph
,
block
,
left
,
c
,
mode
);
return
;
...
...
@@ -989,7 +1010,7 @@ static void lower_Rot(ir_node *node, ir_mode *mode, lower_env_t *env) {
tarval
*
tv
=
get_Const_tarval
(
right
);
if
(
tarval_is_long
(
tv
)
&&
get_tarval_long
(
tv
)
==
get_mode_size_bits
(
env
->
params
->
low_signed
))
{
get_tarval_long
(
tv
)
==
get_mode_size_bits
(
mode
))
{
ir_node
*
block
=
get_nodes_block
(
node
);
ir_node
*
left
=
get_Rot_left
(
node
);
ir_node
*
h
,
*
l
;
...
...
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