[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#472867: more simplier loop (asm x86 corrected)



/* b.c */

int main()
{
 register long foo = 0;
 do {
   asm volatile("nop"::"r"(foo));
 } while(++foo);
 return 0;
}



which gives with gcc-4.3 -O2 -c b.c:


b.o:     file format elf64-x86-64

Disassembly of section .text:

0000000000000000 <main>:
   0:   31 c0                   xor    %eax,%eax
   2:   66 0f 1f 44 00 00       nopw   0x0(%rax,%rax,1)
   8:   90                      nop
   9:   48 83 c0 01             add    $0x1,%rax
   d:   eb f9                   jmp    8 <main+0x8>


and with arm-linux-gnueabi-gcc-4.3 -O2 -c b.c:

b.o:     file format elf32-littlearm

Disassembly of section .text:

00000000 <main>:
  0:   e3a03000        mov     r3, #0  ; 0x0
  4:   e1a00000        nop                     (mov r0,r0)
  8:   e2833001        add     r3, r3, #1      ; 0x1
  c:   eafffffc        b       4 <main+0x4>





Reply to: