Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit aad2156f authored by arter97's avatar arter97 Committed by Michael Bestas
Browse files

Apply correct, optimized mfpu compiler flag for ARMv7-A Cortex CPUs

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: default avatarPark Ju Hyung <qkrwngud825@gmail.com>
Signed-off-by: default avatarMaxime Poulain <maxime.poulain@student.uclouvain.be>
parent 6a313de2
Loading
Loading
Loading
Loading
+13 −8
Original line number Diff line number Diff line
@@ -8,33 +8,38 @@ ARCH_ARM_HAVE_NEON := true

local_arch_has_lpae := false

ifneq (,$(filter cortex-a15 krait denver,$(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)))
ifneq (,$(filter cortex-a15 denver krait,$(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)))
	# TODO: krait is not a cortex-a15, we set the variant to cortex-a15 so that
	#       hardware divide operations are generated. This should be removed and a
	#       krait CPU variant added to GCC. For clang we specify -mcpu for krait in
	#       core/clang/arm.mk.
	arch_variant_cflags := -mcpu=cortex-a15
	arch_variant_cflags := -mcpu=cortex-a15 -mfpu=neon-vfpv4

	local_arch_has_lpae := true
	arch_variant_ldflags := \
		-Wl,--no-fix-cortex-a8
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
	arch_variant_ldflags := \
		-Wl,--fix-cortex-a8
else
ifneq (,$(filter cortex-a7 cortex-a53 cortex-a53.a57,$(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)))
	arch_variant_cflags := -mcpu=cortex-a7
	arch_variant_cflags := -mcpu=cortex-a7 -mfpu=neon-vfpv4

	local_arch_has_lpae := true
	arch_variant_ldflags := \
		-Wl,--no-fix-cortex-a8
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
	arch_variant_ldflags := \
		-Wl,--no-fix-cortex-a8
else
	arch_variant_cflags := -march=armv7-a -mfpu=neon
	# Generic ARM might be a Cortex A8 -- better safe than sorry
	arch_variant_ldflags := \
		-Wl,--fix-cortex-a8
@@ -42,6 +47,7 @@ endif
endif
endif
endif
endif

ifeq (true,$(local_arch_has_lpae))
	# Fake an ARM compiler flag as these processors support LPAE which GCC/clang
@@ -54,5 +60,4 @@ endif
local_arch_has_lpae :=

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