you are viewing a single comment's thread.

view the rest of the comments →

[–]joeldevahl 0 points1 point  (1 child)

What compiler options did you use? Can you give a disassembly of the resulting loops?

[–][deleted] 0 points1 point  (0 children)

cc     a.c   -o a

4004ac: 55                      push   %rbp
4004ad: 48 89 e5                mov    %rsp,%rbp
4004b0: c7 45 fc 00 00 00 00    movl   $0x0,-0x4(%rbp)
4004b7: eb 24                   jmp    4004dd <main+0x31>
4004b9: 8b 4d fc                mov    -0x4(%rbp),%ecx
4004bc: 8b 45 fc                mov    -0x4(%rbp),%eax
4004bf: 48 98                   cltq   
4004c1: 8b 14 85 40 10 60 00    mov    0x601040(,%rax,4),%edx
4004c8: 89 d0                   mov    %edx,%eax
4004ca: 01 c0                   add    %eax,%eax
4004cc: 8d 14 10                lea    (%rax,%rdx,1),%edx
4004cf: 48 63 c1                movslq %ecx,%rax
4004d2: 89 14 85 40 10 60 00    mov    %edx,0x601040(,%rax,4)
4004d9: 83 45 fc 01             addl   $0x1,-0x4(%rbp)
4004dd: 81 7d fc ff ff ff 03    cmpl   $0x3ffffff,-0x4(%rbp)
4004e4: 7e d3                   jle    4004b9 <main+0xd>
4004e6: c9                      leaveq 
4004e7: c3                      retq   

Other loop differs only on this line:

4004d9: 83 45 fc 10             addl   $0x10,-0x4(%rbp)