Advertisement
Guest User

clang loop weirdness

a guest
Dec 3rd, 2013
421
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     .globl  tightloop
  2.     .align  16, 0x90
  3.     .type   tightloop,@function
  4. tightloop:                              # @tightloop
  5.     .cfi_startproc
  6. # BB#0:
  7.     xor eax, eax
  8.     .align  16, 0x90
  9. .LBB0_1:                                # =>This Inner Loop Header: Depth=1
  10.     add qword ptr [rip + counter], rax
  11.     inc rax
  12.     cmp rax, 400000000
  13.     jne .LBB0_1
  14. # BB#2:
  15.     ret
  16. .Ltmp0:
  17.     .size   tightloop, .Ltmp0-tightloop
  18.     .cfi_endproc
  19.  
  20.     .globl  foo
  21.     .align  16, 0x90
  22.     .type   foo,@function
  23. foo:                                    # @foo
  24.     .cfi_startproc
  25. # BB#0:
  26.     ret
  27. .Ltmp1:
  28.     .size   foo, .Ltmp1-foo
  29.     .cfi_endproc
  30.  
  31.     .globl  loop_with_extra_call
  32.     .align  16, 0x90
  33.     .type   loop_with_extra_call,@function
  34. loop_with_extra_call:                   # @loop_with_extra_call
  35.     .cfi_startproc
  36. # BB#0:
  37.     xor eax, eax
  38.     .align  16, 0x90
  39. .LBB2_1:                                # =>This Inner Loop Header: Depth=1
  40.     #APP
  41.     call foo
  42.     #NO_APP
  43.     add qword ptr [rip + counter], rax
  44.     inc rax
  45.     cmp rax, 400000000
  46.     jne .LBB2_1
  47. # BB#2:
  48.     ret
  49. .Ltmp2:
  50.     .size   loop_with_extra_call, .Ltmp2-loop_with_extra_call
  51.     .cfi_endproc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement