# Copyright (C) 2016-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 ARM 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.
s-mlib: $(srcdir)/config/arm/t-multilib $(srcdir)/config/arm/t-aprofile $(srcdir)/config/arm/t-rmprofile
MULTILIB_OPTIONS =
MULTILIB_DIRNAMES =
MULTILIB_EXCEPTIONS =
MULTILIB_MATCHES =
MULTILIB_REUSE =
MULTILIB_REQUIRED =
comma := ,
tm_multilib_list := $(subst $(comma), ,$(TM_MULTILIB_CONFIG))
HAS_APROFILE := $(filter aprofile,$(tm_multilib_list))
HAS_RMPROFILE := $(filter rmprofile,$(tm_multilib_list))
# Produce the combinatorial list of extensions. Where there are
# multiple permutations for a combination, the ordering is the
# selected by the forward ordering of the original list. This matches
# the canonical ordering generated by the canonicalizer in the driver.
#
# For example,
# $(call all_feat_combs, a b)
# will produce
# +a +a+b +b
# but will not include
# +b+a
# The rule is recursive and can be called with any (reasonable) list of
# extensions.
all_feat_combs = +$(firstword $(1)) \
$(if $(wordlist 2, $(words $(1)), $(1)), \
$(foreach OPT, \
$(call all_feat_combs, \
$(wordlist 2, $(words $(1)), $(1))), \
+$(firstword $(1))$(OPT) $(OPT)),)
# Variables used.
all_early_arch := armv5tej armv6 armv6j armv6k armv6z armv6kz \
armv6zk armv6t2 iwmmxt iwmmxt2
v7_a_arch_variants := $(call all_feat_combs, mp sec)
v7_a_nosimd_variants := +fp +vfpv3 +vfpv3-d16-fp16 +vfpv3-fp16 +vfpv4-d16 +vfpv4
v7_a_simd_variants := +simd +neon-fp16 +neon-vfpv4
v7_r_sp_variants := +fp.sp +fp.sp+idiv +vfpv3xd-fp16 +vfpv3xd-fp16+idiv
v7_r_dp_variants := +fp +fp+idiv +vfpv3-d16-fp16 +vfpv3-d16-fp16+idiv
v7ve_nosimd_variants := +vfpv3-d16 +vfpv3 +vfpv3-d16-fp16 +vfpv3-fp16 +fp +vfpv4
v7ve_vfpv3_simd_variants := +neon +neon-fp16
v7ve_vfpv4_simd_variants := +simd
v8_a_nosimd_variants := +crc
v8_a_simd_variants := $(call all_feat_combs, simd crypto)
v8_1_a_simd_variants := $(call all_feat_combs, simd crypto)
v8_2_a_simd_variants := $(call all_feat_combs, simd fp16 fp16fml crypto dotprod i8mm bf16)
v8_4_a_simd_variants := $(call all_feat_combs, simd fp16 crypto i8mm bf16)
v8_5_a_simd_variants := $(call all_feat_combs, simd fp16 crypto i8mm bf16)
v8_6_a_simd_variants := $(call all_feat_combs, simd fp16 crypto i8mm bf16)
v8_r_nosimd_variants := +crc
ifneq (,$(HAS_APROFILE))
include $(srcdir)/config/arm/t-aprofile
endif
ifneq (,$(HAS_RMPROFILE))
include $(srcdir)/config/arm/t-rmprofile
endif
SEP := $(and $(HAS_APROFILE),$(HAS_RMPROFILE),/)
MULTILIB_OPTIONS += marm/mthumb
MULTILIB_DIRNAMES += arm thumb
MULTILIB_OPTIONS += march=armv5te+fp/march=armv7/march=armv7+fp/march=armv7-r+fp.sp/$(MULTI_ARCH_OPTS_A)$(SEP)$(MULTI_ARCH_OPTS_RM)
MULTILIB_DIRNAMES += v5te v7 v7+fp v7-r+fp.sp $(MULTI_ARCH_DIRS_A) $(MULTI_ARCH_DIRS_RM)
MULTILIB_OPTIONS += mfloat-abi=soft/mfloat-abi=softfp/mfloat-abi=hard
MULTILIB_DIRNAMES += nofp softfp hard
MULTILIB_REQUIRED += mthumb/mfloat-abi=soft
MULTILIB_REQUIRED += marm/march=armv5te+fp/mfloat-abi=softfp
MULTILIB_REQUIRED += marm/march=armv5te+fp/mfloat-abi=hard
MULTILIB_REQUIRED += mthumb/march=armv7/mfloat-abi=soft
MULTILIB_REQUIRED += mthumb/march=armv7+fp/mfloat-abi=softfp
MULTILIB_REQUIRED += mthumb/march=armv7+fp/mfloat-abi=hard
MULTILIB_REQUIRED += mthumb/march=armv7-r+fp.sp/mfloat-abi=softfp
MULTILIB_REQUIRED += mthumb/march=armv7-r+fp.sp/mfloat-abi=hard
# Map v7-r with double precision down onto common v7 code.
MULTILIB_MATCHES += march?armv7=march?armv7-r
MULTILIB_MATCHES += march?armv7=march?armv7-r+idiv
MULTILIB_MATCHES += $(foreach ARCH, $(v7_r_dp_variants), \
march?armv7+fp=march?armv7-r$(ARCH))
# Map v7-r single precision variants to v7-r with single precision.
MULTILIB_MATCHES += $(foreach ARCH, \
$(filter-out +fp.sp, $(v7_r_sp_variants)), \
march?armv7-r+fp.sp=march?armv7-r$(ARCH))
MULTILIB_MATCHES += $(foreach ARCH, $(all_early_arch), \
march?armv5te+fp=march?$(ARCH)+fp)
# Map v8-r down onto common v7 code or v7-r sp.
MULTILIB_MATCHES += march?armv7=march?armv8-r
MULTILIB_MATCHES += $(foreach ARCH, $(v8_r_nosimd_variants), \
march?armv7=march?armv8-r$(ARCH))
MULTILIB_MATCHES += $(foreach ARCH,+simd +crypto, \
march?armv7+fp=march?armv8-r$(ARCH) \
march?armv7+fp=march?armv8-r+crc$(ARCH))
MULTILIB_MATCHES += march?armv7-r+fp.sp=march?armv8-r+fp.sp
MULTILIB_MATCHES += march?armv7-r+fp.sp=march?armv8-r+crc+fp.sp
ifeq (,$(HAS_APROFILE))
# Map all v7-a
MULTILIB_MATCHES += march?armv7=march?armv7-a
MULTILIB_MATCHES += $(foreach ARCH, $(v7_a_arch_variants), \
march?armv7=march?armv7-a$(ARCH))
MULTILIB_MATCHES += $(foreach ARCH, $(v7_a_nosimd_variants) $(v7_a_simd_variants), \
march?armv7+fp=march?armv7-a$(ARCH))
MULTILIB_MATCHES += $(foreach ARCHVAR, $(v7_a_arch_variants), \
$(foreach ARCH, $(v7_a_nosimd_variants) $(v7_a_simd_variants), \
march?armv7+fp=march?armv7-a$(ARCHVAR)$(ARCH)))
MULTILIB_MATCHES += march?armv7=march?armv7ve
# ARMv7ve FP/SIMD variants: map down to v7+fp
MULTILIB_MATCHES += $(foreach ARCH, $(v7ve_nosimd_variants) $(v7ve_vfpv3_simd_variants) $(v7ve_vfpv4_simd_variants), \
march?armv7+fp=march?armv7ve$(ARCH))
# ARMv8
MULTILIB_MATCHES += march?armv7=march?armv8-a
MULTILIB_MATCHES += $(foreach ARCH, $(v8_a_nosimd_variants), \
march?armv7=march?armv8-a$(ARCH))
# ARMv8 with SIMD
MULTILIB_MATCHES += march?armv7+fp=march?armv8-a+crc+simd \
$(foreach ARCH, $(v8_a_simd_variants), \
march?armv7+fp=march?armv8-a$(ARCH) \
march?armv7+fp=march?armv8-a+crc$(ARCH))
# Baseline v8.1-a
MULTILIB_MATCHES += march?armv7=march?armv8.1-a
# Map all v8.1-a SIMD variants
MULTILIB_MATCHES += $(foreach ARCH, $(v8_1_a_simd_variants), \
march?armv7+fp=march?armv8.1-a$(ARCH))
# Baseline v8.2-a: map down to baseline v8-a
MULTILIB_MATCHES += march?armv7=march?armv8.2-a
# Baseline v8.3-a: map down to baseline v8-a
MULTILIB_MATCHES += march?armv7=march?armv8.3-a
# Map all v8.2-a SIMD variants. v8.3-a SIMD variants have the same mappings
MULTILIB_MATCHES += $(foreach ARCH, $(v8_2_a_simd_variants), \
march?armv7+fp=march?armv8.2-a$(ARCH) \
march?armv7+fp=march?armv8.3-a$(ARCH))
# Baseline v8.4-a: map down to baseline v8-a
MULTILIB_MATCHES += march?armv7=march?armv8.4-a
# Map all v8.4-a SIMD variants
MULTILIB_MATCHES += $(foreach ARCH, $(v8_4_a_simd_variants), \
march?armv7+fp=march?armv8.4-a$(ARCH))
# Baseline v8.5-a: map down to baseline v8-a
MULTILIB_MATCHES += march?armv7=march?armv8.5-a
# Map all v8.5-a SIMD variants
MULTILIB_MATCHES += $(foreach ARCH, $(v8_5_a_simd_variants), \
march?armv7+fp=march?armv8.5-a$(ARCH))
# Baseline v8.6-a: map down to baseline v8-a
MULTILIB_MATCHES += march?armv7=march?armv8.6-a
# Map all v8.6-a SIMD variants
MULTILIB_MATCHES += $(foreach ARCH, $(v8_6_a_simd_variants), \
march?armv7+fp=march?armv8.6-a$(ARCH))
endif # Not APROFILE.
# Use Thumb libraries for everything.
MULTILIB_REUSE += mthumb/march.armv7/mfloat-abi.soft=marm/march.armv7/mfloat-abi.soft
MULTILIB_REUSE += $(foreach ABI, hard softfp, \
$(foreach ARCH, armv7+fp armv7-r+fp\.sp, \
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, \
mthumb/march.$(ARCH)/mfloat-abi.soft=m$(MODE)/march.$(ARCH)/mfloat-abi.softfp))