scc

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

memmove.s (275B)


      1 	.file 	"memmove.s"
      2 
      3 	.text
      4 	.globl	memmove,_memmove
      5 _memmove:
      6 memmove:
      7 	movq	%rdi,%rax
      8 
      9 	movq	%rdx,%rcx
     10 
     11 	cmpq	%rdi,%rsi
     12 	jg	forward
     13 	jl	backward
     14 	ret
     15 
     16 forward:
     17 	cld
     18 	rep
     19 	movsb
     20 	ret
     21 
     22 backward:
     23 	std
     24 	movq	%rdx,%r8
     25 	subq	$1,%r8
     26 	addq	%r8,%rdi
     27 	addq	%r8,%rsi
     28 	rep;	movsb
     29 	ret