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
c63a7f46
Commit
c63a7f46
authored
May 16, 2014
by
yb9976
Browse files
Improve is_Eor_Add by using bit information.
This enables the optimization (a & 0x80000000) + a -> a & 0x7FFFFFFF.
parent
29556dea
Changes
1
Hide whitespace changes
Inline
Side-by-side
ir/ir/iropt.c
View file @
c63a7f46
...
...
@@ -81,16 +81,18 @@ static bool is_Eor_Add(const ir_node *node)
if
(
!
is_Eor
(
node
)
&&
!
is_Add
(
node
))
return
false
;
const
ir_node
*
right
=
get_binop_right
(
node
);
if
(
!
is_Const
(
right
))
return
false
;
const
ir_mode
*
mode
=
get_irn_mode
(
node
);
if
(
get_mode_arithmetic
(
mode
)
!=
irma_twos_complement
)
return
false
;
ir_tarval
*
tv
=
get_Const_tarval
(
right
);
return
get_tarval_lowest_bit
(
tv
)
==
(
int
)
get_mode_size_bits
(
mode
)
-
1
;
const
ir_node
*
const
left
=
get_binop_left
(
node
);
const
ir_node
*
const
right
=
get_binop_right
(
node
);
const
bitinfo
*
const
bl
=
get_bitinfo
(
left
);
const
bitinfo
*
const
br
=
get_bitinfo
(
right
);
const
int
highest_bit
=
(
int
)
get_mode_size_bits
(
mode
)
-
1
;
return
(
bl
&&
get_tarval_lowest_bit
(
bl
->
z
)
==
highest_bit
)
||
(
br
&&
get_tarval_lowest_bit
(
br
->
z
)
==
highest_bit
);
}
/**
...
...
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