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
5a0dcaa3
Commit
5a0dcaa3
authored
Sep 19, 2015
by
Matthias Braun
Browse files
amd64: x87 sim unops (fchs)
parent
98eb2301
Changes
3
Hide whitespace changes
Inline
Side-by-side
ir/be/amd64/amd64_x87.c
View file @
5a0dcaa3
...
...
@@ -58,6 +58,7 @@ static void prepare_callbacks(void)
x86_register_x87_sim
(
op_amd64_fld
,
sim_amd64_fld
);
x86_register_x87_sim
(
op_amd64_fld1
,
x86_x87_push
);
x86_register_x87_sim
(
op_amd64_fldz
,
x86_x87_push
);
x86_register_x87_sim
(
op_amd64_fchs
,
x86_sim_x87_unop
);
x86_register_x87_sim
(
op_amd64_fst
,
sim_amd64_fst
);
x86_register_x87_sim
(
op_amd64_fstp
,
sim_amd64_fstp
);
x86_register_x87_sim
(
op_amd64_ret
,
x86_sim_x87_ret
);
...
...
ir/be/ia32/x86_x87.c
View file @
5a0dcaa3
...
...
@@ -746,30 +746,26 @@ static void sim_binop(x87_state *const state, ir_node *const n)
)
}
/**
* Simulate a virtual Unop.
*
* @param state the x87 state
* @param n the node that should be simulated (and patched)
*/
static
void
sim_unop
(
x87_state
*
state
,
ir_node
*
n
)
void
x86_sim_x87_unop
(
x87_state
*
const
state
,
ir_node
*
const
node
)
{
arch_register_t
const
*
const
out
=
arch_get_irn_register
(
n
);
fp_liveness
const
live
=
fp_live_args_after
(
state
->
sim
,
n
,
REGMASK
(
out
));
DB
((
dbg
,
LEVEL_1
,
">>> %+F -> %s
\n
"
,
n
,
out
->
name
));
arch_register_t
const
*
const
out
=
arch_get_irn_register
(
node
);
fp_liveness
const
live
=
fp_live_args_after
(
state
->
sim
,
node
,
REGMASK
(
out
));
DB
((
dbg
,
LEVEL_1
,
">>> %+F -> %s
\n
"
,
node
,
out
->
name
));
DEBUG_ONLY
(
fp_dump_live
(
live
);)
ir_node
*
const
val
=
get_irn_n
(
n
,
0
);
ir_node
*
const
val
=
get_irn_n
(
n
ode
,
0
);
if
(
is_fp_live
(
val
,
live
))
{
/* push the operand here */
x87_dup_operand
(
state
,
n
,
0
,
val
,
out
);
x87_dup_operand
(
state
,
n
ode
,
0
,
val
,
out
);
}
else
{
/* operand is dead, bring it to tos */
move_to_tos
(
state
,
n
,
val
);
move_to_tos
(
state
,
n
ode
,
val
);
}
x87_set_st
(
state
,
n
,
0
);
DB
((
dbg
,
LEVEL_1
,
"<<< %s -> %s
\n
"
,
get_irn_opname
(
n
),
get_st_reg
(
0
)
->
name
));
x87_set_st
(
state
,
node
,
0
);
DB
((
dbg
,
LEVEL_1
,
"<<< %s -> %s
\n
"
,
get_irn_opname
(
node
),
get_st_reg
(
0
)
->
name
));
}
/**
...
...
@@ -1446,9 +1442,9 @@ void x86_prepare_x87_callbacks_ia32(void)
{
x86_prepare_x87_callbacks
();
x86_register_x87_sim
(
op_ia32_Call
,
sim_ia32_Call
);
x86_register_x87_sim
(
op_ia32_fabs
,
sim
_unop
);
x86_register_x87_sim
(
op_ia32_fabs
,
x86_sim_x87
_unop
);
x86_register_x87_sim
(
op_ia32_fadd
,
sim_binop
);
x86_register_x87_sim
(
op_ia32_fchs
,
sim
_unop
);
x86_register_x87_sim
(
op_ia32_fchs
,
x86_sim_x87
_unop
);
x86_register_x87_sim
(
op_ia32_fdiv
,
sim_binop
);
x86_register_x87_sim
(
op_ia32_fild
,
sim_ia32_x87_load
);
x86_register_x87_sim
(
op_ia32_fist
,
sim_ia32_fist
);
...
...
ir/be/ia32/x86_x87.h
View file @
5a0dcaa3
...
...
@@ -60,6 +60,8 @@ void x86_sim_x87_store_pop(x87_state *state, ir_node *n, int val_pos);
void
x86_sim_x87_ret
(
x87_state
*
state
,
ir_node
*
node
);
void
x86_sim_x87_unop
(
x87_state
*
state
,
ir_node
*
node
);
/** Push a value on the x87 stack. Intended to be used in sim functions. */
void
x86_x87_push
(
x87_state
*
state
,
ir_node
*
value
);
...
...
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