bcmp.S 264 B

1234567891011121314151617181920
  1. #include <machine/asm.h>
  2. ENTRY(bcmp)
  3. xorl %eax,%eax /* clear return value */
  4. movq %rdx,%rcx /* compare by words */
  5. shrq $3,%rcx
  6. repe
  7. cmpsq
  8. jne L1
  9. movq %rdx,%rcx /* compare remainder by bytes */
  10. andq $7,%rcx
  11. repe
  12. cmpsb
  13. je L2
  14. L1: incl %eax
  15. L2: ret