strcmp.S 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /* Highly optimized version for x86-64.
  2. Copyright (C) 1999, 2000, 2002, 2003, 2005 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. Based on i686 version contributed by Ulrich Drepper
  5. <drepper@cygnus.com>, 1999.
  6. The GNU C Library is free software; you can redistribute it and/or
  7. modify it under the terms of the GNU Lesser General Public
  8. License as published by the Free Software Foundation; either
  9. version 2.1 of the License, or (at your option) any later version.
  10. The GNU C Library is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. Lesser General Public License for more details.
  14. You should have received a copy of the GNU Lesser General Public
  15. License along with the GNU C Library; if not, see
  16. <http://www.gnu.org/licenses/>. */
  17. #include "_glibc_inc.h"
  18. .text
  19. ENTRY (BP_SYM (strcmp))
  20. L(oop): movb (%rdi), %al
  21. cmpb (%rsi), %al
  22. jne L(neq)
  23. incq %rdi
  24. incq %rsi
  25. testb %al, %al
  26. jnz L(oop)
  27. xorl %eax, %eax
  28. ret
  29. L(neq): movl $1, %eax
  30. movl $-1, %ecx
  31. cmovbl %ecx, %eax
  32. ret
  33. END (BP_SYM (strcmp))
  34. libc_hidden_def(strcmp)
  35. #ifndef __UCLIBC_HAS_LOCALE__
  36. strong_alias(strcmp,strcoll)
  37. libc_hidden_def(strcoll)
  38. #endif