X86 64

From Ellcc

Jump to: navigation, search

Assembly generated by sieve.c:

./x86_64-elf-ecc -v -O5 -S test/sieve.c
        .text
        .align  16
        .globl  main
        .type   main,@function
main:
.Llabel1:
        pushq   %r14
        pushq   %rbx
        subq    $8, %rsp
        leaq    str, %rdi
        call    puts
        xorl    %eax, %eax
        jmp     .LBB1_11        # body2.outer
.LBB1_1:        # next
        xorb    %bl, %bl
        leaq    .str1, %rdi
        movb    %bl, %al
        call    printf
        leaq    .str3, %rsi
        leaq    .str2, %rdi
        movb    %bl, %al
        call    printf
        movl    $44, %esi
        leaq    .str4, %rdi
        movb    %bl, %al
        call    printf
        leaq    .str6, %rsi
        leaq    .str5, %rdi
        movb    %bl, %al
        call    printf
        leaq    .str8, %rsi
        leaq    .str7, %rdi
        movb    %bl, %al
        call    printf
        xorl    %r14d, %r14d
        leaq    .str9, %rdi
        movl    %r14d, %esi
        movb    %bl, %al
        call    printf
        movl    $1, %esi
        leaq    .str10, %rdi
        movb    %bl, %al
        call    printf
        leaq    .str11, %rdi
        movl    %r14d, %esi
        movb    %bl, %al
        call    printf
        leaq    .str13, %rsi
        leaq    .str12, %rdi
        movb    %bl, %al
        call    printf
        leaq    .str15, %rsi
        leaq    .str14, %rdi
        movb    %bl, %al
        call    printf
        movl    %r14d, %eax
        addq    $8, %rsp
        popq    %rbx
        popq    %r14
        ret
        .align  16
.LBB1_2:        # body2
        movslq  %ecx, %rdx
        movb    $1, flags(%rdx)
        incl    %ecx
        cmpl    $8191, %ecx
        jne     .LBB1_2 # body2
.LBB1_3:        # body2.body6_crit_edge
        xorl    %ecx, %ecx
        movl    $3, %edx
        movl    %edx, %edi
        movl    %ecx, %esi
        .align  16
.LBB1_4:        # body6
        movslq  %ecx, %r8
        cmpb    $0, flags(%r8)
        je      .LBB1_9 # next9
.LBB1_5:        # ifTrue
        cmpl    $8190, %edx
        jg      .LBB1_8 # next12
.LBB1_6:        # ifTrue.body11_crit_edge
        movl    %edx, %r8d
        .align  16
.LBB1_7:        # body11
        movslq  %r8d, %r9
        movb    $0, flags(%r9)
        addl    %edi, %r8d
        cmpl    $8191, %r8d
        jl      .LBB1_7 # body11
.LBB1_8:        # next12
        incl    %esi
.LBB1_9:        # next9
        addl    $3, %edx
        addl    $2, %edi
        incl    %ecx
        cmpl    $8191, %ecx
        jne     .LBB1_4 # body6
.LBB1_10:       # next8
        incl    %eax
        cmpl    $10000, %eax
        je      .LBB1_1 # next
        .align  16
.LBB1_11:       # body2.outer
        xorl    %ecx, %ecx
        jmp     .LBB1_2 # body2
        .size   main, .-main
        .type   flags,@object
        .globl flags
        .bss
        .align  16
flags:                          # flags
        .size   flags, 8191
        .zero   8191
        .type   .str1,@object
        .section        .rodata.str1.1,"aMS",@progbits,1
.str1:                          # .str1
        .size   .str1, 11
        .asciz  "%d primes\n"
        .type   .str2,@object
.str2:                          # .str2
        .size   .str2, 15
        .asciz  "__FILE__ = %s\n"
        .type   .str3,@object
.str3:                          # .str3
        .size   .str3, 13
        .asciz  "test/sieve.c"
        .type   .str4,@object
.str4:                          # .str4
        .size   .str4, 15
        .asciz  "__LINE__ = %d\n"
        .type   .str5,@object
.str5:                          # .str5
        .size   .str5, 15
        .asciz  "__DATE__ = %s\n"
        .type   .str6,@object
.str6:                          # .str6
        .size   .str6, 12
        .asciz  "Jul 13 2008"
        .type   .str7,@object
.str7:                          # .str7
        .size   .str7, 15
        .asciz  "__TIME__ = %s\n"
        .type   .str8,@object
.str8:                          # .str8
        .size   .str8, 9
        .asciz  "06:34:51"
        .type   .str9,@object
.str9:                          # .str9
        .size   .str9, 16
        .asciz  "__ELLCC__ = %d\n"
        .type   .str10,@object
        .align  16
.str10:                         # .str10
        .size   .str10, 22
        .asciz  "__ELLCC_MINOR__ = %d\n"
        .type   .str11,@object
        .align  16
.str11:                         # .str11
        .size   .str11, 27
        .asciz  "__ELLCC_PATCHLEVEL__ = %d\n"
        .type   .str12,@object
        .align  16
.str12:                         # .str12
        .size   .str12, 31
        .asciz  "__ELLCC_VERSION_STRING__ = %s\n"
        .type   .str13,@object
.str13:                         # .str13
        .size   .str13, 6
        .asciz  "0.1.0"
        .type   .str14,@object
        .align  16
.str14:                         # .str14
        .size   .str14, 25
        .asciz  "__ELLCC_VERSIONG__ = %s\n"
        .type   .str15,@object
        .align  16
.str15:                         # .str15
        .size   .str15, 24
        .asciz  "0.1.0 ALPHA Jul 13 2008"
        .type   str,@object
        .align  16
str:                            # str
        .size   str, 17
        .asciz  "10000 iterations"
Personal tools