strcmp.S 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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))