This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH][ARM] __ARM_FP & __ARM_NEON_FP defined when -march=armv7-m
- From: Mantas Mikaitis <Mantas dot Mikaitis at arm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 18 Nov 2014 11:30:56 +0000
- Subject: [PATCH][ARM] __ARM_FP & __ARM_NEON_FP defined when -march=armv7-m
- Authentication-results: sourceware.org; auth=none
- References: <546B2BEA dot 1020104 at arm dot com>
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.
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) \
builtin_define_with_int_value ( \
"__ARM_FP", TARGET_ARM_FP); \
if (arm_fp16_format == ARM_FP16_FORMAT_IEEE) \
@@ -2350,10 +2350,9 @@ extern int making_const_table;
/* 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. */