Skip to content

Commit

Permalink
Apply correct, optimized mfpu compiler flag for ARMv7-A Cortex CPUs
Browse files Browse the repository at this point in the history
For those ARMv7-A Cortex CPUs that can handle VFPv4 floating point,
We can set "-mfpu=neon-vfpv4" instead of generic "-mfpu=neon"
to gain extra performance improvements.

References :
 - GCC		: https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html
 - Cortex A15	: http://www.arm.com/products/processors/cortex-a/cortex-a15.php
 - Cortex A9	: http://www.arm.com/products/processors/cortex-a/cortex-a9.php
 - Cortex A8	: http://www.arm.com/products/processors/cortex-a/cortex-a8.php
 - Cortex A7	: http://www.arm.com/products/processors/cortex-a/cortex-a7.php
 - Cortex A5	: http://www.arm.com/products/processors/cortex-a/cortex-a5.php

Currently prebuilt clang doesn't support neon-vfpv4 flag so fall back to neon
Also added support for cortex-a5 arch

Change-Id: I91893789ed8edabf3767e1782e494b81158332bb
Signed-off-by: Park Ju Hyung <[email protected]>
Signed-off-by: Maxime Poulain <[email protected]>
  • Loading branch information
arter97 authored and hyperb1iss committed Aug 16, 2015
1 parent ba7e53f commit 8dd9ea1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
3 changes: 2 additions & 1 deletion core/clang/arm.mk
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ define subst-clang-incompatible-arm-flags
$(subst -march=armv5te,-march=armv5t,\
$(subst -march=armv5e,-march=armv5,\
$(subst -mcpu=cortex-a15,-march=armv7-a,\
$(1))))
$(subst -mfpu=neon-vfpv4,-mfpu=neon,\
$(1)))))
endef
19 changes: 11 additions & 8 deletions core/combo/arch/arm/armv7-a-neon.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,30 @@ ARCH_ARM_HAVE_VFP := true
ARCH_ARM_HAVE_VFP_D32 := true
ARCH_ARM_HAVE_NEON := true

ifneq (,$(filter cortex-a15 krait denver,$(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)))
arch_variant_cflags := -mcpu=cortex-a15
ifneq (,$(filter cortex-a15 denver krait,$(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)))
arch_variant_cflags := -mcpu=cortex-a15 -mfpu=neon-vfpv4
else
ifeq ($(strip $(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)),cortex-a9)
arch_variant_cflags := -mcpu=cortex-a9
arch_variant_cflags := -mcpu=cortex-a9 -mfpu=neon
else
ifneq (,$(filter cortex-a8 scorpion,$(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)))
arch_variant_cflags := -mcpu=cortex-a8
arch_variant_cflags := -mcpu=cortex-a8 -mfpu=neon
else
ifeq ($(strip $(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)),cortex-a7)
arch_variant_cflags := -mcpu=cortex-a7
arch_variant_cflags := -mcpu=cortex-a7 -mfpu=neon-vfpv4
else
arch_variant_cflags := -march=armv7-a
ifeq ($(strip $(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)),cortex-a5)
arch_variant_cflags := -mcpu=cortex-a7 -mfpu=neon-vfpv4
else
arch_variant_cflags := -march=armv7-a -mfpu=neon
endif
endif
endif
endif
endif

arch_variant_cflags += \
-mfloat-abi=softfp \
-mfpu=neon
-mfloat-abi=softfp

arch_variant_ldflags := \
-Wl,--fix-cortex-a8

0 comments on commit 8dd9ea1

Please sign in to comment.