Hello. Following patch changes type of an immediate constant in an address calculation to respect an address type.
Martin
>From fcbcf975217d44b0bd4674bda972b0a28b1a6afa Mon Sep 17 00:00:00 2001 From: mliska <mli...@suse.cz> Date: Thu, 10 Sep 2015 10:16:12 +0200 Subject: [PATCH] HSA: fix TARGET_MEM_REF code emission. gcc/ChangeLog: 2015-09-09 Martin Liska <mli...@suse.cz> * hsa-gen.c (gen_hsa_addr): Fix TARGET_MEM_REF emission. --- gcc/hsa-gen.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gcc/hsa-gen.c b/gcc/hsa-gen.c index c51dfc9..0135bfb 100644 --- a/gcc/hsa-gen.c +++ b/gcc/hsa-gen.c @@ -1685,9 +1685,15 @@ gen_hsa_addr (tree ref, hsa_bb *hbb, vec <hsa_op_reg_p> *ssa_map, disp1 = new hsa_op_reg (addrtype); hsa_insn_basic *insn = new hsa_insn_basic (3, BRIG_OPCODE_MUL, addrtype); + + /* As step must respect addrtype, we overwrite the type + of an immediate value. */ + hsa_op_immed *step = new hsa_op_immed (TMR_STEP (ref)); + step->type = addrtype; + insn->set_op (0, disp1); insn->set_op (1, idx); - insn->set_op (2, new hsa_op_immed (TMR_STEP (ref))); + insn->set_op (2, step); hbb->append_insn (insn); } else -- 2.4.6