memmove.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* Multiple versions of memmove.
  2. Copyright (C) 2016-2026 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <https://www.gnu.org/licenses/>. */
  15. #include <ifunc-memcpy.h>
  16. #if HAVE_MEMMOVE_IFUNC
  17. /* If we don't use ifunc, an alias is defined for memmove
  18. in sysdeps/s390/memmove-c.c or sysdeps/s390/memcpy.S
  19. depending on the used default implementation. */
  20. # undef memmove
  21. # define memmove __redirect_memmove
  22. # include <string.h>
  23. # include <ifunc-resolve.h>
  24. # undef memmove
  25. # if HAVE_MEMMOVE_C
  26. extern __typeof (__redirect_memmove) MEMMOVE_C attribute_hidden;
  27. # endif
  28. # if HAVE_MEMMOVE_Z13
  29. extern __typeof (__redirect_memmove) MEMMOVE_Z13 attribute_hidden;
  30. # endif
  31. # if HAVE_MEMMOVE_ARCH13
  32. extern __typeof (__redirect_memmove) MEMMOVE_ARCH13 attribute_hidden;
  33. # endif
  34. s390_libc_ifunc_expr (__redirect_memmove, memmove,
  35. ({
  36. s390_libc_ifunc_expr_stfle_init ();
  37. (HAVE_MEMMOVE_ARCH13 && (hwcap & HWCAP_S390_VXRS_EXT2)
  38. && S390_IS_ARCH13_MIE3 (stfle_bits))
  39. ? MEMMOVE_ARCH13
  40. : (HAVE_MEMMOVE_Z13 && (hwcap & HWCAP_S390_VX))
  41. ? MEMMOVE_Z13
  42. : MEMMOVE_DEFAULT;
  43. })
  44. )
  45. #endif