Skip to content

Instantly share code, notes, and snippets.

@banthar
Created August 8, 2011 00:16
Show Gist options
  • Save banthar/1130974 to your computer and use it in GitHub Desktop.
Save banthar/1130974 to your computer and use it in GitHub Desktop.
.file "test.cpp"
.globl cosine
.bss
.align 32
.type cosine, @object
.size cosine, 67108864
cosine:
.zero 67108864
.globl sine
.align 32
.type sine, @object
.size sine, 67108864
sine:
.zero 67108864
.section .rodata
.LC0:
.string "a"
.LC3:
.string "b"
.text
.globl main
.type main, @function
main:
.LFB87:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
movq %rsp, %rbp
.cfi_offset 6, -16
.cfi_def_cfa_register 6
subq $16, %rsp
movl $.LC0, %edi
call puts
movl $0, -4(%rbp)
jmp .L2
.L5:
movl $0, -8(%rbp)
jmp .L3
.L4:
movl -4(%rbp), %eax
imull -8(%rbp), %eax
addl %eax, %eax
cvtsi2ss %eax, %xmm0
movss .LC1(%rip), %xmm1
mulss %xmm1, %xmm0
movss .LC2(%rip), %xmm1
divss %xmm1, %xmm0
unpcklps %xmm0, %xmm0
cvtps2pd %xmm0, %xmm0
call cos
unpcklpd %xmm0, %xmm0
cvtpd2ps %xmm0, %xmm0
movl -8(%rbp), %eax
cltq
movl -4(%rbp), %edx
movslq %edx, %rdx
salq $12, %rdx
leaq (%rdx,%rax), %rax
movss %xmm0, cosine(,%rax,4)
movl -4(%rbp), %eax
negl %eax
imull -8(%rbp), %eax
addl %eax, %eax
cvtsi2ss %eax, %xmm0
movss .LC1(%rip), %xmm1
mulss %xmm1, %xmm0
movss .LC2(%rip), %xmm1
divss %xmm1, %xmm0
unpcklps %xmm0, %xmm0
cvtps2pd %xmm0, %xmm0
call sin
unpcklpd %xmm0, %xmm0
cvtpd2ps %xmm0, %xmm0
movl -8(%rbp), %eax
cltq
movl -4(%rbp), %edx
movslq %edx, %rdx
salq $12, %rdx
leaq (%rdx,%rax), %rax
movss %xmm0, sine(,%rax,4)
addl $1, -8(%rbp)
.L3:
cmpl $4095, -8(%rbp)
setle %al
testb %al, %al
jne .L4
addl $1, -4(%rbp)
.L2:
cmpl $4095, -4(%rbp)
setle %al
testb %al, %al
jne .L5
movl $.LC3, %edi
call puts
movl $0, %eax
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE87:
.size main, .-main
.section .rodata
.align 4
.type _ZL1N, @object
.size _ZL1N, 4
_ZL1N:
.long 4096
.align 4
.type _ZL2PI, @object
.size _ZL2PI, 4
_ZL2PI:
.long 1078530011
.align 4
.LC1:
.long 1078530011
.align 4
.LC2:
.long 1166016512
.ident "GCC: (Debian 4.5.3-3) 4.5.3"
.section .note.GNU-stack,"",@progbits
.file "test2.cpp"
.section .text._ZSt3cosf,"axG",@progbits,_ZSt3cosf,comdat
.weak _ZSt3cosf
.type _ZSt3cosf, @function
_ZSt3cosf:
.LFB22:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
movq %rsp, %rbp
.cfi_offset 6, -16
.cfi_def_cfa_register 6
subq $16, %rsp
movss %xmm0, -4(%rbp)
movss -4(%rbp), %xmm0
call cosf
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE22:
.size _ZSt3cosf, .-_ZSt3cosf
.section .text._ZSt3sinf,"axG",@progbits,_ZSt3sinf,comdat
.weak _ZSt3sinf
.type _ZSt3sinf, @function
_ZSt3sinf:
.LFB59:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
movq %rsp, %rbp
.cfi_offset 6, -16
.cfi_def_cfa_register 6
subq $16, %rsp
movss %xmm0, -4(%rbp)
movss -4(%rbp), %xmm0
call sinf
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE59:
.size _ZSt3sinf, .-_ZSt3sinf
.globl cosine
.bss
.align 32
.type cosine, @object
.size cosine, 67108864
cosine:
.zero 67108864
.globl sine
.align 32
.type sine, @object
.size sine, 67108864
sine:
.zero 67108864
.section .rodata
.LC0:
.string "a"
.LC3:
.string "b"
.text
.globl main
.type main, @function
main:
.LFB87:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
movq %rsp, %rbp
.cfi_offset 6, -16
.cfi_def_cfa_register 6
subq $16, %rsp
movl $.LC0, %edi
call puts
movl $0, -4(%rbp)
jmp .L4
.L7:
movl $0, -8(%rbp)
jmp .L5
.L6:
movl -4(%rbp), %eax
imull -8(%rbp), %eax
addl %eax, %eax
cvtsi2ss %eax, %xmm0
movss .LC1(%rip), %xmm1
mulss %xmm1, %xmm0
movss .LC2(%rip), %xmm1
divss %xmm1, %xmm0
call _ZSt3cosf
movl -8(%rbp), %eax
cltq
movl -4(%rbp), %edx
movslq %edx, %rdx
salq $12, %rdx
leaq (%rdx,%rax), %rax
movss %xmm0, cosine(,%rax,4)
movl -4(%rbp), %eax
negl %eax
imull -8(%rbp), %eax
addl %eax, %eax
cvtsi2ss %eax, %xmm0
movss .LC1(%rip), %xmm1
mulss %xmm1, %xmm0
movss .LC2(%rip), %xmm1
divss %xmm1, %xmm0
call _ZSt3sinf
movl -8(%rbp), %eax
cltq
movl -4(%rbp), %edx
movslq %edx, %rdx
salq $12, %rdx
leaq (%rdx,%rax), %rax
movss %xmm0, sine(,%rax,4)
addl $1, -8(%rbp)
.L5:
cmpl $4095, -8(%rbp)
setle %al
testb %al, %al
jne .L6
addl $1, -4(%rbp)
.L4:
cmpl $4095, -4(%rbp)
setle %al
testb %al, %al
jne .L7
movl $.LC3, %edi
call puts
movl $0, %eax
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE87:
.size main, .-main
.section .rodata
.align 4
.type _ZL1N, @object
.size _ZL1N, 4
_ZL1N:
.long 4096
.align 4
.type _ZL2PI, @object
.size _ZL2PI, 4
_ZL2PI:
.long 1078530011
.align 4
.LC1:
.long 1078530011
.align 4
.LC2:
.long 1166016512
.ident "GCC: (Debian 4.5.3-3) 4.5.3"
.section .note.GNU-stack,"",@progbits
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment