fadd_n.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /* Copyright (C) 2012-2015 Free Software Foundation, Inc.
  2. Contributed by Richard Henderson <rth@redhat.com>.
  3. This file is part of the GNU Atomic Library (libatomic).
  4. Libatomic is free software; you can redistribute it and/or modify it
  5. under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3 of the License, or
  7. (at your option) any later version.
  8. Libatomic is distributed in the hope that it will be useful, but WITHOUT ANY
  9. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  10. FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  11. more details.
  12. Under Section 7 of GPL version 3, you are granted additional
  13. permissions described in the GCC Runtime Library Exception, version
  14. 3.1, as published by the Free Software Foundation.
  15. You should have received a copy of the GNU General Public License and
  16. a copy of the GCC Runtime Library Exception along with this program;
  17. see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  18. <http://www.gnu.org/licenses/>. */
  19. #include <libatomic_i.h>
  20. #define NAME add
  21. #define OP(X,Y) ((X) + (Y))
  22. /* Defer to HAVE_ATOMIC_FETCH_ADD, which some targets implement specially,
  23. even if HAVE_ATOMIC_FETCH_OP is not defined. */
  24. #if !SIZE(HAVE_ATOMIC_FETCH_OP)
  25. # undef HAVE_ATOMIC_FETCH_OP_1
  26. # undef HAVE_ATOMIC_FETCH_OP_2
  27. # undef HAVE_ATOMIC_FETCH_OP_4
  28. # undef HAVE_ATOMIC_FETCH_OP_8
  29. # undef HAVE_ATOMIC_FETCH_OP_16
  30. # define HAVE_ATOMIC_FETCH_OP_1 HAVE_ATOMIC_FETCH_ADD_1
  31. # define HAVE_ATOMIC_FETCH_OP_2 HAVE_ATOMIC_FETCH_ADD_2
  32. # define HAVE_ATOMIC_FETCH_OP_4 HAVE_ATOMIC_FETCH_ADD_4
  33. # define HAVE_ATOMIC_FETCH_OP_8 HAVE_ATOMIC_FETCH_ADD_8
  34. # define HAVE_ATOMIC_FETCH_OP_16 HAVE_ATOMIC_FETCH_ADD_16
  35. #endif
  36. #include "fop_n.c"