Created
July 18, 2012 15:39
-
-
Save mansr/3137003 to your computer and use it in GitHub Desktop.
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
int foo(int a, int b) | |
{ | |
int d = 0; | |
int i; | |
for (i = 0; i < a; i++) { | |
int c = 0; | |
if (b > 1) | |
c = 1024 / b; | |
d += c; | |
} | |
return d; | |
} | |
int main(void) | |
{ | |
foo(1, 0); | |
return 0; | |
} |
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
# /opt/enzo/lib/4.9.02/x8664/be::4.9.02 | |
#----------------------------------------------------------- | |
# Compiling div.c (/tmp/pathcc-B-327b23c6.B) | |
#----------------------------------------------------------- | |
#----------------------------------------------------------- | |
# Options: | |
#----------------------------------------------------------- | |
# Target:Core, ISA:ISA_1, Endian:little, Pointer Size:64 | |
# -O2 (Optimization level) | |
# -g0 (Debug level) | |
# -m2 (Report advisories) | |
#----------------------------------------------------------- | |
.file 1 "/tmp/div.c" | |
.text | |
.align 2 | |
.section .text | |
# Program Unit: foo | |
.globl foo | |
.type foo, @function | |
foo: # 0x0 | |
# .frame %rsp, 40, %rsp | |
# d = 4 | |
# i = 0 | |
# c = 8 | |
.cfi_startproc | |
.loc 1 1 1 | |
# 1 int foo(int a, int b) | |
.LBB1_foo: | |
#<freq> | |
#<freq> BB:1 frequency = 1.00000 (heuristic) | |
#<freq> BB:1 => BB:2 probability = 0.97590 | |
#<freq> BB:1 => BB:9 probability = 0.02410 | |
#<freq> | |
addq $-40,%rsp # [0] | |
testl %edi,%edi # [0] | |
jle .Lt_0_3330 # [1] | |
.LBB2_foo: | |
#<freq> | |
#<freq> BB:2 frequency = 0.97590 (heuristic) | |
#<freq> | |
movl $1024,%eax # [0] | |
cltd # [1] | |
idivl %esi # [2] | |
xorl %r9d,%r9d # [23] | |
xorl %r8d,%r8d # [24] | |
movl %eax,%r10d # [24] | |
jmp .Lt_0_2306 # [24] | |
.Lt_0_2818: | |
#<loop> Part of loop body line 1, head labeled .Lt_0_2306 | |
#<freq> | |
#<freq> BB:6 frequency = 48.79518 (heuristic) | |
#<freq> | |
xorl %eax,%eax # [0] | |
.Lt_0_2562: | |
#<loop> Part of loop body line 1, head labeled .Lt_0_2306 | |
#<freq> | |
#<freq> BB:7 frequency = 97.59036 (heuristic) | |
#<freq> BB:7 => BB:4 probability = 0.99000 | |
#<freq> BB:7 => BB:15 probability = 0.01000 | |
#<freq> | |
.loc 1 6 24 | |
# 2 { | |
# 3 int d = 0; | |
# 4 int i; | |
# 5 | |
# 6 for (i = 0; i < a; i++) { | |
addl $1,%r9d # [0] | |
.loc 1 12 9 | |
# 8 | |
# 9 if (b > 1) | |
# 10 c = 1024 / b; | |
# 11 | |
# 12 d += c; | |
addl %eax,%r8d # [1] | |
.loc 1 6 24 | |
cmpl %r9d,%edi # [1] | |
jle .LBB15_foo # [2] | |
.Lt_0_2306: | |
#<loop> Loop body line 1, nesting depth: 1, estimated iterations: 100 | |
#<freq> | |
#<freq> BB:4 frequency = 97.59036 (heuristic) | |
#<freq> BB:4 => BB:5 probability = 0.50000 | |
#<freq> BB:4 => BB:6 probability = 0.50000 | |
#<freq> | |
.loc 1 1 1 | |
cmpl $1,%esi # [0] | |
jle .Lt_0_2818 # [1] | |
.LBB5_foo: | |
#<loop> Part of loop body line 1, head labeled .Lt_0_2306 | |
#<freq> | |
#<freq> BB:5 frequency = 48.79518 (heuristic) | |
#<freq> | |
.loc 1 10 13 | |
movl %r10d,%eax # [0] | |
jmp .Lt_0_2562 # [0] | |
.LBB15_foo: | |
#<freq> | |
#<freq> BB:15 frequency = 0.97590 (heuristic) | |
#<freq> | |
.loc 1 15 5 | |
# 13 } | |
# 14 | |
# 15 return d; | |
movl %r8d,%eax # [0] | |
addq $40,%rsp # [0] | |
ret # [0] | |
.Lt_0_3330: | |
#<freq> | |
#<freq> BB:9 frequency = 0.02410 (heuristic) | |
#<freq> | |
xorl %eax,%eax # [0] | |
addq $40,%rsp # [0] | |
ret # [0] | |
.cfi_endproc | |
.LDWend_foo: | |
.size foo, .LDWend_foo-foo | |
.section .text | |
# Program Unit: main | |
.globl main | |
.type main, @function | |
main: # 0x64 | |
# .frame %rsp, 8, %rsp | |
.cfi_startproc | |
.loc 1 18 1 | |
# 16 } | |
# 17 | |
# 18 int main(void) | |
.LBB1_main: | |
#<freq> | |
#<freq> BB:1 frequency = 1.00000 (heuristic) | |
#<freq> | |
addq $-8,%rsp | |
fnstcw (%rsp) | |
andw $0xfcff,(%rsp) | |
orw $768,(%rsp) | |
fldcw (%rsp) | |
addq $8,%rsp | |
addq $-8,%rsp # [0] | |
.loc 1 20 5 | |
# 19 { | |
# 20 foo(1, 0); | |
movq $1,%rdi # [0] | |
xorq %rsi,%rsi # [0] | |
call foo # [0] foo | |
.LBB2_main: | |
#<freq> | |
#<freq> BB:2 frequency = 1.00000 (heuristic) | |
#<freq> | |
xorq %rax,%rax # [0] | |
.loc 1 21 5 | |
# 21 return 0; | |
addq $8,%rsp # [0] | |
ret # [0] | |
.cfi_endproc | |
.LDWend_main: | |
.size main, .LDWend_main-main | |
.section .text | |
.align 4 | |
.section .debug_line, "" | |
.section .note.GNU-stack,"",@progbits | |
.ident "#PathScale Compiler Version 4.9.02 : div.c compiled with : -VHO:rotate -O2 -march=core -msse2 -msse3 -mno-3dnow -mno-sse4a -m64" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment