scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

memchr.s (220B)


      1 	.file 	"memchr.s"
      2 
      3 	.text
      4 	.globl	memchr,_memchr
      5 _memchr:
      6 memchr:
      7 	cmpq	$0,%rdx
      8 	je	notfound
      9 
     10 	movq	%rdx,%rcx
     11 	movb	%sil,%al
     12 	cld
     13 	repne
     14 	scasb
     15 	je 	found
     16 
     17 notfound:
     18 	xor	%eax,%eax
     19 	ret
     20 
     21 found:
     22 	leaq	-1(%rdi),%rax
     23 	ret