Commit a12f52db authored by Michael Beck's avatar Michael Beck
Browse files

Improved version of gen_Rotl()

[r20221]
parent f28b13d7
......@@ -650,7 +650,9 @@ static ir_node *gen_Rol(ir_node *node, ir_node *op1, ir_node *op2) {
ir_node *new_op1 = be_transform_node(op1);
ir_mode *mode = mode_Iu;
dbg_info *dbg = get_irn_dbg_info(node);
ir_node *new_op2 = new_rd_arm_Rsb_i(dbg, current_ir_graph, block, op2, mode, 32);
ir_node *new_op2 = be_transform_node(op2);
new_op2 = new_rd_arm_Rsb_i(dbg, current_ir_graph, block, new_op2, mode, 32);
return new_rd_arm_Ror(dbg, current_ir_graph, block, new_op1, new_op2, mode);
}
......@@ -669,20 +671,33 @@ static ir_node *gen_Rotl(ir_node *node) {
that means we can create a RotR. */
if (is_Add(op2)) {
ir_node *add = op2;
ir_node *left = get_Add_left(add);
ir_node *right = get_Add_right(add);
ir_node *right = get_Add_right(op2);
if (is_Const(right)) {
tarval *tv = get_Const_tarval(right);
ir_mode *mode = get_irn_mode(node);
long bits = get_mode_size_bits(mode);
ir_node *left = get_Add_left(op2);
if (is_Minus(left) &&
tarval_is_long(tv) &&
tarval_is_long(tv) &&
get_tarval_long(tv) == bits &&
bits == 32)
rotate = gen_Ror(node, op1, get_Minus_op(left));
}
} else if (is_Sub(op2)) {
ir_node *left = get_Sub_left(op2);
if (is_Const(left)) {
tarval *tv = get_Const_tarval(left);
ir_mode *mode = get_irn_mode(node);
long bits = get_mode_size_bits(mode);
ir_node *right = get_Sub_right(op2);
if (tarval_is_long(tv) &&
get_tarval_long(tv) == bits &&
bits == 32)
rotate = gen_Ror(node, op1, right);
}
}
if (rotate == NULL) {
......
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