hm...
looks like this been polished a while ago, but somehow 3.3 branch is not
supported...
The same code with current gcc-3.2.X will produce the code below.
cheers,
~d
-------------------------------------------------
foo1:
/* prologue: frame size = 0 */
.L__FrameSize_foo1=0x0
.L__FrameOffset_foo1=0x0
/* prologue end (size=0) */
add #llo(1), &cnt ; 9 *addhi3_3/3 [length = 2]
jne .L1 ; 10 *cbranchhi [length = 1]
add #llo(1), &ovf ; 11 *addhi3_3/3 [length = 2]
.L1:
ret ; 22 return [length = 1]
/* epilogue: not required */
/* function foo1 size 6 (6) */
.Lfe1:
.size foo1,.Lfe1-foo1
/********* End of function ******/
foo11 .p2align 1,0
.global foo11
.type foo11,@function
/***********************
* Function `foo11'
***********************/
foo11:
/* prologue: frame size = 0 */
.L__FrameSize_foo11=0x0
.L__FrameOffset_foo11=0x0
/* prologue end (size=0) */
mov &cnt, r15 ; 24 *movhi3/6 [length = 2]
add #llo(11), r15 ; 9 *addhi3_3/8 [length = 2]
mov r15, &cnt ; 11 *movhi3/1 [length = 2]
jne .L3 ; 12 *cbranchhi [length = 1]
add #llo(1), &ovf ; 13 *addhi3_3/3 [length = 2]
.L3:
ret ; 26 return [length = 1]
/* epilogue: not required */
/* function foo11 size 10 (10) */
.Lfe2:
.size foo11,.Lfe2-foo11
/********* End of function ******/
On Thursday 08 January 2004 10:18, Dmitry K. wrote:
> 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.
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Perforce Software.
> Perforce is the Fast Software Configuration Management System offering
> advanced branching capabilities and atomic changes on 50+ platforms.
> Free Eval! http://www.perforce.com/perforce/loadprog.html
> _______________________________________________
> Mspgcc-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users
--
/*****************************************************************
("`-''-/").___..--''"`-._ (\ Dimmy the Wild UA1ACZ
`6_ 6 ) `-. ( ).`-.__.`) State Polytechnical Univ.
(_Y_.)' ._ ) `._ `. ``-..-' Radio-Physics Departament
_..`--'_..-_/ /--'_.' ,' Saint Petersburg, Russia
(il),-'' (li),' ((!.-' +7 (812) 5403923, 5585314
*****************************************************************/