Commit 4a4b789a authored by Michael Beck's avatar Michael Beck
Browse files

added all constructors for Mulh

[r15754]
parent 34e6bfb6
......@@ -276,6 +276,7 @@
* ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode);
* ir_node *new_Minus (ir_node *op, ir_mode *mode);
* ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode);
* ir_node *new_Mulh (ir_node *op1, ir_node *op2, ir_mode *mode);
* ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
* ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
* ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
......@@ -678,6 +679,11 @@
*
* Trivial.
*
* ir_node *new_Mulh (ir_node *op1, ir_node *op2, ir_mode *mode)
* ------------------------------------------------------------
*
* Returns the high order bits of a n*n=2n multiplication.
*
* ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state)
* -------------------------------------------------------------------------------------------------
*
......@@ -1442,6 +1448,18 @@ ir_node *new_rd_Minus (dbg_info *db, ir_graph *irg, ir_node *block,
ir_node *new_rd_Mul (dbg_info *db, ir_graph *irg, ir_node *block,
ir_node *op1, ir_node *op2, ir_mode *mode);
/** Constructor for a Mulh node.
*
* @param *db A pointer for debug information.
* @param *irg The ir graph the node belongs to.
* @param *block The ir block the node belongs to.
* @param *op1 The first operand.
* @param *op2 The second operand.
* @param *mode The mode of the operands and the result.
*/
ir_node *new_rd_Mulh (dbg_info *db, ir_graph *irg, ir_node *block,
ir_node *op1, ir_node *op2, ir_mode *mode);
/** Constructor for a Quot node.
*
* @param *db A pointer for debug information.
......@@ -2255,6 +2273,7 @@ ir_node *new_r_Sub (ir_graph *irg, ir_node *block,
*/
ir_node *new_r_Minus (ir_graph *irg, ir_node *block,
ir_node *op, ir_mode *mode);
/** Constructor for a Mul node.
*
* @param *irg The ir graph the node belongs to.
......@@ -2266,6 +2285,17 @@ ir_node *new_r_Minus (ir_graph *irg, ir_node *block,
ir_node *new_r_Mul (ir_graph *irg, ir_node *block,
ir_node *op1, ir_node *op2, ir_mode *mode);
/** Constructor for a Mulh node.
*
* @param *irg The ir graph the node belongs to.
* @param *block The ir block the node belongs to.
* @param *op1 The first operand.
* @param *op2 The second operand.
* @param *mode The mode of the operands and the result.
*/
ir_node *new_r_Mulh (ir_graph *irg, ir_node *block,
ir_node *op1, ir_node *op2, ir_mode *mode);
/** Constructor for a Quot node.
*
* @param *irg The ir graph the node belongs to.
......@@ -3069,6 +3099,17 @@ ir_node *new_d_Minus (dbg_info *db, ir_node *op, ir_mode *mode);
*/
ir_node *new_d_Mul (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
/** Constructor for a Mulh node.
*
* Adds the node to the block in current_ir_block.
*
* @param *db A pointer for debug information.
* @param *op1 The first operand.
* @param *op2 The second operand.
* @param *mode The mode of the operands and the result.
*/
ir_node *new_d_Mulh (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
/** Constructor for a Quot node.
*
* Adds the node to the block in current_ir_block.
......@@ -3883,6 +3924,15 @@ ir_node *new_Minus (ir_node *op, ir_mode *mode);
*/
ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode);
/**
* Constructor for a Mulh node. Adds the node to the block in current_ir_block.
*
* @param *op1 The first operand.
* @param *op2 The second operand.
* @param *mode The mode of the operands and the result.
*/
ir_node *new_Mulh (ir_node *op1, ir_node *op2, ir_mode *mode);
/** Constructor for a Quot node.
*
* Adds the node to the block in current_ir_block.
......
......@@ -70,23 +70,6 @@ static const ir_settings_arch_dep_t *params = NULL;
/** The bit mask, which optimizations to apply. */
static arch_dep_opts_t opts;
/**
* construct a Mulh: Mulh(a,b) = (a * b) >> w, w is the with in bits of a, b
*/
static ir_node *
new_rd_Mulh (dbg_info *db, ir_graph *irg, ir_node *block,
ir_node *op1, ir_node *op2, ir_mode *mode) {
ir_node *in[2];
ir_node *res;
in[0] = op1;
in[1] = op2;
res = new_ir_node(db, irg, block, op_Mulh, mode, 2, in);
res = optimize_node(res);
IRN_VRFY_IRG(res, irg);
return res;
}
void arch_dep_init(arch_dep_params_factory_t factory) {
opts = arch_dep_none;
......
......@@ -382,6 +382,7 @@ NEW_BD_BINOP(Add)
NEW_BD_BINOP(Sub)
NEW_BD_UNOP(Minus)
NEW_BD_BINOP(Mul)
NEW_BD_BINOP(Mulh)
NEW_BD_DIVOP(Quot)
NEW_BD_DIVOP(DivMod)
NEW_BD_DIVOP(Div)
......@@ -1024,6 +1025,7 @@ NEW_RD_BINOP(Add)
NEW_RD_BINOP(Sub)
NEW_RD_UNOP(Minus)
NEW_RD_BINOP(Mul)
NEW_RD_BINOP(Mulh)
NEW_RD_DIVOP(Quot)
NEW_RD_DIVOP(DivMod)
NEW_RD_DIVOP(Div)
......@@ -1525,6 +1527,10 @@ ir_node *new_r_Mul(ir_graph *irg, ir_node *block,
ir_node *op1, ir_node *op2, ir_mode *mode) {
return new_rd_Mul(NULL, irg, block, op1, op2, mode);
}
ir_node *new_r_Mulh(ir_graph *irg, ir_node *block,
ir_node *op1, ir_node *op2, ir_mode *mode) {
return new_rd_Mulh(NULL, irg, block, op1, op2, mode);
}
ir_node *new_r_Quot(ir_graph *irg, ir_node *block,
ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state) {
return new_rd_Quot(NULL, irg, block, memop, op1, op2, mode, state);
......@@ -2647,6 +2653,7 @@ NEW_D_BINOP(Add)
NEW_D_BINOP(Sub)
NEW_D_UNOP(Minus)
NEW_D_BINOP(Mul)
NEW_D_BINOP(Mulh)
/**
* Allocate the frag array.
......@@ -3218,6 +3225,9 @@ ir_node *new_Minus(ir_node *op, ir_mode *mode) {
ir_node *new_Mul(ir_node *op1, ir_node *op2, ir_mode *mode) {
return new_d_Mul(NULL, op1, op2, mode);
}
ir_node *new_Mulh(ir_node *op1, ir_node *op2, ir_mode *mode) {
return new_d_Mulh(NULL, op1, op2, mode);
}
ir_node *new_Quot(ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state) {
return new_d_Quot(NULL, memop, op1, op2, mode, state);
}
......
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