Commit 60d329a2 authored by Matthias Braun's avatar Matthias Braun
Browse files

rename pnc_flipped to ins_permuted and change back non-fix of cmov yesterday

[r16059]
parent 093bfe71
......@@ -677,14 +677,14 @@ static int determine_final_pnc(const ir_node *node, int flags_pos,
}
flags_attr = get_ia32_attr_const(cmp);
if(flags_attr->data.cmp_flipped)
if(flags_attr->data.ins_permuted)
pnc = get_mirrored_pnc(pnc);
pnc |= ia32_pn_Cmp_float;
} else if(is_ia32_Ucomi(flags) || is_ia32_Fucomi(flags)
|| is_ia32_Fucompi(flags)) {
flags_attr = get_ia32_attr_const(flags);
if(flags_attr->data.cmp_flipped)
if(flags_attr->data.ins_permuted)
pnc = get_mirrored_pnc(pnc);
pnc |= ia32_pn_Cmp_float;
} else {
......@@ -692,7 +692,7 @@ static int determine_final_pnc(const ir_node *node, int flags_pos,
|| is_ia32_Cmp8Bit(flags) || is_ia32_Test8Bit(flags));
flags_attr = get_ia32_attr_const(flags);
if(flags_attr->data.cmp_flipped)
if(flags_attr->data.ins_permuted)
pnc = get_mirrored_pnc(pnc);
if(flags_attr->data.cmp_unsigned)
pnc |= ia32_pn_Cmp_unsigned;
......@@ -883,8 +883,10 @@ emit_jcc:
static void emit_ia32_CMov(const ir_node *node)
{
const arch_register_t *out = arch_get_irn_register(arch_env, node);
pn_Cmp pnc = get_ia32_pncode(node);
const ia32_attr_t *attr = get_ia32_attr_const(node);
int ins_permuted = attr->data.ins_permuted;
const arch_register_t *out = arch_get_irn_register(arch_env, node);
pn_Cmp pnc = get_ia32_pncode(node);
const arch_register_t *in_true;
const arch_register_t *in_false;
......@@ -901,11 +903,9 @@ static void emit_ia32_CMov(const ir_node *node)
} else if(out == in_true) {
const arch_register_t *tmp;
if(pnc & ia32_pn_Cmp_float) {
pnc = get_negated_pnc(pnc, mode_F);
} else {
pnc = get_negated_pnc(pnc, mode_Iu);
}
assert(get_ia32_op_type(node) == ia32_Normal);
ins_permuted = !ins_permuted;
tmp = in_true;
in_true = in_false;
......@@ -919,6 +919,14 @@ static void emit_ia32_CMov(const ir_node *node)
be_emit_finish_line_gas(node);
}
if(ins_permuted) {
if(pnc & ia32_pn_Cmp_float) {
pnc = get_negated_pnc(pnc, mode_F);
} else {
pnc = get_negated_pnc(pnc, mode_Iu);
}
}
/* TODO: handling of Nans isn't correct yet */
be_emit_cstring("\tcmov");
......
......@@ -970,7 +970,7 @@ void ia32_swap_left_right(ir_node *node)
ir_node *left = get_irn_n(node, n_ia32_binary_left);
ir_node *right = get_irn_n(node, n_ia32_binary_right);
attr->data.cmp_flipped = !attr->data.cmp_flipped;
attr->data.ins_permuted = !attr->data.ins_permuted;
assert(is_ia32_commutative(node));
set_irn_n(node, n_ia32_binary_left, right);
set_irn_n(node, n_ia32_binary_right, left);
......@@ -1108,7 +1108,7 @@ int ia32_compare_attr(const ia32_attr_t *a, const ia32_attr_t *b) {
if (a->data.except_label != b->data.except_label)
return 1;
if (a->data.cmp_flipped != b->data.cmp_flipped
if (a->data.ins_permuted != b->data.ins_permuted
|| a->data.cmp_unsigned != b->data.cmp_unsigned)
return 1;
......
......@@ -98,8 +98,9 @@ struct ia32_attr_t {
unsigned need_stackent:1; /**< Set to 1 if node need space on stack. */
unsigned need_64bit_stackent:1; /**< needs a 64bit stack entity (see double->unsigned int conv) */
unsigned need_32bit_stackent:1; /**< needs a 32bit stack entity */
unsigned cmp_flipped : 1;
unsigned cmp_unsigned : 1;
unsigned ins_permuted : 1; /**< inputs of node have been permuted
(for commutative nodes) */
unsigned cmp_unsigned : 1; /**< compare should be unsigned */
} data;
int *out_flags; /**< flags for each produced value */
......
......@@ -896,8 +896,8 @@ Cmp => {
outs => [ "eflags" ],
am => "source,binary",
emit => '. cmp%M %binop',
attr => "int flipped, int cmp_unsigned",
init_attr => "attr->data.cmp_flipped = flipped;\n".
attr => "int ins_permuted, int cmp_unsigned",
init_attr => "attr->data.ins_permuted = ins_permuted;\n".
"\tattr->data.cmp_unsigned = cmp_unsigned;\n",
latency => 1,
units => [ "GP" ],
......@@ -912,8 +912,8 @@ Cmp8Bit => {
outs => [ "eflags" ],
am => "source,binary",
emit => '. cmpb %binop',
attr => "int flipped, int cmp_unsigned",
init_attr => "attr->data.cmp_flipped = flipped;\n".
attr => "int ins_permuted, int cmp_unsigned",
init_attr => "attr->data.ins_permuted = ins_permuted;\n".
"\tattr->data.cmp_unsigned = cmp_unsigned;\n",
latency => 1,
units => [ "GP" ],
......@@ -928,8 +928,8 @@ Test => {
outs => [ "eflags" ],
am => "source,binary",
emit => '. test%M %binop',
attr => "int flipped, int cmp_unsigned",
init_attr => "attr->data.cmp_flipped = flipped;\n".
attr => "int ins_permuted, int cmp_unsigned",
init_attr => "attr->data.ins_permuted = ins_permuted;\n".
"\tattr->data.cmp_unsigned = cmp_unsigned;\n",
latency => 1,
units => [ "GP" ],
......@@ -944,8 +944,8 @@ Test8Bit => {
outs => [ "eflags" ],
am => "source,binary",
emit => '. testb %binop',
attr => "int flipped, int cmp_unsigned",
init_attr => "attr->data.cmp_flipped = flipped;\n".
attr => "int ins_permuted, int cmp_unsigned",
init_attr => "attr->data.ins_permuted = ins_permuted;\n".
"\tattr->data.cmp_unsigned = cmp_unsigned;\n",
latency => 1,
units => [ "GP" ],
......@@ -972,9 +972,9 @@ CMov => {
reg_req => { in => [ "gp", "gp", "none", "gp", "gp", "eflags" ], out => [ "in_r4 in_r5" ] },
ins => [ "base", "index", "mem", "val_false", "val_true", "eflags" ],
am => "source,binary",
attr => "int flipped, pn_Cmp pn_code",
attr => "int ins_permuted, pn_Cmp pn_code",
init_attr => "attr->pn_code = pn_code;\n".
"attr->data.cmp_flipped = flipped;",
"attr->data.ins_permuted = ins_permuted;",
latency => 1,
units => [ "GP" ],
mode => $mode_gp,
......@@ -1401,8 +1401,8 @@ Ucomi => {
ins => [ "base", "index", "mem", "left", "right" ],
outs => [ "flags" ],
am => "source,binary",
attr => "int flipped",
init_attr => "attr->data.cmp_flipped = flipped;",
attr => "int ins_permuted",
init_attr => "attr->data.ins_permuted = ins_permuted;",
emit => ' .ucomi%XXM %binop',
latency => 3,
units => [ "SSE" ],
......@@ -1777,13 +1777,13 @@ vfldl2e => {
vFucomFnstsw => {
# we can't allow to rematerialize this node so we don't have
# accidently produce Phi(Fucom, Fucom(flipped))
# accidently produce Phi(Fucom, Fucom(ins_permuted))
# irn_flags => "R",
reg_req => { in => [ "vfp", "vfp" ], out => [ "eax" ] },
ins => [ "left", "right" ],
outs => [ "flags" ],
attr => "int flipped",
init_attr => "attr->attr.data.cmp_flipped = flipped;",
attr => "int ins_permuted",
init_attr => "attr->attr.data.ins_permuted = ins_permuted;",
latency => 3,
units => [ "VFP" ],
attr_type => "ia32_x87_attr_t",
......@@ -1795,8 +1795,8 @@ vFucomi => {
reg_req => { in => [ "vfp", "vfp" ], out => [ "eflags" ] },
ins => [ "left", "right" ],
outs => [ "flags" ],
attr => "int flipped",
init_attr => "attr->attr.data.cmp_flipped = flipped;",
attr => "int ins_permuted",
init_attr => "attr->attr.data.ins_permuted = ins_permuted;",
latency => 3,
units => [ "VFP" ],
attr_type => "ia32_x87_attr_t",
......@@ -1808,8 +1808,8 @@ vFtstFnstsw => {
reg_req => { in => [ "vfp" ], out => [ "eax" ] },
ins => [ "left" ],
outs => [ "flags" ],
attr => "int flipped",
init_attr => "attr->attr.data.cmp_flipped = flipped;",
attr => "int ins_permuted",
init_attr => "attr->attr.data.ins_permuted = ins_permuted;",
latency => 3,
units => [ "VFP" ],
attr_type => "ia32_x87_attr_t",
......
......@@ -1382,7 +1382,7 @@ static int sim_Fucom(x87_state *state, ir_node *n) {
int reg_index_1 = arch_register_get_index(op1);
int reg_index_2 = arch_register_get_index(op2);
unsigned live = vfp_live_args_after(sim, n, 0);
int flipped = attr->attr.data.cmp_flipped;
int permuted = attr->attr.data.ins_permuted;
int xchg = 0;
int pops = 0;
int node_added = NO_NODE_ADDED;
......@@ -1412,7 +1412,7 @@ static int sim_Fucom(x87_state *state, ir_node *n) {
/* res = tos X op */
} else if (op2_idx == 0) {
/* res = op X tos */
flipped = !flipped;
permuted = !permuted;
xchg = 1;
} else {
/* bring the first one to tos */
......@@ -1449,7 +1449,7 @@ static int sim_Fucom(x87_state *state, ir_node *n) {
}
/* res = op X tos, pop */
pops = 1;
flipped = !flipped;
permuted = !permuted;
xchg = 1;
} else {
/* both operands are dead here, check first for identity. */
......@@ -1484,7 +1484,7 @@ static int sim_Fucom(x87_state *state, ir_node *n) {
op2_idx = 0;
}
/* res = op X tos, pop, pop */
flipped = !flipped;
permuted = !permuted;
xchg = 1;
pops = 2;
} else {
......@@ -1498,7 +1498,7 @@ static int sim_Fucom(x87_state *state, ir_node *n) {
op2_idx = 0;
/* res = op X tos, pop, pop */
pops = 2;
flipped = !flipped;
permuted = !permuted;
xchg = 1;
} else if (op2_idx == 0) {
/* second one is TOS, move to st(1) */
......@@ -1585,7 +1585,7 @@ static int sim_Fucom(x87_state *state, ir_node *n) {
attr->x87[1] = op2;
}
attr->x87[2] = NULL;
attr->attr.data.cmp_flipped = flipped;
attr->attr.data.ins_permuted = permuted;
if (op2_idx >= 0)
DB((dbg, LEVEL_1, "<<< %s %s, %s\n", get_irn_opname(n),
......
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