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

Bug#472867: more simplier loop



/* 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:   b8 00 00 00 00          mov    $0x0,%eax
5: 90 nop 6: 48 83 c0 01 add $0x1,%rax
  a:   75 f9                   jne    5 <main+0x5>
  c:   b8 00 00 00 00          mov    $0x0,%eax
11: c3 retq

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: