Commit 86944688 authored by Christian Würdig's avatar Christian Würdig
Browse files

fixed address mode for CmpSet and xCmpSet

parent a9defcb1
......@@ -600,11 +600,14 @@ insert_copy:
}
}
/* If we have a CondJmp with immediate, we need to */
/* If we have a CondJmp/CmpSet/xCmpSet with immediate, we need to */
/* check if it's the right operand, otherwise we have */
/* to change it, as CMP doesn't support immediate as */
/* left operands. */
if (is_ia32_CondJmp(irn) && (is_ia32_ImmConst(irn) || is_ia32_ImmSymConst(irn)) && op_tp == ia32_AddrModeS) {
if ((is_ia32_CondJmp(irn) || is_ia32_CmpSet(irn) || is_ia32_xCmpSet(irn)) &&
(is_ia32_ImmConst(irn) || is_ia32_ImmSymConst(irn)) &&
op_tp == ia32_AddrModeS)
{
set_ia32_op_type(irn, ia32_AddrModeD);
set_ia32_pncode(irn, get_inversed_pnc(get_ia32_pncode(irn)));
}
......
......@@ -359,6 +359,8 @@ const char *ia32_emit_binop(const ir_node *n, ia32_emit_env_t *env) {
is_ia32_Store8Bit(n) || \
is_ia32_CondJmp(n) || \
is_ia32_xCondJmp(n) || \
is_ia32_CmpSet(n) || \
is_ia32_xCmpSet(n) || \
is_ia32_SwitchJmp(n)))
if (! buf) {
......@@ -1051,7 +1053,7 @@ static void Set_emitter(ir_node *irn, ia32_emit_env_t *env) {
instr = "sub";
}
lc_esnprintf(arg_env, cmd_buf, SNPRINTF_BUF_LEN, "%s %1D, %1D", instr, irn, irn);
snprintf(cmd_buf, SNPRINTF_BUF_LEN, "%s %%%s, %%%s", instr, arch_register_get_name(out), arch_register_get_name(out));
snprintf(cmnt_buf, SNPRINTF_BUF_LEN, "/* clear target as set modifies only lower 8 bit */");
IA32_DO_EMIT(irn);
......
......@@ -1750,12 +1750,14 @@ static ir_node *gen_Psi(ia32_transform_env_t *env) {
/* first case for SETcc: default is 0, set to 1 iff condition is true */
new_op = gen_binop(env, cmp_a, cmp_b, set_func);
set_ia32_pncode(get_Proj_pred(new_op), pnc);
set_ia32_am_support(get_Proj_pred(new_op), ia32_am_Source);
}
else if (is_ia32_Const_0(psi_true) && is_ia32_Const_1(psi_default)) {
/* second case for SETcc: default is 1, set to 0 iff condition is true: */
/* we invert condition and set default to 0 */
new_op = gen_binop(env, cmp_a, cmp_b, set_func);
set_ia32_pncode(get_Proj_pred(new_op), get_negated_pnc(pnc, mode));
set_ia32_am_support(get_Proj_pred(new_op), ia32_am_Source);
}
else {
/* otherwise: use CMOVcc */
......@@ -2037,11 +2039,11 @@ static ir_node *gen_be_StackParam(ia32_transform_env_t *env) {
entity *ent = be_get_frame_entity(node);
ir_mode *mode = env->mode;
// /* If the StackParam has only one user -> */
// /* put it in the Block where the user resides */
// if (get_irn_n_edges(node) == 1) {
// env->block = get_nodes_block(get_edge_src_irn(get_irn_out_edge_first(node)));
// }
/* If the StackParam has only one user -> */
/* put it in the Block where the user resides */
if (get_irn_n_edges(node) == 1) {
env->block = get_nodes_block(get_edge_src_irn(get_irn_out_edge_first(node)));
}
if (mode_is_float(mode)) {
FP_USED(env->cg);
......@@ -2628,6 +2630,7 @@ static void transform_psi_cond(ir_node *cond, ir_mode *mode, ia32_code_gen_t *cg
new_op = gen_binop(&tenv, cmp_a, cmp_b, set_func);
set_ia32_pncode(get_Proj_pred(new_op), pnc);
set_ia32_am_support(get_Proj_pred(new_op), ia32_am_Source);
}
/* exchange with old compare */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment