1 # Out-of-line LSE atomics for AArch64 architecture. 2 # Copyright (C) 2019-2024 Free Software Foundation, Inc. 3 # Contributed by Linaro Ltd. 4 # 5 # This file is part of GCC. 6 # 7 # GCC is free software; you can redistribute it and/or modify it 8 # under the terms of the GNU General Public License as published by 9 # the Free Software Foundation; either version 3, or (at your option) 10 # any later version. 11 # 12 # GCC is distributed in the hope that it will be useful, but 13 # WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 # General Public License for more details. 16 # 17 # You should have received a copy of the GNU General Public License 18 # along with GCC; see the file COPYING3. If not see 19 # <http://www.gnu.org/licenses/>. 20 21 # Compare-and-swap has 5 sizes and 5 memory models. 22 S0 := $(foreach s, 1 2 4 8 16, $(addsuffix _$(s), cas)) 23 O0 := $(foreach m, 1 2 3 4 5, $(addsuffix _$(m)$(objext), $(S0))) 24 25 # Swap, Load-and-operate have 4 sizes and 5 memory models 26 S1 := $(foreach s, 1 2 4 8, $(addsuffix _$(s), swp ldadd ldclr ldeor ldset)) 27 O1 := $(foreach m, 1 2 3 4 5, $(addsuffix _$(m)$(objext), $(S1))) 28 29 LSE_OBJS := $(O0) $(O1) 30 31 libgcc-objects += $(LSE_OBJS) lse-init$(objext) 32 33 empty = 34 space = $(empty) $(empty) 35 PAT_SPLIT = $(subst _,$(space),$(*F)) 36 PAT_BASE = $(word 1,$(PAT_SPLIT)) 37 PAT_N = $(word 2,$(PAT_SPLIT)) 38 PAT_M = $(word 3,$(PAT_SPLIT)) 39 40 lse-init$(objext): $(srcdir)/config/aarch64/lse-init.c 41 $(gcc_compile) -c $< 42 43 $(LSE_OBJS): $(srcdir)/config/aarch64/lse.S 44 $(gcc_compile) -DL_$(PAT_BASE) -DSIZE=$(PAT_N) -DMODEL=$(PAT_M) -c $< 45