Commit 34e6bfb6 authored by Michael Beck's avatar Michael Beck
Browse files

- added stronger checks for Mul

- added verifier for Mulh

[r15753]
parent 544b8de7
...@@ -1268,18 +1268,39 @@ static int verify_node_Mul(ir_node *n, ir_graph *irg) { ...@@ -1268,18 +1268,39 @@ static int verify_node_Mul(ir_node *n, ir_graph *irg) {
ASSERT_AND_RET_DBG( ASSERT_AND_RET_DBG(
( (
/* Mul: BB x int1 x int1 --> int2 */ /* Mul: BB x int_n x int_n --> int_n|int_2n */
(mode_is_int(op1mode) && op2mode == op1mode && mode_is_int(mymode)) || (mode_is_int(op1mode) && op2mode == op1mode && mode_is_int(mymode) &&
(op1mode == mymode || get_mode_size_bits(op1mode) * 2 == get_mode_size_bits(mymode))) ||
/* Mul: BB x float x float --> float */ /* Mul: BB x float x float --> float */
(mode_is_float(op1mode) && op2mode == op1mode && mymode == op1mode) (mode_is_float(op1mode) && op2mode == op1mode && mymode == op1mode)
), ),
"Mul node",0, "Mul node",0,
show_binop_failure(n, "/* Mul: BB x int1 x int1 --> int2 */ |\n" show_binop_failure(n, "/* Mul: BB x int_n x int_n --> int_n|int_2n */ |\n"
"/* Mul: BB x float x float --> float */"); "/* Mul: BB x float x float --> float */");
); );
return 1; return 1;
} }
/**
* verify a Mulh node
*/
static int verify_node_Mulh(ir_node *n, ir_graph *irg) {
ir_mode *mymode = get_irn_mode(n);
ir_mode *op1mode = get_irn_mode(get_Mulh_left(n));
ir_mode *op2mode = get_irn_mode(get_Mulh_right(n));
(void) irg;
ASSERT_AND_RET_DBG(
(
/* Mulh: BB x int x int --> int */
(mode_is_int(op1mode) && op2mode == op1mode && op1mode == mymode)
),
"Mulh node",0,
show_binop_failure(n, "/* Mulh: BB x int x int --> int */");
);
return 1;
}
/** /**
* verify a Quot node * verify a Quot node
*/ */
...@@ -2149,6 +2170,7 @@ void firm_set_default_verifyer(ir_opcode code, ir_op_ops *ops) { ...@@ -2149,6 +2170,7 @@ void firm_set_default_verifyer(ir_opcode code, ir_op_ops *ops) {
CASE(Sub); CASE(Sub);
CASE(Minus); CASE(Minus);
CASE(Mul); CASE(Mul);
CASE(Mulh);
CASE(Quot); CASE(Quot);
CASE(DivMod); CASE(DivMod);
CASE(Div); CASE(Div);
......
Supports Markdown
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