From patchwork Fri Jun 9 12:53:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Richard Earnshaw \(lists\)" X-Patchwork-Id: 103502 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp198488qgd; Fri, 9 Jun 2017 06:04:43 -0700 (PDT) X-Received: by 10.84.230.134 with SMTP id e6mr40122524plk.256.1497013483446; Fri, 09 Jun 2017 06:04:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497013483; cv=none; d=google.com; s=arc-20160816; b=QwxP/uYpJN/Vf+aOf20kJMUhWbPnmKKZlGClmYx7ywpFhy9F9/DR+x8HqIWFmYkXCC sA1STFP6VSIo6o4LnvHR6mRa5bgY3seg9ORl6v9i4oZgMcpnhGO2yDISDzTDHdIsSyKp MQDXhXTVIdN1DdGO6mRW1nomBsllaRrFuGwD+k6Oan1Y0rHgFTkt1fj7OuMMiBtXpB+d x2ZEt05dFYvQEJwPcHSZ+5xbeaD2WH6RjQQ1IMonDxzJAEtXlN9yGnypcu3M+UXR1AYH Q2lbZjKUI74yGOWvRnayI5/ou2dwe14rfiKbmepZwG+jNsgcykuacUTRXx2TmBei4NSc 6SUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:references:in-reply-to:references:in-reply-to :message-id:date:subject:cc:to:from:delivered-to:sender:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mailing-list:dkim-signature:domainkey-signature :arc-authentication-results; bh=roN7ZdMOURHvXLOq31xl8WeVGa8FCbLcMe62QcZyRsY=; b=t5/3sGnXv9wXHEEndIDM1fzeBfwZLp1hLR2qzRky5uOCnGzIGQ6n05RpHwS898E7GR 3Br7VGdftT01jmC8VnrLveSCQeCYFG3sfgI5thfPClJxPhkFjgO4LbggCbTOwMkDdJcY dpx4vtjdlpHxmZBas/jaiOngj8mY2q5QnePifSarK85uK8kkrIgrof2Wsh/gl1Mk3xyt utvyXVvivxB1fMZvPtQzh1sTdW0OykHdWi/fTHdso+r0UZ2WO5R6LJxEtiX6Sd4Zqjx7 jJpq+ewROtLL9vy71JtQw3x2bL4Rg/HblGId96srZmTNTZtTXeG3X1aJMtl2iPNRlprm N3ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-455546-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-455546-patch=linaro.org@gcc.gnu.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id x196si7350185pgx.147.2017.06.09.06.04.43 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Jun 2017 06:04:43 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-455546-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-455546-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-455546-patch=linaro.org@gcc.gnu.org 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:date:message-id:in-reply-to:references :in-reply-to:references:mime-version:content-type; q=dns; s= default; b=HsZ6dG5yTMMCR/bfFAp6ClneNUH+uniPT0F1ZzaOuqq54X5U7J2O5 8vNa8OkByUCrJ1dRtRvGsMvsd1SEGCd75TpFFljiqZ1F/SnKRes+kdYYFQIeV8+R s3TrYSWRflcqHxLmtGvxL7jKus5ngtdc71tYNI7DBHmKLtxXIRJp4E= 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:date:message-id:in-reply-to:references :in-reply-to:references:mime-version:content-type; s=default; bh=LSvBLGCKSoHSK5pcrNRNaLutkcU=; b=nfCKx3Dz/T29Usmj8dPUp0HoIxMn GDrMIdwjnDOhAe820RVGmOaOOuOHGg7xnNiF5XHG9RjjSFIw4f3UQCaSjA6xMY+M di6No0Af2mS0GkeaUqjWvgX6vYqH63BavEEMKaHX+i5BVU4KCcXy/RZIyDDl5QQU gCFRc8X/zRwIwPw= Received: (qmail 100781 invoked by alias); 9 Jun 2017 12:55:02 -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 91361 invoked by uid 89); 9 Jun 2017 12:54:50 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_SOFTFAIL autolearn=ham version=3.3.2 spammy=1199 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; Fri, 09 Jun 2017 12:54:47 +0000 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dJJQi-0007bh-Fg for gcc-patches@gcc.gnu.org; Fri, 09 Jun 2017 08:54:21 -0400 Received: from foss.arm.com ([217.140.101.70]:47128) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dJJQi-0007Te-5V for gcc-patches@gcc.gnu.org; Fri, 09 Jun 2017 08:54:20 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CEF202B; Fri, 9 Jun 2017 05:54:19 -0700 (PDT) Received: from e105689-lin.cambridge.arm.com (e105689-lin.cambridge.arm.com [10.2.207.32]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5DB713F3E1; Fri, 9 Jun 2017 05:54:19 -0700 (PDT) From: Richard Earnshaw To: gcc-patches@gcc.gnu.org Cc: Richard Earnshaw Subject: [PATCH 15/30] [arm] Make -mfloat-abi=softfp work when there are no FPU instructions Date: Fri, 9 Jun 2017 13:53:44 +0100 Message-Id: <50a309e2716dc50e5527a34ad8429b88e41c7919.1497004220.git.Richard.Earnshaw@arm.com> In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 217.140.101.70 Before this patch series it wasn't really possible to not have an FPU; it was always there, even if the hardware didn't really support it. Now that we have -mfpu=auto, the concept of not having an FPU becomes real. Consequently, when the -mfloat-abi switch is set to softfp doing the Right Thing is much more important. In this case we have a soft-float ABI, but can use FP instructions if they are available. To support this we have to separate out TARGET_HARD_FLOAT into two use cases: one where the instructions exist and one when they don't. We preserve the original meaning of TARGET_HARD_FLOAT (but add an extra check) of meaning that we are generating HW FP instructions, and add a new macro for the special case when use of FP instructions is permitted, but might not be available at this time (the distinction is important because they might be enabled by an attribute during the compilation). TARGET_SOFT_FLOAT continues to be the exact inverse of TARGET_HARD_FLOAT, but we now define it as such. * config/arm/arm.h (TARGET_HARD_FLOAT): Also check that we have some floating-point instructions. (TARGET_SOFT_FLOAT): Define as inverse of TARGET_HARD_FLOAT. (TARGET_MAYBE_HARD_FLOAT): New macro. * config/arm/arm-builtins.c (arm_init_builtins): Use TARGET_MAYBE_HARD_FLOAT. * config/arm/arm.c (arm_option_override): Use TARGET_HARD_FLOAT_ABI. --- gcc/config/arm/arm-builtins.c | 4 ++-- gcc/config/arm/arm.c | 3 +-- gcc/config/arm/arm.h | 9 +++++++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/gcc/config/arm/arm-builtins.c b/gcc/config/arm/arm-builtins.c index a0569ed..9755189 100644 --- a/gcc/config/arm/arm-builtins.c +++ b/gcc/config/arm/arm-builtins.c @@ -1876,7 +1876,7 @@ arm_init_builtins (void) arm_init_neon_builtins which uses it. */ arm_init_fp16_builtins (); - if (TARGET_HARD_FLOAT) + if (TARGET_MAYBE_HARD_FLOAT) { arm_init_neon_builtins (); arm_init_vfp_builtins (); @@ -1885,7 +1885,7 @@ arm_init_builtins (void) arm_init_acle_builtins (); - if (TARGET_HARD_FLOAT) + if (TARGET_MAYBE_HARD_FLOAT) { tree ftype_set_fpscr = build_function_type_list (void_type_node, unsigned_type_node, NULL); diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 7296ad3..97d2fbd 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -3467,8 +3467,7 @@ arm_option_override (void) { if (arm_abi == ARM_ABI_IWMMXT) arm_pcs_default = ARM_PCS_AAPCS_IWMMXT; - else if (arm_float_abi == ARM_FLOAT_ABI_HARD - && TARGET_HARD_FLOAT) + else if (TARGET_HARD_FLOAT_ABI) { arm_pcs_default = ARM_PCS_AAPCS_VFP; if (!bitmap_bit_p (arm_active_target.isa, isa_bit_VFPv2)) diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index dea3d0a..570bcd7 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -119,9 +119,14 @@ extern tree arm_fp16_type_node; #define TARGET_32BIT_P(flags) (TARGET_ARM_P (flags) || TARGET_THUMB2_P (flags)) /* Run-time Target Specification. */ -#define TARGET_SOFT_FLOAT (arm_float_abi == ARM_FLOAT_ABI_SOFT) /* Use hardware floating point instructions. */ -#define TARGET_HARD_FLOAT (arm_float_abi != ARM_FLOAT_ABI_SOFT) +#define TARGET_HARD_FLOAT (arm_float_abi != ARM_FLOAT_ABI_SOFT \ + && bitmap_bit_p (arm_active_target.isa, \ + isa_bit_VFPv2)) +#define TARGET_SOFT_FLOAT (!TARGET_HARD_FLOAT) +/* User has permitted use of FP instructions, if they exist for this + target. */ +#define TARGET_MAYBE_HARD_FLOAT (arm_float_abi != ARM_FLOAT_ABI_SOFT) /* Use hardware floating point calling convention. */ #define TARGET_HARD_FLOAT_ABI (arm_float_abi == ARM_FLOAT_ABI_HARD) #define TARGET_IWMMXT (arm_arch_iwmmxt)