Commit facad40a authored by Matthias Braun's avatar Matthias Braun
Browse files

tv: Only allow tarval_popcount on twos_complement modes

parent 876e8c6a
......@@ -3682,7 +3682,8 @@ static ir_node *transform_node_Mul(ir_node *n)
dbg_info *dbgi = get_irn_dbg_info(n);
ir_node *block = get_nodes_block(n);
return new_rd_Minus(dbgi, block, a, mode);
} else if (get_tarval_popcount(c1) == 1) {
} else if (arith == irma_twos_complement
&& get_tarval_popcount(c1) == 1) {
/* multiplication behaves Shl-like */
n = transform_node_shl_shr(n);
if (n != oldn)
......
......@@ -1275,9 +1275,7 @@ unsigned char get_tarval_sub_bits(ir_tarval const *tv, unsigned byte_ofs)
int get_tarval_popcount(ir_tarval const *tv)
{
ir_mode *const mode = get_tarval_mode(tv);
if (!mode_is_int(mode))
return -1;
assert(get_mode_arithmetic(mode) == irma_twos_complement);
return sc_popcount(tv->value, get_mode_size_bits(mode));
}
......
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