From patchwork Fri Feb 26 15:58:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Jambor X-Patchwork-Id: 589157 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id D9FDE1402D6 for ; Sat, 27 Feb 2016 02:58:20 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=hXF2LFth; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=uTNt6AZ3Zbf9OJOXsadfrZKkwtlAkFScxarqdO63Bs86QgOAP1F4M 5Dr5T8zHdVGKC1Qkx4Hx5pNu/O6R+JQ++AWBR6dHmT/u0kNAfsxai7Qkv8oc61/N va6aLQQ/ka7H47h4FraH9vrb+6PXA1P5SEr+a+GRWQyQbYnLPkklIg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=g4kzRHefEA4uRgc/R8PBvhk9yLU=; b=hXF2LFthQs+AuG8tU++j m8Hs2cxd3YOPgFPkOJ/aUtb5ybak0Ay2VPVL0JysGFt+mq2/j3p5R9uTo1UNVo2h SysD50VXFzCbeQn3DHvzKTU6F9BuwQ5FYlzrQLuyoXlpWWSJzoLT1FspqUlrcxej FO2/LsH63sJwl9tmx9QZ7mU= Received: (qmail 119453 invoked by alias); 26 Feb 2016 15:58:06 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 119360 invoked by uid 89); 26 Feb 2016 15:58:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=20160218, 2016-02-18, 5329, 7, 53297 X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Fri, 26 Feb 2016 15:58:04 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id C46EDACDF for ; Fri, 26 Feb 2016 15:58:00 +0000 (UTC) Date: Fri, 26 Feb 2016 16:58:00 +0100 From: Martin Jambor To: GCC Patches Subject: [hsa/69674] Make testsuite libgomp.c/for-3.c compile with -m32 Message-ID: <20160226155800.GE3094@virgil.suse.cz> Mail-Followup-To: GCC Patches MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes Hi, the following wrong decision about HSA pointer type leads to hitting an assert later in the out-of-ssa phase for 32bit targets. I have not attempted to test HSA on a 32bit i686 yet, I believe there is no functional runtime (although it should be possible to come up with one) and we do not build libgomp plugin for it, but we should not ICE and the new code below is the correct way of doing things anyway. So I will commit it shortly, it has been included in a bootstrap/testsuite run. Thanks, Martin 2016-02-18 Martin Jambor pr hsa/69674 * hsa-gen.c (gen_hsa_phi_from_gimple_phi): Use proper hsa type for pointers. (gen_hsa_addr): Allow integer constants in TMR_INDEX2. --- gcc/hsa-gen.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/gcc/hsa-gen.c b/gcc/hsa-gen.c index a7dc220..a295fda 100644 --- a/gcc/hsa-gen.c +++ b/gcc/hsa-gen.c @@ -2105,9 +2105,17 @@ gen_hsa_addr (tree ref, hsa_bb *hbb, HOST_WIDE_INT *output_bitsize = NULL, } if (TMR_INDEX2 (ref)) { - hsa_op_base *disp2 = hsa_cfun->reg_for_gimple_ssa - (TMR_INDEX2 (ref))->get_in_type (addrtype, hbb); - reg = add_addr_regs_if_needed (reg, as_a (disp2), hbb); + if (TREE_CODE (TMR_INDEX2 (ref)) == SSA_NAME) + { + hsa_op_base *disp2 = hsa_cfun->reg_for_gimple_ssa + (TMR_INDEX2 (ref))->get_in_type (addrtype, hbb); + reg = add_addr_regs_if_needed (reg, as_a (disp2), + hbb); + } + else if (TREE_CODE (TMR_INDEX2 (ref)) == INTEGER_CST) + offset += wi::to_offset (TMR_INDEX2 (ref)); + else + gcc_unreachable (); } offset += wi::to_offset (TMR_OFFSET (ref)); break; @@ -5329,7 +5337,8 @@ gen_hsa_phi_from_gimple_phi (gimple *phi_stmt, hsa_bb *hbb) hsa_op_address *addr = gen_hsa_addr (TREE_OPERAND (op, 0), hbb_src); - hsa_op_reg *dest = new hsa_op_reg (BRIG_TYPE_U64); + hsa_op_reg *dest + = new hsa_op_reg (hsa_get_segment_addr_type (BRIG_SEGMENT_FLAT)); hsa_insn_basic *insn = new hsa_insn_basic (2, BRIG_OPCODE_LDA, BRIG_TYPE_U64, dest, addr);