From patchwork Sat Nov 1 11:57:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schmidt X-Patchwork-Id: 405788 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 1469F14010C for ; Sat, 1 Nov 2014 22:58:21 +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 :message-id:date:from:mime-version:to:cc:subject:content-type; q=dns; s=default; b=dmvmxJqPFi3UJJzKvcG+rA59pImJvh5tX+O0GAYI+Mc K2ZDfONKbNbRZ6nUbFgcNjNu4v5mEQXYZVb0EcAfi4tQ9zHB6LtdWs/U9cWQOnUz l6mdR9QcsHt8dLZgZzi8nL34u7zU1dwm8iBAji3I4BUqJJcSKhAwCLFlkcE9Pj/U = 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 :message-id:date:from:mime-version:to:cc:subject:content-type; s=default; bh=QbCysO88I5o9ZldIwiF50eaUITk=; b=ueFVKRtecIMkhdwax 6fSl1t2xqOnIIQqaWe7sZKxohP3oz8OTNh9X1xHNja91cxO9nWaZnoHw66+FlQYT Ray1XPm1u7kiMUh2CgWGzXTz0UZSggrYbVgT6s9qj73poHPusldfarZX7gav5GKC 0cuO+LJDLZZ+mgGGioV0tR3Fk8= Received: (qmail 24710 invoked by alias); 1 Nov 2014 11:58:14 -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 24699 invoked by uid 89); 1 Nov 2014 11:58:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, FROM_12LTRDOM, RCVD_IN_DNSWL_NONE 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; Sat, 01 Nov 2014 11:58:06 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1XkXJi-0004iK-UZ from Bernd_Schmidt@mentor.com ; Sat, 01 Nov 2014 04:58:03 -0700 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.3.181.6; Sat, 1 Nov 2014 11:58:01 +0000 Message-ID: <5454CAB9.3040907@codesourcery.com> Date: Sat, 1 Nov 2014 12:57:45 +0100 From: Bernd Schmidt User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.8.0 MIME-Version: 1.0 To: GCC Patches CC: Ilya Verbin Subject: nvptx offloading patches [3/n], RFD This is not against current trunk; it applies to gomp-4_0-branch where it is one of the necessary parts to make offloading x86->nvptx work. The issue is that the LTO file format depends on the machine_modes enum, it needs to match between host and offload target. The easiest way to do this is to just use the host-modes.def when compiling an offload compiler. Ports that want to be hosts for offloading may need to modify their modes.def. The patch below contains changes to i386-modes.def which modifies XFmode depending on a target switch. I'm not actually entirely sure what to do about this. Do we want to make this flag an error when offloading is enabled? Or maybe add float format support to the -foffload-abi option? Thoughts? Ok for the first part of the patch once the other offloading patches have gone in (bootstrapped and tested on x86_64-linux)? Bernd * config.gcc (offload_host_cpu_type): Compute. (extra_modes): Use it to pick the offload host CPU's modes.def when building an offload target. * config/i386/i386-modes.def (XF): Skip adjustments when building an offload compiler. Index: gomp-4_0-branch/gcc/config.gcc =================================================================== --- gomp-4_0-branch.orig/gcc/config.gcc +++ gomp-4_0-branch/gcc/config.gcc @@ -483,15 +483,26 @@ tilepro*-*-*) ;; esac +offload_host_cpu_type=${cpu_type} +if test "x${enable_as_accelerator}" != "xno" +then + offload_host_cpu_type=`echo ${enable_as_accelerator_for} | sed 's/-.*$//'` +fi +case ${offload_host_cpu_type} in +x86_64) + offload_host_cpu_type=i386 + ;; +esac + tm_file=${cpu_type}/${cpu_type}.h if test -f ${srcdir}/config/${cpu_type}/${cpu_type}-protos.h then tm_p_file=${cpu_type}/${cpu_type}-protos.h fi extra_modes= -if test -f ${srcdir}/config/${cpu_type}/${cpu_type}-modes.def +if test -f ${srcdir}/config/${offload_host_cpu_type}/${offload_host_cpu_type}-modes.def then - extra_modes=${cpu_type}/${cpu_type}-modes.def + extra_modes=${offload_host_cpu_type}/${offload_host_cpu_type}-modes.def fi if test -f ${srcdir}/config/${cpu_type}/${cpu_type}.opt then Index: gomp-4_0-branch/gcc/config/i386/i386-modes.def =================================================================== --- gomp-4_0-branch.orig/gcc/config/i386/i386-modes.def +++ gomp-4_0-branch/gcc/config/i386/i386-modes.def @@ -24,6 +24,9 @@ along with GCC; see the file COPYING3. FRACTIONAL_FLOAT_MODE (XF, 80, 12, ieee_extended_intel_96_format); FLOAT_MODE (TF, 16, ieee_quad_format); +/* This file may be used when building a compiler for an offload target. + Assume that no special floating point options are used. */ +#ifndef ACCEL_COMPILER /* In ILP32 mode, XFmode has size 12 and alignment 4. In LP64 mode, XFmode has size and alignment 16. */ ADJUST_FLOAT_FORMAT (XF, (TARGET_128BIT_LONG_DOUBLE @@ -33,6 +36,7 @@ ADJUST_FLOAT_FORMAT (XF, (TARGET_128BIT_ : &ieee_extended_intel_96_format)); ADJUST_BYTESIZE (XF, TARGET_128BIT_LONG_DOUBLE ? 16 : 12); ADJUST_ALIGNMENT (XF, TARGET_128BIT_LONG_DOUBLE ? 16 : 4); +#endif /* Add any extra modes needed to represent the condition code.