t-lse 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # Out-of-line LSE atomics for AArch64 architecture.
  2. # Copyright (C) 2019-2022 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. # Compare-and-swap has 5 sizes and 4 memory models.
  21. S0 := $(foreach s, 1 2 4 8 16, $(addsuffix _$(s), cas))
  22. O0 := $(foreach m, 1 2 3 4, $(addsuffix _$(m)$(objext), $(S0)))
  23. # Swap, Load-and-operate have 4 sizes and 4 memory models
  24. S1 := $(foreach s, 1 2 4 8, $(addsuffix _$(s), swp ldadd ldclr ldeor ldset))
  25. O1 := $(foreach m, 1 2 3 4, $(addsuffix _$(m)$(objext), $(S1)))
  26. LSE_OBJS := $(O0) $(O1)
  27. libgcc-objects += $(LSE_OBJS) lse-init$(objext)
  28. empty =
  29. space = $(empty) $(empty)
  30. PAT_SPLIT = $(subst _,$(space),$(*F))
  31. PAT_BASE = $(word 1,$(PAT_SPLIT))
  32. PAT_N = $(word 2,$(PAT_SPLIT))
  33. PAT_M = $(word 3,$(PAT_SPLIT))
  34. lse-init$(objext): $(srcdir)/config/aarch64/lse-init.c
  35. $(gcc_compile) -c $<
  36. $(LSE_OBJS): $(srcdir)/config/aarch64/lse.S
  37. $(gcc_compile) -DL_$(PAT_BASE) -DSIZE=$(PAT_N) -DMODEL=$(PAT_M) -c $<