xref: /netbsd-src/external/gpl3/gcc/dist/libgcc/config/aarch64/t-lse (revision 4c3eb207d36f67d31994830c0a694161fc1ca39b)
1# Out-of-line LSE atomics for AArch64 architecture.
2# Copyright (C) 2019-2020 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.
22S0 := $(foreach s, 1 2 4 8 16, $(addsuffix _$(s), cas))
23O0 := $(foreach m, 1 2 3 4 5, $(addsuffix _$(m)$(objext), $(S0)))
24
25# Swap, Load-and-operate have 4 sizes and 5 memory models
26S1 := $(foreach s, 1 2 4 8, $(addsuffix _$(s), swp ldadd ldclr ldeor ldset))
27O1 := $(foreach m, 1 2 3 4 5, $(addsuffix _$(m)$(objext), $(S1)))
28
29LSE_OBJS := $(O0) $(O1)
30
31libgcc-objects += $(LSE_OBJS) lse-init$(objext)
32
33empty      =
34space      = $(empty) $(empty)
35PAT_SPLIT  = $(subst _,$(space),$(*F))
36PAT_BASE   = $(word 1,$(PAT_SPLIT))
37PAT_N      = $(word 2,$(PAT_SPLIT))
38PAT_M      = $(word 3,$(PAT_SPLIT))
39
40lse-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