Hi, the patch below fixes two minor issues with new function gen_hsa_unary_operation and gen_hsa_binary_operation. First, they should add new instructions to use list of pseudoregiters. Second, the type opcode should really be int. (It was BrigType16_t, probably BrigOpcode16_t was intended, but in our own representation, we use negative values for instructions which are not actual HSA instructions, such as PHI nodes). Committed to the HSA branch.
Martin 2015-08-25 Martin Jambor <mjam...@suse.cz> * hsa-gen.c (gen_hsa_unary_operation): Use int for the opcode. Add instruction to uses of register operands. (gen_hsa_binary_operation): Likewise. (gen_hsa_insns_for_operation_assignment): Use int for opcodes passed to gen_hsa_binary_operation. --- gcc/ChangeLog.hsa | 8 ++++++++ gcc/hsa-gen.c | 16 ++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/gcc/hsa-gen.c b/gcc/hsa-gen.c index bdb9cec..14cf890 100644 --- a/gcc/hsa-gen.c +++ b/gcc/hsa-gen.c @@ -2250,7 +2250,7 @@ gen_hsa_cmp_insn_from_gimple (enum tree_code code, tree lhs, tree rhs, as a single operand. */ static void -gen_hsa_unary_operation (BrigType16_t opcode, hsa_op_reg *dest, +gen_hsa_unary_operation (int opcode, hsa_op_reg *dest, hsa_op_base *op1, hsa_bb *hbb) { gcc_checking_assert (dest); @@ -2266,6 +2266,8 @@ gen_hsa_unary_operation (BrigType16_t opcode, hsa_op_reg *dest, } dest->set_definition (insn); + if (hsa_op_reg *reg = dyn_cast <hsa_op_reg *> (op1)) + reg->uses.safe_push (insn); hbb->append_insn (insn); } @@ -2274,7 +2276,7 @@ gen_hsa_unary_operation (BrigType16_t opcode, hsa_op_reg *dest, and OP2. */ static void -gen_hsa_binary_operation (BrigType16_t opcode, hsa_op_reg *dest, +gen_hsa_binary_operation (int opcode, hsa_op_reg *dest, hsa_op_base *op1, hsa_op_base *op2, hsa_bb *hbb) { gcc_checking_assert (dest); @@ -2290,6 +2292,10 @@ gen_hsa_binary_operation (BrigType16_t opcode, hsa_op_reg *dest, hsa_insn_basic *insn = new hsa_insn_basic (3, opcode, dest->type, dest, op1, op2); dest->set_definition (insn); + if (hsa_op_reg *reg = dyn_cast <hsa_op_reg *> (op1)) + reg->uses.safe_push (insn); + if (hsa_op_reg *reg = dyn_cast <hsa_op_reg *> (op2)) + reg->uses.safe_push (insn); hbb->append_insn (insn); } @@ -2387,10 +2393,8 @@ gen_hsa_insns_for_operation_assignment (gimple assign, hsa_bb *hbb, case RROTATE_EXPR: { hsa_insn_basic *insn = NULL; - BrigType16_t code1 = code == LROTATE_EXPR - ? BRIG_OPCODE_SHL : BRIG_OPCODE_SHR; - BrigType16_t code2 = code != LROTATE_EXPR - ? BRIG_OPCODE_SHL : BRIG_OPCODE_SHR; + int code1 = code == LROTATE_EXPR ? BRIG_OPCODE_SHL : BRIG_OPCODE_SHR; + int code2 = code != LROTATE_EXPR ? BRIG_OPCODE_SHL : BRIG_OPCODE_SHR; BrigType16_t btype = hsa_type_for_scalar_tree_type (TREE_TYPE (lhs), true); -- 2.4.6