Commit 7715d51a authored by Christoph Mallon's avatar Christoph Mallon
Browse files

When making a 'Shl', 'Shr' or 'Shrs', automatically infer its mode from the left operand.

parent 3bd0255f
......@@ -235,18 +235,18 @@ static void lower64_shl(ir_node *node, ir_mode *mode)
right_low = new_rd_Conv(dbgi, block, right, umode);
}
/* Res_lo = L_hi << R | L_lo << (R - 32) | L_lo >> (32 - R) */
ir_node *shl1 = new_rd_Shl(dbgi, block, left_high, right_low, mode);
ir_node *shl1 = new_rd_Shl(dbgi, block, left_high, right_low);
ir_graph *irg = get_irn_irg(node);
ir_node *c32 = new_r_Const_long(irg, umode, 32);
ir_node *sub = new_rd_Sub(dbgi, block, right_low, c32, umode);
ir_node *llo_conv = new_rd_Conv(dbgi, block, left_low, mode);
ir_node *shl2 = new_rd_Shl(dbgi, block, llo_conv, sub, mode);
ir_node *shl2 = new_rd_Shl(dbgi, block, llo_conv, sub);
ir_node *or = new_rd_Or(dbgi, block, shl1, shl2);
ir_node *sub2 = new_rd_Sub(dbgi, block, c32, right_low, umode);
ir_node *shr = new_rd_Shr(dbgi, block, llo_conv, sub2, mode);
ir_node *shr = new_rd_Shr(dbgi, block, llo_conv, sub2);
ir_node *or2 = new_rd_Or(dbgi, block, or, shr);
/* Res_lo = L_lo << R */
ir_node *low = new_rd_Shl(dbgi, block, left_low, right_low, umode);
ir_node *low = new_rd_Shl(dbgi, block, left_low, right_low);
ir_set_dw_lowered(node, low, or2);
}
......@@ -268,18 +268,18 @@ static void lower64_shr(ir_node *node, ir_mode *mode)
right_low = new_rd_Conv(dbgi, block, right, umode);
}
/* Res_lo = L_lo >> R | L_hi >> (R - 32) | L_hi << (32 - R) */
ir_node *shr1 = new_rd_Shr(dbgi, block, left_low, right_low, umode);
ir_node *shr1 = new_rd_Shr(dbgi, block, left_low, right_low);
ir_graph *irg = get_irn_irg(node);
ir_node *c32 = new_r_Const_long(irg, umode, 32);
ir_node *sub = new_rd_Sub(dbgi, block, right_low, c32, umode);
ir_node *lhi_conv = new_rd_Conv(dbgi, block, left_high, umode);
ir_node *shr2 = new_rd_Shr(dbgi, block, lhi_conv, sub, umode);
ir_node *shr2 = new_rd_Shr(dbgi, block, lhi_conv, sub);
ir_node *or = new_rd_Or(dbgi, block, shr1, shr2);
ir_node *sub2 = new_rd_Sub(dbgi, block, c32, right_low, umode);
ir_node *shl = new_rd_Shl(dbgi, block, lhi_conv, sub2, umode);
ir_node *shl = new_rd_Shl(dbgi, block, lhi_conv, sub2);
ir_node *or2 = new_rd_Or(dbgi, block, or, shl);
/* Res_hi = L_hi >> R */
ir_node *shr3 = new_rd_Shr(dbgi, block, left_high, right_low, mode);
ir_node *shr3 = new_rd_Shr(dbgi, block, left_high, right_low);
ir_set_dw_lowered(node, or2, shr3);
}
......@@ -301,7 +301,7 @@ static void lower64_shrs(ir_node *node, ir_mode *mode)
} else {
right_low = new_rd_Conv(dbgi, block, right, umode);
}
ir_node *shr = new_rd_Shr(dbgi, block, left_low, right_low, umode);
ir_node *shr = new_rd_Shr(dbgi, block, left_low, right_low);
ir_graph *irg = get_irn_irg(node);
ir_node *c32 = new_r_Const_long(irg, umode, 32);
ir_node *sub = new_rd_Sub(dbgi, block, c32, right_low, umode);
......@@ -309,13 +309,12 @@ static void lower64_shrs(ir_node *node, ir_mode *mode)
ir_node *subs_res = new_r_Proj(subs, umode, pn_arm_SubS_t_res);
ir_node *subs_flags = new_r_Proj(subs, mode_ANY, pn_arm_SubS_t_flags);
ir_node *left_highu = new_rd_Conv(dbgi, block, left_high, umode);
ir_node *shl = new_rd_Shl(dbgi, block, left_highu, sub, umode);
ir_node *shl = new_rd_Shl(dbgi, block, left_highu, sub);
ir_node *or = new_rd_Or(dbgi, block, shr, shl);
ir_node *shrs = new_rd_Shrs(dbgi, block, left_highu, subs_res,
umode);
ir_node *shrs = new_rd_Shrs(dbgi, block, left_highu, subs_res);
ir_node *orpl = new_bd_arm_OrPl_t(dbgi, block, or, shrs, or,
subs_flags, umode);
ir_node *shrs2 = new_rd_Shrs(dbgi, block, left_high, right_low, mode);
ir_node *shrs2 = new_rd_Shrs(dbgi, block, left_high, right_low);
ir_set_dw_lowered(node, orpl, shrs2);
}
......
......@@ -399,13 +399,13 @@ static ir_node *build_graph(mul_env *env, instruction *inst)
ir_node *l = build_graph(env, inst->in[0]);
ir_node *r = build_graph(env, inst->in[1]);
ir_node *c = new_r_Const_long(irg, env->shf_mode, inst->shift_count);
ir_node *s = new_rd_Shl(env->dbg, env->blk, r, c, env->mode);
ir_node *s = new_rd_Shl(env->dbg, env->blk, r, c);
return inst->irn = new_rd_Add(env->dbg, env->blk, l, s, env->mode);
}
case SHIFT: {
ir_node *l = build_graph(env, inst->in[0]);
ir_node *c = new_r_Const_long(irg, env->shf_mode, inst->shift_count);
return inst->irn = new_rd_Shl(env->dbg, env->blk, l, c, env->mode);
return inst->irn = new_rd_Shl(env->dbg, env->blk, l, c);
}
case SUB: {
ir_node *l = build_graph(env, inst->in[0]);
......@@ -843,12 +843,12 @@ static ir_node *replace_div_by_mulh(ir_node *div, ir_tarval *tv)
/* Do we need the shift */
if (mag.s > 0) {
c = new_r_Const_long(irg, mode_Iu, mag.s);
q = new_rd_Shrs(dbg, block, q, c, mode);
q = new_rd_Shrs(dbg, block, q, c);
}
/* final */
ir_node *c2 = new_r_Const_long(irg, mode_Iu, bits - 1);
ir_node *t = new_rd_Shr(dbg, block, q, c2, mode);
ir_node *t = new_rd_Shr(dbg, block, q, c2);
res = new_rd_Add(dbg, block, q, t, mode);
} else {
struct magicu_info mafo = get_magic_info(tv);
......@@ -856,7 +856,7 @@ static ir_node *replace_div_by_mulh(ir_node *div, ir_tarval *tv)
if (mafo.pre_shift > 0) {
ir_node *c = new_r_Const_long(irg, mode_Iu, mafo.pre_shift);
n = new_rd_Shr(dbg, block, n, c, mode);
n = new_rd_Shr(dbg, block, n, c);
}
if (mafo.increment) {
......@@ -873,10 +873,10 @@ static ir_node *replace_div_by_mulh(ir_node *div, ir_tarval *tv)
ir_node *c = new_r_Const(irg, mafo.multiplier);
ir_node *q = new_rd_Mulh(dbg, block, n, c);
c = new_r_Const_long(irg, mode_Iu, get_mode_size_bits(get_tarval_mode(tv)));
res = new_rd_Shr(dbg, block, q, c, mode);
res = new_rd_Shr(dbg, block, q, c);
if (mafo.post_shift > 0) {
c = new_r_Const_long(irg, mode_Iu, mafo.post_shift);
res = new_rd_Shr(dbg, block, res, c, mode);
res = new_rd_Shr(dbg, block, res, c);
}
}
return res;
......@@ -936,11 +936,11 @@ ir_node *arch_dep_replace_div_by_const(ir_node *irn)
if (!get_Div_no_remainder(irn)) {
if (k != 1) {
ir_node *k_node = new_r_Const_long(irg, mode_Iu, k - 1);
curr = new_rd_Shrs(dbg, block, left, k_node, mode);
curr = new_rd_Shrs(dbg, block, left, k_node);
}
ir_node *k_node = new_r_Const_long(irg, mode_Iu, bits - k);
curr = new_rd_Shr(dbg, block, curr, k_node, mode);
curr = new_rd_Shr(dbg, block, curr, k_node);
/* curr is now 2^(k-1) in case left < 0
* or 0 in case left >= 0
*
......@@ -953,7 +953,7 @@ ir_node *arch_dep_replace_div_by_const(ir_node *irn)
}
ir_node *k_node = new_r_Const_long(irg, mode_Iu, k);
res = new_rd_Shrs(dbg, block, curr, k_node, mode);
res = new_rd_Shrs(dbg, block, curr, k_node);
if (n_flag) { /* negate the result */
ir_node *k_node = new_r_Const_null(irg, mode);
......@@ -961,7 +961,7 @@ ir_node *arch_dep_replace_div_by_const(ir_node *irn)
}
} else { /* unsigned case */
ir_node *k_node = new_r_Const_long(irg, mode_Iu, k);
res = new_rd_Shr(dbg, block, left, k_node, mode);
res = new_rd_Shr(dbg, block, left, k_node);
}
} else if (k != 0) {
/* other constant */
......@@ -1026,11 +1026,11 @@ ir_node *arch_dep_replace_mod_by_const(ir_node *irn)
ir_node *curr = left;
if (k != 1) {
ir_node *c = new_r_Const_long(irg, mode_Iu, k - 1);
curr = new_rd_Shrs(dbg, block, left, c, mode);
curr = new_rd_Shrs(dbg, block, left, c);
}
ir_node *k_node = new_r_Const_long(irg, mode_Iu, bits - k);
curr = new_rd_Shr(dbg, block, curr, k_node, mode);
curr = new_rd_Shr(dbg, block, curr, k_node);
curr = new_rd_Add(dbg, block, left, curr, mode);
ir_tarval *k_val
......
......@@ -760,8 +760,7 @@ void set_dw_control_flow_changed(void)
}
typedef ir_node* (*new_rd_shr_func)(dbg_info *dbgi, ir_node *block,
ir_node *left, ir_node *right,
ir_mode *mode);
ir_node *left, ir_node *right);
static void lower_shr_helper(ir_node *node, ir_mode *mode,
new_rd_shr_func new_rd_shrs)
......@@ -826,31 +825,26 @@ static void lower_shr_helper(ir_node *node, ir_mode *mode,
*/
ir_node *true_in[1] = { proj_true };
ir_node *block_true = new_r_Block(irg, ARRAY_SIZE(true_in), true_in);
ir_node *tres_high = new_rd_shrs(dbgi, block_true, left_high,
right, mode);
ir_node *shift_low = new_rd_Shr(dbgi, block_true, left_low, right,
low_unsigned);
ir_node *tres_high = new_rd_shrs(dbgi, block_true, left_high, right);
ir_node *shift_low = new_rd_Shr(dbgi, block_true, left_low, right);
ir_node *not_shiftval = new_rd_Not(dbgi, block_true, right);
ir_node *tconv = create_conv(block_true, left_high,
low_unsigned);
ir_node *one = new_r_Const_one(irg, low_unsigned);
ir_node *carry0 = new_rd_Shl(dbgi, block_true, tconv, one,
low_unsigned);
ir_node *carry1 = new_rd_Shl(dbgi, block_true, carry0,
not_shiftval, low_unsigned);
ir_node *carry0 = new_rd_Shl(dbgi, block_true, tconv, one);
ir_node *carry1 = new_rd_Shl(dbgi, block_true, carry0, not_shiftval);
ir_node *tres_low = new_rd_Or(dbgi, block_true, shift_low, carry1);
/* false block => shift_width > 1word */
ir_node *false_in[1] = { proj_false };
ir_node *block_false = new_r_Block(irg, ARRAY_SIZE(false_in), false_in);
ir_node *fconv = create_conv(block_false, left_high, low_unsigned);
ir_node *fres_low = new_rd_shrs(dbgi, block_false, fconv, right,
low_unsigned);
ir_node *fres_low = new_rd_shrs(dbgi, block_false, fconv, right);
int cnsti = modulo_shift2 - 1;
ir_node *cnst3 = new_r_Const_long(irg, low_unsigned, cnsti);
ir_node *fres_high;
if (new_rd_shrs == new_rd_Shrs) {
fres_high = new_rd_shrs(dbgi, block_false, left_high, cnst3, mode);
fres_high = new_rd_shrs(dbgi, block_false, left_high, cnst3);
} else {
fres_high = new_r_Const_null(irg, mode);
}
......@@ -934,16 +928,13 @@ static void lower_Shl(ir_node *node, ir_mode *mode)
ir_node *tin[] = { proj_true };
ir_node *block_true = new_r_Block(irg, ARRAY_SIZE(tin), tin);
ir_node *tres_low = new_rd_Shl(dbgi, block_true, left_low,
right, low_unsigned);
ir_node *shift_high = new_rd_Shl(dbgi, block_true, left_high, right,
mode);
ir_node *tres_low = new_rd_Shl(dbgi, block_true, left_low, right);
ir_node *shift_high = new_rd_Shl(dbgi, block_true, left_high, right);
ir_node *not_shiftval = new_rd_Not(dbgi, block_true, right);
ir_node *conv = create_conv(block_true, left_low, mode);
ir_node *one = new_r_Const_one(irg, low_unsigned);
ir_node *carry0 = new_rd_Shr(dbgi, block_true, conv, one, mode);
ir_node *carry1 = new_rd_Shr(dbgi, block_true, carry0,
not_shiftval, mode);
ir_node *carry0 = new_rd_Shr(dbgi, block_true, conv, one);
ir_node *carry1 = new_rd_Shr(dbgi, block_true, carry0, not_shiftval);
ir_node *tres_high = new_rd_Or(dbgi, block_true, shift_high, carry1);
/* false block => shift_width > 1word */
......@@ -951,7 +942,7 @@ static void lower_Shl(ir_node *node, ir_mode *mode)
ir_node *block_false = new_r_Block(irg, ARRAY_SIZE(fin), fin);
ir_node *fres_low = new_r_Const_null(irg, low_unsigned);
ir_node *fconv = create_conv(block_false, left_low, mode);
ir_node *fres_high = new_rd_Shl(dbgi, block_false, fconv, right, mode);
ir_node *fres_high = new_rd_Shl(dbgi, block_false, fconv, right);
/* patch lower block */
ir_node *lower_in[] = { new_r_Jmp(block_true), new_r_Jmp(block_false) };
......@@ -1271,7 +1262,7 @@ static void lower_Conv_to_Ll(ir_node *node)
ir_node *cnst = new_r_Const_long(irg, low_unsigned, c);
if (get_irn_mode(op) != low_signed)
op = new_rd_Conv(dbg, block, op, low_signed);
res_high = new_rd_Shrs(dbg, block, op, cnst, low_signed);
res_high = new_rd_Shrs(dbg, block, op, cnst);
} else {
res_high = new_r_Const_null(irg, low_signed);
}
......
......@@ -2489,10 +2489,10 @@ static ir_node *transform_node_bitop_shift(ir_node *n)
}
if (is_Shl(left)) {
new_shift = new_rd_Shl(dbg_shift, block, new_bitop, shift_right, mode);
new_shift = new_rd_Shl(dbg_shift, block, new_bitop, shift_right);
} else {
assert(is_Shr(left));
new_shift = new_rd_Shr(dbg_shift, block, new_bitop, shift_right, mode);
new_shift = new_rd_Shr(dbg_shift, block, new_bitop, shift_right);
}
return new_shift;
......@@ -2677,7 +2677,7 @@ static ir_node *transform_node_Or_(ir_node *n)
ir_node *const aa = get_Shrs_left(a);
dbg_info *const shrs_dbgi = get_irn_dbg_info(a);
ir_node *const shrs_block = get_nodes_block(a);
ir_node *const shr = new_rd_Shr(shrs_dbgi, shrs_block, aa, ab, mode);
ir_node *const shr = new_rd_Shr(shrs_dbgi, shrs_block, aa, ab);
dbg_info *const dbgi = get_irn_dbg_info(n);
ir_node *const block = get_nodes_block(n);
return new_rd_Or(dbgi, block, shr, b);
......@@ -3078,7 +3078,7 @@ static ir_node *transform_node_Add(ir_node *n)
} else if (get_mode_arithmetic(mode) == irma_twos_complement) {
/* a + a -> a << 1 */
ir_node *const one = new_r_Const_one(irg, mode_Iu);
n = new_rd_Shl(dbgi, block, a, one, mode);
n = new_rd_Shl(dbgi, block, a, one);
return n;
}
}
......@@ -3663,7 +3663,7 @@ static ir_node *can_negate_cheaply(dbg_info *const dbgi, ir_node *const node)
&& get_tarval_long(tv) == (int)get_mode_size_bits(mode)-1) {
ir_node *left = get_Shr_left(node);
ir_node *block = get_nodes_block(node);
return new_rd_Shrs(dbgi, block, left, right, mode);
return new_rd_Shrs(dbgi, block, left, right);
}
}
} else if (is_Shrs(node)) {
......@@ -3675,7 +3675,7 @@ static ir_node *can_negate_cheaply(dbg_info *const dbgi, ir_node *const node)
&& get_tarval_long(tv) == (int)get_mode_size_bits(mode)-1) {
ir_node *left = get_Shrs_left(node);
ir_node *block = get_nodes_block(node);
return new_rd_Shr(dbgi, block, left, right, mode);
return new_rd_Shr(dbgi, block, left, right);
}
}
}
......@@ -3788,7 +3788,7 @@ static ir_node *transform_node_Mul(ir_node *n)
dbg_info *const dbgi = get_irn_dbg_info(n);
ir_node *const block = get_nodes_block(n);
ir_node *const shl_r = get_Shl_right(a);
n = new_rd_Shl(dbgi, block, b, shl_r, mode);
n = new_rd_Shl(dbgi, block, b, shl_r);
return n;
}
} else if (is_Shl(b)) {
......@@ -3798,7 +3798,7 @@ static ir_node *transform_node_Mul(ir_node *n)
dbg_info *const dbgi = get_irn_dbg_info(n);
ir_node *const block = get_nodes_block(n);
ir_node *const shl_r = get_Shl_right(b);
n = new_rd_Shl(dbgi, block, a, shl_r, mode);
n = new_rd_Shl(dbgi, block, a, shl_r);
return n;
}
}
......@@ -4256,14 +4256,14 @@ static ir_node *transform_node_shift_bitop(ir_node *n)
ir_tarval *shl_like = is_shl_const_like(n);
if (shl_like != NULL) {
tv2 = shl_like;
new_shift = new_rd_Shl(dbgi, block, bitop_left, right, mode);
new_shift = new_rd_Shl(dbgi, block, bitop_left, right);
tv_shift = tarval_shl(tv1, tv2);
} else if (is_Shr(n)) {
new_shift = new_rd_Shr(dbgi, block, bitop_left, right, mode);
new_shift = new_rd_Shr(dbgi, block, bitop_left, right);
tv_shift = tarval_shr(tv1, tv2);
} else {
assert(is_Shrs(n));
new_shift = new_rd_Shrs(dbgi, block, bitop_left, right, mode);
new_shift = new_rd_Shrs(dbgi, block, bitop_left, right);
tv_shift = tarval_shrs(tv1, tv2);
}
......@@ -4499,7 +4499,7 @@ absorb:;
ir_node *const aa = get_Shrs_left(a);
dbg_info *const shrs_dbgi = get_irn_dbg_info(a);
ir_node *const shrs_block = get_nodes_block(a);
ir_node *const shr = new_rd_Shr(shrs_dbgi, shrs_block, aa, ab, mode);
ir_node *const shr = new_rd_Shr(shrs_dbgi, shrs_block, aa, ab);
dbg_info *const dbgi = get_irn_dbg_info(n);
ir_node *const block = get_nodes_block(n);
return new_rd_And(dbgi, block, shr, b);
......@@ -4736,7 +4736,7 @@ static ir_node *transform_node_Minus(ir_node *n)
/* -((a - b) << c) -> (b - a) << c */
ir_node *block = get_nodes_block(n);
ir_node *r = get_Shl_right(op);
return new_rd_Shl(dbgi, block, negated_l, r, mode);
return new_rd_Shl(dbgi, block, negated_l, r);
}
}
}
......@@ -5925,7 +5925,7 @@ static ir_node *transform_node_shift(ir_node *n)
dbg_info *dbgi = get_irn_dbg_info(n);
ir_mode *smode = get_irn_mode(right);
ir_node *cnst = new_r_Const_long(irg, smode, get_mode_size_bits(mode) - 1);
return new_rd_Shrs(dbgi, block, get_binop_left(left), cnst, mode);
return new_rd_Shrs(dbgi, block, get_binop_left(left), cnst);
}
return new_r_Const_null(irg, mode);
......@@ -6014,15 +6014,15 @@ static ir_node *transform_node_shl_shr(ir_node *n)
ir_tarval *tv_shift = tarval_sub(tv_shr, tv_shl);
ir_node *new_const = new_r_Const(irg, tv_shift);
if (need_shrs) {
new_shift = new_rd_Shrs(dbgi, block, x, new_const, mode);
new_shift = new_rd_Shrs(dbgi, block, x, new_const);
} else {
new_shift = new_rd_Shr(dbgi, block, x, new_const, mode);
new_shift = new_rd_Shr(dbgi, block, x, new_const);
}
} else {
assert(relation == ir_relation_greater);
ir_tarval *tv_shift = tarval_sub(tv_shl, tv_shr);
ir_node *new_const = new_r_Const(irg, tv_shift);
new_shift = new_rd_Shl(dbgi, block, x, new_const, mode);
new_shift = new_rd_Shl(dbgi, block, x, new_const);
}
ir_node *new_const = new_r_Const(irg, tv_mask);
......@@ -6038,8 +6038,7 @@ static ir_tarval *get_modulo_tv_value(ir_tarval *tv, int modulo_val)
return tarval_mod(tv, modulo_tv);
}
typedef ir_node*(*new_shift_func)(dbg_info *dbgi, ir_node *block,
ir_node *left, ir_node *right, ir_mode *mode);
typedef ir_node*(*new_shift_func)(dbg_info *dbgi, ir_node *block, ir_node *left, ir_node *right);
/**
* Normalization: if we have a shl/shr with modulo_shift behavior
......@@ -6104,7 +6103,7 @@ static ir_node *transform_node_shift_modulo(ir_node *n,
if (newop != NULL) {
dbg_info *dbgi = get_irn_dbg_info(n);
ir_node *left = get_binop_left(n);
return new_shift(dbgi, block, left, newop, mode);
return new_shift(dbgi, block, left, newop);
}
return n;
}
......@@ -6156,7 +6155,7 @@ static ir_node *transform_node_shift_and(ir_node *n, new_shift_func new_shift)
dbg_info *dbgi = get_irn_dbg_info(n);
ir_node *block = get_nodes_block(n);
ir_node *left = get_binop_left(n);
return new_shift(dbgi, block, left, new_amount, mode);
return new_shift(dbgi, block, left, new_amount);
}
/**
......@@ -6202,7 +6201,7 @@ static ir_node *transform_node_Shrs(ir_node *n)
long val = get_mode_size_bits(cmode)-1;
ir_graph *irg = get_irn_irg(n);
ir_node *cnst = new_r_Const_long(irg, cmode, val);
return new_rd_Shrs(dbgi, block, a, cnst, mode);
return new_rd_Shrs(dbgi, block, a, cnst);
}
ir_node *c;
......@@ -6229,7 +6228,7 @@ static ir_node *transform_node_Shrs(ir_node *n)
if (tarval_get_bit(bn->z, mode_bits - 1) == 0) {
dbg_info *const dbgi = get_irn_dbg_info(n);
ir_node *const block = get_nodes_block(n);
n = new_rd_Shr(dbgi, block, a, b, mode);
n = new_rd_Shr(dbgi, block, a, b);
return n;
}
}
......@@ -6725,7 +6724,7 @@ static ir_node *transform_Mux_set(ir_node *n, ir_relation relation)
ir_node *eor = new_rd_Eor(dbgi, block, left, right);
unsigned shift_amount = MAX(left_low_bit, right_low_bit);
ir_node *shift_cnt = new_rd_Const_long(dbgi, irg, mode_Iu, shift_amount);
ir_node *shift = new_rd_Shr(dbgi, block, eor, shift_cnt, mode);
ir_node *shift = new_rd_Shr(dbgi, block, eor, shift_cnt);
if (mode != dest_mode)
shift = new_rd_Conv(dbgi, block, shift, dest_mode);
......@@ -6756,7 +6755,7 @@ static ir_node *transform_Mux_set(ir_node *n, ir_relation relation)
ir_graph *irg = get_irn_irg(block);
unsigned shift_amount = get_tarval_highest_bit(tv);
ir_node *shift_cnt = new_rd_Const_long(dbgi, irg, mode_Iu, shift_amount);
ir_node *shift = new_rd_Shr(dbgi, block, a, shift_cnt, calc_mode);
ir_node *shift = new_rd_Shr(dbgi, block, a, shift_cnt);
ir_node *c = new_rd_Const_one(dbgi, irg, calc_mode);
ir_node *and = new_rd_And(dbgi, block, shift, c);
if (calc_mode != dest_mode)
......@@ -6818,7 +6817,7 @@ static ir_node *transform_Mux_set(ir_node *n, ir_relation relation)
ir_graph *irg = get_irn_irg(block);
unsigned bits = get_mode_size_bits(calc_mode);
ir_node *shift_cnt = new_rd_Const_long(dbgi, irg, mode_Iu, bits - 1);
ir_node *shift = new_rd_Shr(dbgi, block, sub, shift_cnt, calc_mode);
ir_node *shift = new_rd_Shr(dbgi, block, sub, shift_cnt);
if (calc_mode != dest_mode)
shift = new_rd_Conv(dbgi, block, shift, dest_mode);
......@@ -6846,7 +6845,7 @@ static ir_node *transform_node_Mux(ir_node *n)
ir_node *op = ir_get_abs_op(sel, f, t);
unsigned bits = get_mode_size_bits(mode);
ir_node *shiftconst = new_r_Const_long(irg, mode_Iu, bits-1);
ir_node *sext = new_rd_Shrs(dbgi, block, op, shiftconst, mode);
ir_node *sext = new_rd_Shrs(dbgi, block, op, shiftconst);
ir_node *xorn = new_rd_Eor(dbgi, block, op, sext);
ir_node *res;
if (abs > 0) {
......@@ -6900,7 +6899,7 @@ static ir_node *transform_node_Mux(ir_node *n)
unsigned bits = get_mode_size_bits(cmp_mode);
ir_node *c = new_rd_Const_long(dbgi, irg, mode_Iu, bits - 1U);
ir_node *shrs = new_rd_Shrs(dbgi, block, cmp_l, c, cmp_mode);
ir_node *shrs = new_rd_Shrs(dbgi, block, cmp_l, c);
if (cmp_mode != mode)
shrs = new_rd_Conv(dbgi, block, shrs, mode);
......
......@@ -419,14 +419,13 @@ static ir_node *transform_previous_value(ir_mode *const load_mode,
: delta;
ir_node *new_value = prev_value;
if (shift != 0) {
ir_mode *new_mode = prev_mode;
if (mode_is_reference(new_mode)) {
new_mode = get_reference_offset_mode(new_mode);
if (mode_is_reference(prev_mode)) {
ir_mode *const new_mode = get_reference_offset_mode(prev_mode);
new_value = new_r_Conv(block, new_value, new_mode);
}
ir_graph *const irg = get_irn_irg(block);
ir_node *const cnst = new_r_Const_long(irg, mode_Iu, shift * 8);
new_value = new_r_Shr(block, new_value, cnst, new_mode);
new_value = new_r_Shr(block, new_value, cnst);
}
return new_r_Conv(block, new_value, load_mode);
......@@ -2209,7 +2208,7 @@ again:;
ir_node *convu1 = new_r_Conv(block, store_val1, mode_unsigned);
ir_node *conv1 = new_r_Conv(block, convu1, double_mode);
ir_node *cnst = new_r_Const_long(irg, mode_Iu, store_size);
ir_node *shl = new_r_Shl(block, conv1, cnst, double_mode);
ir_node *shl = new_r_Shl(block, conv1, cnst);
ir_node *or = new_r_Or(block, conv0, shl);
/* create a new store and replace the two small stores */
......
......@@ -441,7 +441,7 @@ transform:;
if (op == op_Mul)
irn = new_rd_Mul(dbg, blk, irn, x);
else
irn = new_rd_Shl(dbg, blk, irn, x, mode);
irn = new_rd_Shl(dbg, blk, irn, x);
exchange(n, irn);
*node = irn;
......
......@@ -753,6 +753,7 @@ class Shl(Binop):
The right input (shift amount) must be an unsigned integer value.
If the result mode has modulo_shift!=0, then the effective shift amount is
the right input modulo this modulo_shift amount."""
mode = "get_irn_mode(irn_left)"
flags = []
@op
......@@ -762,6 +763,7 @@ class Shr(Binop):
The right input (shift amount) must be an unsigned integer value.
If the result mode has modulo_shift!=0, then the effective shift amount is
the right input modulo this modulo_shift amount."""
mode = "get_irn_mode(irn_left)"
flags = []
@op
......@@ -772,6 +774,7 @@ class Shrs(Binop):
The right input (shift amount) must be an unsigned integer value.
If the result mode has modulo_shift!=0, then the effective shift amount is
the right input modulo this modulo_shift amount."""
mode = "get_irn_mode(irn_left)"
flags = []
@op
......
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