mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-15 15:20:02 +00:00
Improve performance of printf functions
This commit is contained in:
parent
b107d2709f
commit
dc6d11a031
39 changed files with 577 additions and 650 deletions
|
@ -27,6 +27,8 @@
|
|||
// @param dil contains byte to escape
|
||||
// @see libc/nexgen32e/cescapec.c
|
||||
cescapec:
|
||||
.leafprologue
|
||||
.profilable
|
||||
movzbl %dil,%edi
|
||||
lea -7(%rdi),%ecx
|
||||
cmp $85,%cl
|
||||
|
@ -36,28 +38,28 @@ cescapec:
|
|||
jmp *cescapectab(,%rcx,8)
|
||||
.Lanchorpoint:
|
||||
.LBEL: mov $'a',%ah
|
||||
ret
|
||||
.leafepilogue
|
||||
.LBS: mov $'b',%ah
|
||||
ret
|
||||
.leafepilogue
|
||||
.LHT: mov $'t',%ah
|
||||
ret
|
||||
.leafepilogue
|
||||
.LLF: mov $'n',%ah
|
||||
ret
|
||||
.leafepilogue
|
||||
.LVT: mov $'v',%ah
|
||||
ret
|
||||
.leafepilogue
|
||||
.LFF: mov $'f',%ah
|
||||
ret
|
||||
.leafepilogue
|
||||
.LCR: mov $'r',%ah
|
||||
ret
|
||||
.leafepilogue
|
||||
.LDQ: mov $'\"',%ah
|
||||
ret
|
||||
.leafepilogue
|
||||
.LSQ: mov $'\'',%ah
|
||||
ret
|
||||
.leafepilogue
|
||||
.LBSL: mov $'\\',%ah
|
||||
ret
|
||||
.leafepilogue
|
||||
#ifdef __STRICT_ANSI__
|
||||
.LQM: mov $'?',%ah
|
||||
ret
|
||||
.leafepilogue
|
||||
#else
|
||||
.LQM:
|
||||
#endif
|
||||
|
@ -65,7 +67,7 @@ cescapec:
|
|||
lea -0x20(%rax),%ecx
|
||||
cmp $0x5E,%ecx
|
||||
ja 2f
|
||||
ret
|
||||
.leafepilogue
|
||||
2: and $-64,%eax
|
||||
mov %edi,%ecx
|
||||
and $56,%ecx
|
||||
|
@ -75,7 +77,7 @@ cescapec:
|
|||
or %ecx,%edi
|
||||
lea (%rdi,%rax,4),%eax
|
||||
add $'0'<<030|'0'<<020|'0'<<010|'\\',%eax
|
||||
ret
|
||||
.leafepilogue
|
||||
.endfn cescapec,globl
|
||||
|
||||
.initro 300,_init_cescapec
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
extern const uint32_t kCrc32cTab[256];
|
||||
|
||||
void crc32init(uint32_t[hasatleast 256], uint32_t);
|
||||
uint32_t crc32c(uint32_t, const void *, size_t);
|
||||
uint32_t crc32_z(uint32_t, const void *, size_t);
|
||||
|
|
|
@ -28,7 +28,8 @@
|
|||
// @return rax is address of last %sil in %rdi, or NULL
|
||||
// @note AVX2 requires Haswell (2014+) or Excavator (2015+)
|
||||
// @asyncsignalsafe
|
||||
memrchr:.leafprologue
|
||||
memrchr:
|
||||
.leafprologue
|
||||
.profilable
|
||||
#if !IsTiny()
|
||||
cmp $32,%rdx
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue