From patchwork Mon Oct 10 15:23:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Jambor X-Patchwork-Id: 680481 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 3st4rK6cYGz9ryk for ; Tue, 11 Oct 2016 03:11:45 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=sEFnqDh7; 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 :resent-from:resent-date:resent-message-id:resent-to:from:date :subject:to:message-id; q=dns; s=default; b=GPP3EG4Pn41fDEuYk2+u jB8ttmqIwSLrMlcGftthkP59BOKnZyqT1N2nvQ+HpPWYfw66aqQQExq8qZ1sPY7z M+8O+orPzPkGZoBASWmas8/vfvsD/a36DUWPiwm28mOaN4p70htH9L3X4ZilUy7Y sJBRTAIJuytCbYJwQcb1PRA= 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 :resent-from:resent-date:resent-message-id:resent-to:from:date :subject:to:message-id; s=default; bh=tQJDeP+RcXfzU01vsly6eetv0y g=; b=sEFnqDh75b+8mJAY5cExRFw+APGMZmkqu3jJHTB6PoILUg2iIqTkyOI6ZK oV8FVlCTbfFQeyM3PR08Gs5JSm+JRznI9vSYSRrua/fVAWi6J17nYBy0YIq/AvhU s+ChAakThfRF1XT/dDFD1T2/OMgyK/tXk1UjFR6AeWAH13s8M= Received: (qmail 88788 invoked by alias); 10 Oct 2016 16:09:40 -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 88475 invoked by uid 89); 10 Oct 2016 16:09:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=BAYES_00, SPF_SOFTFAIL autolearn=no version=3.3.2 spammy=H*MI:eggs, H*M:eggs, gimple_location, encountering X-HELO: eggs.gnu.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (208.118.235.92) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 10 Oct 2016 16:09:23 +0000 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1btd8i-0002Kp-6Q for gcc-patches@gcc.gnu.org; Mon, 10 Oct 2016 12:09:21 -0400 Received: from mx2.suse.de ([195.135.220.15]:45036) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1btd8i-0002KY-0h for gcc-patches@gcc.gnu.org; Mon, 10 Oct 2016 12:09:20 -0400 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 1A61AADC6 for ; Mon, 10 Oct 2016 16:09:17 +0000 (UTC) Resent-From: Martin Jambor Resent-Date: Mon, 10 Oct 2016 18:09:16 +0200 Resent-Message-ID: <20161010160916.3v6cbsthdblemujp@virgil.suse.cz> Resent-To: GCC Patches From: Martin Jambor Date: Mon, 10 Oct 2016 17:23:30 +0200 Subject: [hsa-branch 8/9] Fail instead of calling an unknown GOMP builtin To: GCC Patches X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] Message-ID: X-Received-From: 195.135.220.15 X-IsSubscribed: yes Hi, this patch is a bit of a hack to make sure we do not emit calls to libgomp run-time functions which are not available at the HSA GPU side, such as run-time loop scheduling routines. If we fail at the caller side, we avoid issues with finalizer looking at calls to non-existing functions. Committed to the branch, queued for merge to trunk soon. Thanks, Martin 2016-10-03 Martin Jambor * hsa-gen.c (gen_hsa_insns_for_call): Fail when encountering a GOMP builtin that we cannot process ourselves. --- gcc/hsa-gen.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gcc/hsa-gen.c b/gcc/hsa-gen.c index 8893a28..fd0dbcd 100644 --- a/gcc/hsa-gen.c +++ b/gcc/hsa-gen.c @@ -5972,7 +5972,15 @@ gen_hsa_insns_for_call (gimple *stmt, hsa_bb *hbb) break; default: { - gen_hsa_insns_for_direct_call (stmt, hbb); + tree name_tree = DECL_NAME (fndecl); + const char *s = IDENTIFIER_POINTER (name_tree); + size_t len = strlen (s); + if (len > 4 && (strncmp (s, "__builtin_GOMP_", 15) == 0)) + HSA_SORRY_ATV (gimple_location (stmt), + "support for HSA does not implement GOMP function %s", + s); + else + gen_hsa_insns_for_direct_call (stmt, hbb); return; } }