From patchwork Wed Dec 3 09:33:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mantas Mikaitis X-Patchwork-Id: 417305 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 BFC691400DD for ; Wed, 3 Dec 2014 20:33:57 +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:subject:references :in-reply-to:content-type; q=dns; s=default; b=ym45RLiX3s15OQvfK dVSNpehcN2qbWY7yPNwDmhnmFp7/q9qh9VANJlJ/cj1r52wh3TziiOIBBpRqtym8 caS/N6P+dQnqEBUj8wkJD66nCghYyv5twF7vXdExO154TgymkDS2R2aPsMVXgxNv yLgAqf+MphMzI4xC8MrlzOianU= 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:subject:references :in-reply-to:content-type; s=default; bh=2ZWtcmYJ0VBiP8LaNFiHfDy GZI8=; b=FspJzCYRSka1UQStlhnhpaYiWFpMQZfeogbx496ErQpZD+OGLxRFbRH Fh3AOmz9Eg9OzKj4aRXpmWBy219obcoJ7joRSb8min4oWxlh9UahlYexmi0fBsdF aC4nZajRubm9oNt+FsgMEtHHItsVC3Ou49ueyp3O0sqHTDXxZ6DI= Received: (qmail 11518 invoked by alias); 3 Dec 2014 09:33:49 -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 11399 invoked by uid 89); 3 Dec 2014 09:33:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, SPF_PASS autolearn=ham version=3.3.2 X-HELO: service87.mimecast.com Received: from service87.mimecast.com (HELO service87.mimecast.com) (91.220.42.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 03 Dec 2014 09:33:46 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by service87.mimecast.com; Wed, 03 Dec 2014 09:33:43 +0000 Received: from e105915-lin.cambridge.arm.com ([10.1.255.212]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 3 Dec 2014 09:33:41 +0000 Message-ID: <547ED8F4.5090706@arm.com> Date: Wed, 03 Dec 2014 09:33:40 +0000 From: Mantas Mikaitis User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Richard Earnshaw , "gcc-patches@gcc.gnu.org" Subject: Re: [PATCH][ARM] __ARM_FP & __ARM_NEON_FP defined when -march=armv7-m References: <546B2BEA.1020104@arm.com> <546B2DF0.5060703@arm.com> <546B3465.7030805@arm.com> In-Reply-To: <546B3465.7030805@arm.com> X-MC-Unique: 114120309334300201 X-IsSubscribed: yes On 18/11/14 11:58, Richard Earnshaw wrote: > On 18/11/14 11:30, Mantas Mikaitis wrote: >> Incorrect predefinitions for certain target architectures. E.g. arm7-m >> does not contain NEON but the defintion __ARM_NEON_FP was switched on. >> Similarly with armv6 and even armv2. >> >> This patch fixes the predefines for each of the different chips >> containing certain types of the FPU implementations. >> >> Tests: >> >> Tested on arm-none-linux-gnueabi and arm-none-linux-gnueabihf without >> any new regression. >> >> Manually compiled for various targets and all correct definitions were >> present. >> >> Is this patch ok for trunk? >> >> Mantas >> >> gcc/Changelog: >> >> * config/arm/arm.h (TARGET_NEON_FP): Removed conditional definition, define to zero if !TARGET_NEON. >> (TARGET_CPU_CPP_BUILTINS): Added second condition before defining __ARM_FP macro. >> >> >> ARM_DEFS.patch >> >> >> diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h >> index ff4ddac..325fea9 100644 >> --- a/gcc/config/arm/arm.h >> +++ b/gcc/config/arm/arm.h >> @@ -118,7 +118,7 @@ extern char arm_arch_name[]; >> if (TARGET_VFP) \ >> builtin_define ("__VFP_FP__"); \ >> \ >> - if (TARGET_ARM_FP) \ >> + if (TARGET_ARM_FP && !TARGET_SOFT_FLOAT) \ > Wouldn't it be better to factor this into TARGET_ARM_FP? It seems odd > that that macro returns a set of values based on something completely > unavailable for the current compilation. That would also then mirror > the behaviour of TARGET_NEON_FP (see below) and make the internal macros > more consistent. > > R. Thank you. Patch updated. Ok for trunk? Mantas M. gcc/Changelog 2014-12-03 Mantas Mikaits * config/arm/arm.h (TARGET_NEON_FP): Removed conditional definition, define to zero if !TARGET_NEON. (TARGET_ARM_FP): Added !TARGET_SOFT_FLOAT into the conditional definition. gcc/testsuite/ChangeLog: * gcc.target/arm/macro_defs0.c: New test. * gcc.target/arm/macro_defs1.c: New test. * gcc.target/arm/macro_defs2.c: New test. diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index ff4ddac..7d4cc39 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -2343,17 +2343,17 @@ extern int making_const_table; point types. Where bit 1 indicates 16-bit support, bit 2 indicates 32-bit support, bit 3 indicates 64-bit support. */ #define TARGET_ARM_FP \ - (TARGET_VFP_SINGLE ? 4 \ - : (TARGET_VFP_DOUBLE ? (TARGET_FP16 ? 14 : 12) : 0)) + (!TARGET_SOFT_FLOAT ? (TARGET_VFP_SINGLE ? 4 \ + : (TARGET_VFP_DOUBLE ? (TARGET_FP16 ? 14 : 12) : 0)) \ + : 0) /* Set as a bit mask indicating the available widths of floating point types for hardware NEON floating point. This is the same as TARGET_ARM_FP without the 64-bit bit set. */ -#ifdef TARGET_NEON -#define TARGET_NEON_FP \ - (TARGET_ARM_FP & (0xff ^ 0x08)) -#endif +#define TARGET_NEON_FP \ + (TARGET_NEON ? (TARGET_ARM_FP & (0xff ^ 0x08)) \ + : 0) /* The maximum number of parallel loads or stores we support in an ldm/stm instruction. */ diff --git a/gcc/testsuite/gcc.target/arm/macro_defs0.c b/gcc/testsuite/gcc.target/arm/macro_defs0.c new file mode 100644 index 0000000..198243e --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/macro_defs0.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-skip-if "avoid conflicting multilib options" + { *-*-* } { "-march=*" } {"-march=armv7-m"} } */ +/* { dg-skip-if "avoid conflicting multilib options" + { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=soft" } } */ +/* { dg-options "-march=armv7-m -mcpu=cortex-m3 -mfloat-abi=soft -mthumb" } */ + +#ifdef __ARM_FP +#error __ARM_FP should not be defined +#endif + +#ifdef __ARM_NEON_FP +#error __ARM_NEON_FP should not be defined +#endif diff --git a/gcc/testsuite/gcc.target/arm/macro_defs1.c b/gcc/testsuite/gcc.target/arm/macro_defs1.c new file mode 100644 index 0000000..075b71b --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/macro_defs1.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-skip-if "avoid conflicting multilib options" + { *-*-* } { "-march=*" } { "-march=armv6-m" } } */ +/* { dg-options "-march=armv6-m -mthumb" } */ + +#ifdef __ARM_NEON_FP +#error __ARM_NEON_FP should not be defined +#endif + diff --git a/gcc/testsuite/gcc.target/arm/macro_defs2.c b/gcc/testsuite/gcc.target/arm/macro_defs2.c new file mode 100644 index 0000000..9a96042 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/macro_defs2.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-march=armv7ve -mcpu=cortex-a15 -mfpu=neon-vfpv4" } */ +/* { dg-add-options arm_neon } */ +/* { dg-require-effective-target arm_neon_ok } */ + +#ifndef __ARM_NEON_FP +#error __ARM_NEON_FP is not defined but should be +#endif + +#ifndef __ARM_FP +#error __ARM_FP is not defined but should be +#endif + +