From patchwork Thu Dec 18 13:15:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 422568 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 DE892140082 for ; Fri, 19 Dec 2014 00:15:34 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; q=dns; s=default; b=GSjBlG3UIase48ib fa3vrE1n9yhJ0+v/IXVGeJjDaVE6Hmsm4N74wFoY5wGUyTzLQF/H2ycxjMCOrEz7 /je5crPftX3M3Y1VzmTPBPghQf/VPhLdQBdIp96YpQB+syoS9cFacwM87Yb41oL8 wHDWXcSalYW5AndcrCg/q9mC380= 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:from :to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; s=default; bh=5+uHG8ANvkYmN0V7Fthwz4 yvs2E=; b=IReeu2nF4QClqZHH6s1vOAH17HUqc2/IGJeCzgS1r+NnUKjuzlbtHL /6DHzglXFjMPvrdkkEp1j9hSMvEbFTbTJAeUz7D68KbC62saryVJynfc+g3tKlGD wBwYG2q55l5mdR2aDfPYbjOMCawVVxQWfZy+83aM8tmA69SKZK4Yo= Received: (qmail 28922 invoked by alias); 18 Dec 2014 13:15:27 -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 28906 invoked by uid 89); 18 Dec 2014 13:15:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 18 Dec 2014 13:15:25 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-02.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1Y1avJ-0002HJ-1S from Thomas_Schwinge@mentor.com ; Thu, 18 Dec 2014 05:15:21 -0800 Received: from feldtkeller.schwinge.homeip.net (137.202.0.76) by SVR-IES-FEM-02.mgc.mentorg.com (137.202.0.106) with Microsoft SMTP Server id 14.3.181.6; Thu, 18 Dec 2014 13:15:19 +0000 From: Thomas Schwinge To: Jakub Jelinek CC: Subject: Re: OpenACC middle end changes In-Reply-To: <20141218113311.GD1667@tucnak.redhat.com> References: <87fvdnnijk.fsf@schwinge.name> <20141113180949.GX5026@tucnak.redhat.com> <87tx0ts0bb.fsf@schwinge.name> <20141218113311.GD1667@tucnak.redhat.com> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-pc-linux-gnu) Date: Thu, 18 Dec 2014 14:15:10 +0100 Message-ID: <87k31prtep.fsf@schwinge.name> MIME-Version: 1.0 Hi Jakub! On Thu, 18 Dec 2014 12:33:11 +0100, Jakub Jelinek wrote: > On Thu, Dec 18, 2014 at 11:46:00AM +0100, Thomas Schwinge wrote: > > > just > > > rtx v1 = GEN_INT (...); > > > rtx v2 = GEN_INT (...); > > > machine_mode mode = TYPE_MODE (TREE_TYPE (arg)); > > > rtx ret = gen_reg_rtx (TYPE_MODE (integer_type_node)); > > > emit_move_insn (ret, const0_rtx); > > > rtx_code_label *done_label = gen_label_rtx (); > > > emit_cmp_and_jump_insns (op, v1, NE, NULL_RTX, mode, > > > false, done_label, PROB_EVEN); > > > emit_cmp_and_jump_insns (op, v2, NE, NULL_RTX, mode, > > > false, done_label, PROB_EVEN); > > > emit_move_insn (ret, const1_rtx); > > > emit_label (done_label); > > > return ret; > > > or similar. > > > > Thanks for the review/suggestion/code! > > Note, as I found later, emit_cmp_and_jump_insns is good enough only > for certain modes on certain architectures (in particular, for > cases where can_compare_p returns true). > So it is better to use do_compare_rtx_and_jump instead of > emit_cmp_and_jump_insns, because it handles also the cases which > emit_cmp_and_jump_insns silently mishandles. You'll need to reorder > the arguments a little bit and add one NULL_RTX argument. > See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63848#c4 Thanks again; committed to gomp-4_0-branch in r218862: commit a58e1475324e6dd6c34a95883f5efc854e204fde Author: tschwinge Date: Thu Dec 18 13:13:06 2014 +0000 OpenACC acc_on_device: Harden builtin expansion. gcc/ * builtins.c (expand_builtin_acc_on_device): Use do_compare_rtx_and_jump instead of emit_cmp_and_jump_insns. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@218862 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog.gomp | 3 +++ gcc/builtins.c | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) Grüße, Thomas diff --git gcc/ChangeLog.gomp gcc/ChangeLog.gomp index a3650c5..1e6df5f 100644 --- gcc/ChangeLog.gomp +++ gcc/ChangeLog.gomp @@ -1,6 +1,9 @@ 2014-12-18 Thomas Schwinge Jakub Jelinek + * builtins.c (expand_builtin_acc_on_device): Use + do_compare_rtx_and_jump instead of emit_cmp_and_jump_insns. + * builtins.c (expand_builtin_acc_on_device): Make more RTXy. 2014-12-17 Thomas Schwinge diff --git gcc/builtins.c gcc/builtins.c index e946521..33025a5 100644 --- gcc/builtins.c +++ gcc/builtins.c @@ -5911,10 +5911,10 @@ expand_builtin_acc_on_device (tree exp, rtx target) target = gen_reg_rtx (target_mode); emit_move_insn (target, const0_rtx); rtx_code_label *done_label = gen_label_rtx (); - emit_cmp_and_jump_insns (v, v1, NE, NULL_RTX, v_mode, - false, done_label, PROB_EVEN); - emit_cmp_and_jump_insns (v, v2, NE, NULL_RTX, v_mode, - false, done_label, PROB_EVEN); + do_compare_rtx_and_jump (v, v1, NE, false, v_mode, NULL_RTX, + NULL_RTX, done_label, PROB_EVEN); + do_compare_rtx_and_jump (v, v2, NE, false, v_mode, NULL_RTX, + NULL_RTX, done_label, PROB_EVEN); emit_move_insn (target, const1_rtx); emit_label (done_label);