Hi all,

Funny programm:

   extern int cnt,ovf;

   void foo1 (void)
   {
       if (!++cnt) ++ovf;
   }

   void foo11 (void)
   {
       if (!(cnt += 11)) ++ovf;
   }

Produce for foo1:
        ...
        mov     &cnt, r15
        mov     r15, r14        ; 1 word, 1 cycle
        add     #llo(1), r14    ; 1 word, 1 cycle
        mov     r14, &cnt
        cmp     #llo(-1), r15   ; 1 word, 1 cycle
        jne     .L1
        add     #llo(1), &ovf

   and for foo11:
        ...
        mov     &cnt, r15
        add     #llo(11), r15   ; 2 words, 2 cycles
        mov     r15, &cnt
        jne     .L3
        add     #llo(1), &ovf

Compiler: 3.3.2 with patch from CVS/gcc/gcc-3.4

By the way, at a leisure I have checked up some other targets. mspgcc
appeared the only thing which has taken advantage of available flag Z
(in foo11). Not considering, certainly, pdp11 and m68k, the command
"mov" which develops this flag.

Regards.


Reply via email to