memchr.S 373 B

123456789101112131415161718192021222324252627
  1. /* $Id: memchr.S,v 1.1 2000/04/14 16:49:01 mjd Exp $
  2. *
  3. * "memchr" implementation of SuperH
  4. *
  5. * Copyright (C) 1999 Niibe Yutaka
  6. *
  7. */
  8. /*
  9. * void *memchr(const void *s, int c, size_t n);
  10. */
  11. #include <linux/linkage.h>
  12. ENTRY(memchr)
  13. tst r6,r6
  14. bt/s 2f
  15. exts.b r5,r5
  16. 1: mov.b @r4,r1
  17. cmp/eq r1,r5
  18. bt/s 3f
  19. dt r6
  20. bf/s 1b
  21. add #1,r4
  22. 2: mov #0,r4
  23. 3: rts
  24. mov r4,r0