de-tabify; also speculate 1-byte loads to save a cycle or two
amd_d_nrv2b.S amd_d_nrv2e.S l_lx_elf64amd.S committer: jreiser <jreiser> 1131943590 +0000
This commit is contained in:
@@ -31,16 +31,16 @@
|
|||||||
|
|
||||||
ALIGN(1<<3)
|
ALIGN(1<<3)
|
||||||
lit_n2b:
|
lit_n2b:
|
||||||
movb (%rsi),%al; addq $1,%rsi
|
incq %rsi; movb %dl,(%rdi)
|
||||||
movb %al,(%rdi); addq $1,%rdi
|
incq %rdi
|
||||||
top_n2b:
|
top_n2b:
|
||||||
|
movzbl (%rsi),%edx # speculate: literal, or bottom 8 bits of offset
|
||||||
jnextb1y lit_n2b
|
jnextb1y lit_n2b
|
||||||
lea 1(lenq),off # [len= 0] off= 1
|
lea 1(lenq),off # [len= 0] off= 1
|
||||||
offmore_n2b:
|
offmore_n2b:
|
||||||
getnextb(off)
|
getnextb(off)
|
||||||
jnextb0n offmore_n2b
|
jnextb0n offmore_n2b
|
||||||
|
|
||||||
movzbl (%rsi),%edx
|
|
||||||
subl $ 3,off; jc len_n2b # use previous offset
|
subl $ 3,off; jc len_n2b # use previous offset
|
||||||
shll $ 8,off
|
shll $ 8,off
|
||||||
orl %edx,off; incq %rsi
|
orl %edx,off; incq %rsi
|
||||||
@@ -61,3 +61,8 @@ gotlen_n2b:
|
|||||||
call copy
|
call copy
|
||||||
bot_n2b: # In: 0==len
|
bot_n2b: # In: 0==len
|
||||||
jmp top_n2b
|
jmp top_n2b
|
||||||
|
|
||||||
|
/*
|
||||||
|
vi:ts=8:et:nowrap
|
||||||
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -31,9 +31,10 @@
|
|||||||
|
|
||||||
ALIGN(1<<3)
|
ALIGN(1<<3)
|
||||||
lit_n2e:
|
lit_n2e:
|
||||||
movb (%rsi),%al; addq $1,%rsi
|
incq %rsi; movb %dl,(%rdi)
|
||||||
movb %al,(%rdi); addq $1,%rdi
|
incq %rdi
|
||||||
top_n2e:
|
top_n2e:
|
||||||
|
movzbl (%rsi),%edx # speculate: literal, or bottom 8 bits of offset
|
||||||
jnextb1y lit_n2e
|
jnextb1y lit_n2e
|
||||||
lea 1(lenq),off # [len= 0] off= 1
|
lea 1(lenq),off # [len= 0] off= 1
|
||||||
jmp getoff_n2e
|
jmp getoff_n2e
|
||||||
@@ -45,7 +46,6 @@ getoff_n2e:
|
|||||||
getnextb(off)
|
getnextb(off)
|
||||||
jnextb0n off_n2e
|
jnextb0n off_n2e
|
||||||
|
|
||||||
movzbl (%rsi),%edx #; xorl len,len # len= 0
|
|
||||||
subl $ 3,off; jc offprev_n2e
|
subl $ 3,off; jc offprev_n2e
|
||||||
shll $ 8,off
|
shll $ 8,off
|
||||||
orl %edx,off; incq %rsi
|
orl %edx,off; incq %rsi
|
||||||
@@ -74,3 +74,8 @@ gotlen_n2e:
|
|||||||
call copy
|
call copy
|
||||||
bot_n2e: # In: 0==len
|
bot_n2e: # In: 0==len
|
||||||
jmp top_n2e
|
jmp top_n2e
|
||||||
|
|
||||||
|
/*
|
||||||
|
vi:ts=8:et:nowrap
|
||||||
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -110,20 +110,22 @@ getbit:
|
|||||||
refill:
|
refill:
|
||||||
movl (%rsi),bits; subq $-4,%rsi # next 32 bits; set Carry
|
movl (%rsi),bits; subq $-4,%rsi # next 32 bits; set Carry
|
||||||
adcl bits,bits # LSB= 1 (CarryIn); CarryOut= next bit
|
adcl bits,bits # LSB= 1 (CarryIn); CarryOut= next bit
|
||||||
|
movzbl (%rsi),%edx # speculate: literal, or bottom 8 bits of offset
|
||||||
rep; ret
|
rep; ret
|
||||||
|
|
||||||
copy: # In: len, %rdi, disp; Out: 0==len, %rdi, disp; trashes %rax, %rdx
|
copy: # In: len, %rdi, disp; Out: 0==len, %rdi, disp; trashes %rax, %rdx
|
||||||
leaq (%rdi,disp),%rdx
|
leaq (%rdi,disp),%rax; movb (%rax),%dl
|
||||||
cmpl $ 3,len; jbe copy1 # perhaps extend this to length 5 or less?
|
cmpl $ 3,len; jbe copy1 # perhaps extend this to length 5 or less?
|
||||||
cmpq $-4,disp; ja copy1 # 4-byte chunks would overlap
|
cmpq $-4,disp; ja copy1 # 4-byte chunks would overlap
|
||||||
subl $4,len # adjust for termination cases
|
subl $4,len # adjust for termination cases
|
||||||
copy4:
|
copy4:
|
||||||
movl (%rdx),%eax; leaq 4(%rdx),%rdx; subl $4,len
|
movl (%rax),%edx; addq $4, %rax; subl $4,len
|
||||||
movl %eax,(%rdi); leaq 4(%rdi),%rdi; jnc copy4
|
movl %edx,(%rdi); leaq 4(%rdi),%rdi; jnc copy4
|
||||||
addl $4,len; jz copy0
|
addl $4,len; movb (%rax),%dl; jz copy0
|
||||||
copy1:
|
copy1:
|
||||||
movb (%rdx), %al; leaq 1(%rdx),%rdx; subl $1,len
|
incq %rax; movb %dl,(%rdi); subl $1,len
|
||||||
movb %al,(%rdi); leaq 1(%rdi),%rdi; jnz copy1
|
movb (%rax),%dl
|
||||||
|
leaq 1(%rdi),%rdi; jnz copy1
|
||||||
copy0:
|
copy0:
|
||||||
rep; ret
|
rep; ret
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user