strcmp.S 945 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright 2005-2010 Analog Devices Inc.
  3. *
  4. * Licensed under the Clear BSD license or the GPL-2 (or later)
  5. */
  6. #include <linux/linkage.h>
  7. /* void *strcmp(char *s1, const char *s2);
  8. * R0 = address (s1)
  9. * R1 = address (s2)
  10. *
  11. * Returns an integer less than, equal to, or greater than zero if s1
  12. * (or the first n bytes thereof) is found, respectively, to be less
  13. * than, to match, or be greater than s2.
  14. */
  15. #ifdef CONFIG_STRCMP_L1
  16. .section .l1.text
  17. #else
  18. .text
  19. #endif
  20. .align 2
  21. ENTRY(_strcmp)
  22. P0 = R0 ; /* s1 */
  23. P1 = R1 ; /* s2 */
  24. 1:
  25. R0 = B[P0++] (Z); /* get *s1 */
  26. R1 = B[P1++] (Z); /* get *s2 */
  27. CC = R0 == R1; /* compare a byte */
  28. if ! cc jump 2f; /* not equal, break out */
  29. CC = R0; /* at end of s1? */
  30. if cc jump 1b (bp); /* no, keep going */
  31. jump.s 3f; /* strings are equal */
  32. 2:
  33. R0 = R0 - R1; /* *s1 - *s2 */
  34. 3:
  35. RTS;
  36. ENDPROC(_strcmp)