strcmp.S 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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, write to the Free
  16. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  17. 02111-1307 USA. */
  18. #include "_glibc_inc.h"
  19. .text
  20. ENTRY (BP_SYM (__strcmp))
  21. L(oop): movb (%rdi), %al
  22. cmpb (%rsi), %al
  23. jne L(neq)
  24. incq %rdi
  25. incq %rsi
  26. testb %al, %al
  27. jnz L(oop)
  28. xorl %eax, %eax
  29. ret
  30. L(neq): movl $1, %eax
  31. movl $-1, %ecx
  32. cmovbl %ecx, %eax
  33. ret
  34. END (BP_SYM (__strcmp))
  35. strong_alias(__strcmp,strcmp)