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
9c4ae675
Commit
9c4ae675
authored
Jan 20, 2016
by
Christoph Mallon
Browse files
ia32: Generate better code for '~(1 << x)'.
'mov $~1, %r; rol x, %r' is shorter than 'mov $1, %r; shl x, %r; not %r'.
parent
438c74ad
Changes
2
Hide whitespace changes
Inline
Side-by-side
NEWS.md
View file @
9c4ae675
...
...
@@ -3,6 +3,7 @@ libFirm 1.22.1 (2016-01-07)
*
Fix cmake/make build
*
Support PIC with PLT for ELF (amd64)
*
Add
`ia32-get_ip={pop,thunk}`
*
Generate 'mov $~1, %r; rol x, %r' for '~(1 << x)' (ia32)
*
Bugfixes
libFirm 1.22.0 (2015-12-31)
...
...
ir/be/ia32/ia32_transform.c
View file @
9c4ae675
...
...
@@ -2072,6 +2072,18 @@ static ir_node *gen_Not(ir_node *node)
{
assert
(
get_irn_mode
(
node
)
!=
mode_b
);
/* should be lowered already */
ir_node
*
op
=
get_Not_op
(
node
);
if
(
is_Shl_1
(
op
))
{
/* ~(1 << x) -> Rol(~1, x) */
dbg_info
*
const
dbgi
=
get_irn_dbg_info
(
node
);
ir_node
*
const
block
=
be_transform_nodes_block
(
node
);
x86_imm32_t
const
imm
=
{
.
offset
=
-
2
};
ir_node
*
const
m2
=
new_bd_ia32_Const
(
NULL
,
block
,
&
imm
);
ir_node
*
const
val
=
get_Shl_right
(
op
);
ir_node
*
const
new_val
=
be_transform_node
(
val
);
return
new_bd_ia32_Rol
(
dbgi
,
block
,
m2
,
new_val
);
}
return
gen_unop
(
node
,
op
,
new_bd_ia32_Not
,
match_mode_neutral
);
}
...
...
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