scc

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

strchr.s (282B)


      1 	.file 	"strchr.s"
      2 
      3 	.text
      4 	.globl	strchr,_strchr
      5 _strchr:
      6 strchr:
      7 	movq	%rdi,%r8
      8 
      9 	movb	$0,%al
     10 	movq	$-1,%rcx
     11 	cld
     12 	repne
     13 	scasb
     14 
     15 	leaq	-1(%rdi),%rcx
     16 	subq	%r8,%rcx
     17 
     18 	movq	%r8,%rdi
     19 	movb	%sil,%al
     20 	repne
     21 	scasb
     22 	je 	found
     23 
     24 none:
     25 	xor	%rax,%rax
     26 	ret
     27 
     28 found:
     29 	leaq	-1(%rdi),%rax
     30 	ret