Skip to content

Instantly share code, notes, and snippets.

@deplinenoise
Created February 23, 2013 06:14
Show Gist options
  • Save deplinenoise/5018675 to your computer and use it in GitHub Desktop.
Save deplinenoise/5018675 to your computer and use it in GitHub Desktop.
; clang++ --version
; Apple LLVM version 4.2 (clang-425.0.24) (based on LLVM 3.2svn)
; Target: x86_64-apple-darwin12.2.0
; Thread model: posix
Djb2HashNoCase(char const*):
.cfi_startproc
## BB#0:
pushq %rbp
Ltmp14:
.cfi_def_cfa_offset 16
Ltmp15:
.cfi_offset %rbp, -16
movq %rsp, %rbp
Ltmp16:
.cfi_def_cfa_register %rbp
movb (%rdi), %dl
movl $5381, %eax ## imm = 0x1505
testb %dl, %dl
je LBB2_3
## BB#1: ## %.lr.ph.preheader
incq %rdi
movl $5381, %eax ## imm = 0x1505
movl $-1, %r8d
.align 4, 0x90
LBB2_2: ## %.lr.ph
## =>This Inner Loop Header: Depth=1
movzbl %dl, %edx
leal -65(%rdx), %ecx
cmpl $25, %ecx
movl $0, %esi
cmoval %r8d, %esi
andl %edx, %esi
cmpl $26, %ecx
movl $0, %ecx
sbbl $0, %ecx
orl $32, %edx
andl %ecx, %edx
orl %esi, %edx
imull $33, %eax, %eax
addl %edx, %eax
movb (%rdi), %dl
incq %rdi
testb %dl, %dl
jne LBB2_2
LBB2_3: ## %._crit_edge
popq %rbp
ret
; g++ --version
; i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
Djb2HashNoCase(char const*):
Leh_func_begin3:
pushq %rbp
Ltmp5:
movq %rsp, %rbp
Ltmp6:
movb (%rdi), %cl
testb %cl, %cl
jne LBB3_2
movl $5381, %eax
popq %rbp
ret
LBB3_2:
incq %rdi
movl $5381, %eax
.align 4, 0x90
LBB3_3:
movzbl %cl, %ecx
movl %ecx, %edx
orl $32, %edx
leal -65(%rcx), %esi
cmpl $26, %esi
cmovael %ecx, %edx
imull $33, %eax, %eax
addl %edx, %eax
movb (%rdi), %cl
incq %rdi
testb %cl, %cl
jne LBB3_3
popq %rbp
ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment