# Copyright (C) 2012-2020 Free Software Foundation, Inc.
#
# This file is part of GCC.
#
# GCC is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# GCC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
# This is a target makefile fragment that attempts to get
# multilibs built for the range of CPU's, FPU's and ABI's that
# are relevant for the A-profile architecture. It should
# not be used in conjunction with another make file fragment and
# assumes --with-arch, --with-cpu, --with-fpu, --with-float, --with-mode
# have their default values during the configure step. We enforce
# this during the top-level configury.
# Arch and FPU variants to build libraries with
MULTI_ARCH_OPTS_A = march=armv7-a/march=armv7-a+fp/march=armv7-a+simd/march=armv7ve+simd/march=armv8-a/march=armv8-a+simd
MULTI_ARCH_DIRS_A = v7-a v7-a+fp v7-a+simd v7ve+simd v8-a v8-a+simd
# ARMv7-A - build nofp, fp-d16 and SIMD variants
MULTILIB_REQUIRED += mthumb/march=armv7-a/mfloat-abi=soft
MULTILIB_REQUIRED += mthumb/march=armv7-a+fp/mfloat-abi=hard
MULTILIB_REQUIRED += mthumb/march=armv7-a+fp/mfloat-abi=softfp
MULTILIB_REQUIRED += mthumb/march=armv7-a+simd/mfloat-abi=hard
MULTILIB_REQUIRED += mthumb/march=armv7-a+simd/mfloat-abi=softfp
# ARMv7VE - only build a SIMD (+VFPv4) variant.
MULTILIB_REQUIRED += mthumb/march=armv7ve+simd/mfloat-abi=hard
MULTILIB_REQUIRED += mthumb/march=armv7ve+simd/mfloat-abi=softfp
# ARMv8-A - build nofp and SIMD variants.
MULTILIB_REQUIRED += mthumb/march=armv8-a/mfloat-abi=soft
MULTILIB_REQUIRED += mthumb/march=armv8-a+simd/mfloat-abi=hard
MULTILIB_REQUIRED += mthumb/march=armv8-a+simd/mfloat-abi=softfp
# Matches
# Arch Matches
# Map all basic v7-a arch extensions to v7-a
MULTILIB_MATCHES += $(foreach ARCH, $(v7_a_arch_variants), \
march?armv7-a=march?armv7-a$(ARCH))
# Map all v7-a FP variants to vfpv3-d16 (+fp)
MULTILIB_MATCHES += $(foreach ARCH, $(filter-out +fp, $(v7_a_nosimd_variants)), \
march?armv7-a+fp=march?armv7-a$(ARCH))
MULTILIB_MATCHES += $(foreach ARCHVAR, $(v7_a_arch_variants), \
$(foreach ARCH, $(v7_a_nosimd_variants), \
march?armv7-a+fp=march?armv7-a$(ARCHVAR)$(ARCH)))
# Map all v7-a SIMD variants to neon-vfpv3 (+simd)
MULTILIB_MATCHES += $(foreach ARCH, $(filter-out +simd, $(v7_a_simd_variants)), \
march?armv7-a+simd=march?armv7-a$(ARCH))
MULTILIB_MATCHES += $(foreach ARCHVAR, $(v7_a_arch_variants), \
$(foreach ARCH, $(v7_a_simd_variants), \
march?armv7-a+simd=march?armv7-a$(ARCHVAR)$(ARCH)))
# Neither FP nor SIMD: map v7ve to v7-a
MULTILIB_MATCHES += march?armv7-a=march?armv7ve
# ARMv7ve FP-only variants: map down to v7-a+fp
MULTILIB_MATCHES += $(foreach ARCH, $(v7ve_nosimd_variants), \
march?armv7-a+fp=march?armv7ve$(ARCH))
# ARMv7ve with SIMD, but SIMD is less capable than the default - map down to v7-a+simd
MULTILIB_MATCHES += $(foreach ARCH, $(v7ve_vfpv3_simd_variants), \
march?armv7-a+simd=march?armv7ve$(ARCH))
# ARMv8 without SIMD: map down to base architecture
MULTILIB_MATCHES += $(foreach ARCH, $(v8_a_nosimd_variants), \
march?armv8-a=march?armv8-a$(ARCH))
# ARMv8 with SIMD: map down to base arch + simd
MULTILIB_MATCHES += march?armv8-a+simd=march?armv8-a+crc+simd \
$(foreach ARCH, $(filter-out +simd, $(v8_a_simd_variants)), \
march?armv8-a+simd=march?armv8-a$(ARCH) \
march?armv8-a+simd=march?armv8-a+crc$(ARCH))
# Baseline v8.1-a: map down to baseline v8-a
MULTILIB_MATCHES += march?armv8-a=march?armv8.1-a
# Map all v8.1-a SIMD variants to v8-a+simd
MULTILIB_MATCHES += $(foreach ARCH, $(v8_1_a_simd_variants), \
march?armv8-a+simd=march?armv8.1-a$(ARCH))
# Baseline v8.2-a: map down to baseline v8-a
MULTILIB_MATCHES += march?armv8-a=march?armv8.2-a
# Baseline v8.3-a: map down to baseline v8-a
MULTILIB_MATCHES += march?armv8-a=march?armv8.3-a
# Map all v8.2-a and v8.3-a SIMD variants to v8-a+simd
MULTILIB_MATCHES += $(foreach ARCH, $(v8_2_a_simd_variants), \
march?armv8-a+simd=march?armv8.2-a$(ARCH) \
march?armv8-a+simd=march?armv8.3-a$(ARCH))
# Baseline v8.4-a: map down to baseline v8-a
MULTILIB_MATCHES += march?armv8-a=march?armv8.4-a
# Map all v8.4-a SIMD variants to v8-a+simd
MULTILIB_MATCHES += $(foreach ARCH, $(v8_4_a_simd_variants), \
march?armv8-a+simd=march?armv8.4-a$(ARCH))
# Baseline v8.5-a: map down to baseline v8-a
MULTILIB_MATCHES += march?armv8-a=march?armv8.5-a
# Map all v8.5-a SIMD variants to v8-a+simd
MULTILIB_MATCHES += $(foreach ARCH, $(v8_5_a_simd_variants), \
march?armv8-a+simd=march?armv8.5-a$(ARCH))
# Baseline v8.6-a: map down to baseline v8-a
MULTILIB_MATCHES += march?armv8-a=march?armv8.6-a
# Map all v8.6-a SIMD variants to v8-a+simd
MULTILIB_MATCHES += $(foreach ARCH, $(v8_6_a_simd_variants), \
march?armv8-a+simd=march?armv8.6-a$(ARCH))
# Use Thumb libraries for everything.
MULTILIB_REUSE += mthumb/march.armv7-a/mfloat-abi.soft=marm/march.armv7-a/mfloat-abi.soft
MULTILIB_REUSE += mthumb/march.armv8-a/mfloat-abi.soft=marm/march.armv8-a/mfloat-abi.soft
MULTILIB_REUSE += $(foreach ABI, hard softfp, \
$(foreach ARCH, armv7-a+fp armv7-a+simd armv7ve+simd armv8-a+simd, \
mthumb/march.$(ARCH)/mfloat-abi.$(ABI)=marm/march.$(ARCH)/mfloat-abi.$(ABI)))
# Softfp but no FP, use the soft-float libraries.
MULTILIB_REUSE += $(foreach MODE, arm thumb, \
$(foreach ARCH, armv7-a armv8-a, \
mthumb/march.$(ARCH)/mfloat-abi.soft=m$(MODE)/march.$(ARCH)/mfloat-abi.softfp))