Created
March 21, 2017 07:39
-
-
Save mgiuca/fb081ed2a9442ce72db52fb3e87cfe86 to your computer and use it in GitHub Desktop.
Assembly code for iteration over StringPiece (by-value)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Source: | |
# void StringPieceFindTestVal(const std::vector<base::StringPiece>& vector) { | |
# for (base::StringPiece piece : vector) | |
# printf("%zu\n", piece.find('x')); | |
# } | |
# | |
# Compiler: clang++ Linux 64-bit | |
# BB#0: # %entry | |
pushq %rbp | |
movq %rsp, %rbp | |
pushq %r15 | |
pushq %r14 | |
pushq %r12 | |
pushq %rbx | |
subq $16, %rsp | |
movq (%rdi), %rbx | |
movq 8(%rdi), %r12 | |
cmpq %r12, %rbx | |
je .LBB25_3 | |
# BB#1: | |
leaq -48(%rbp), %r14 | |
leaq .L.str.17(%rip), %r15 | |
.p2align 4, 0x90 | |
.LBB25_2: # %for.body | |
movups (%rbx), %xmm0 | |
movaps %xmm0, -48(%rbp) | |
movl $120, %esi | |
xorl %edx, %edx | |
movq %r14, %rdi | |
callq _ZN4base8internal4findERKNS_16BasicStringPieceISsEEcm@PLT | |
movq %rax, %rcx | |
xorl %eax, %eax | |
movq %r15, %rdi | |
movq %rcx, %rsi | |
callq printf@PLT | |
addq $16, %rbx | |
cmpq %rbx, %r12 | |
jne .LBB25_2 | |
.LBB25_3: # %for.cond.cleanup | |
addq $16, %rsp | |
popq %rbx | |
popq %r12 | |
popq %r14 | |
popq %r15 | |
popq %rbp | |
retq |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment