Thanks for a good tip.
On Thursday 26 September 2002 13:01, David Brown wrote: > > Fellows, > > > > I am just trying to find a prefferable solution for a compare codes (32 > > bit > > > vars) - test against zero. > > So, analyzing IAR's output, I see, that EQ tests preformed as follows: > > > > mov &var, r12 > > and &var+2, r12 > > jeq Label > > > > whereas GCC does: > > > > tst &var+2 ; will be issued if necessary, likely not... > > jne +4 > > tst &var > > jeq .Label > > > > Which one _you_ think is better? > > > > ~d > > Well, the advantage of the gcc version is that it is faster if the high > word is non-zero, but it is slower if the low word also needs to be tested. > I take it by "will be issued if necessary" is because there is a very good > chance that you already have the flags set because the previous statement > was a calculation on that variable (such as, "if (--n) .."). In this case, > the gcc code is definitely faster. However, if you don't have that flag > already, then how about testing &var first, then &var+2 afterwards? As a > wild assumption, I would guess that it's more likely for a non-zero long to > have a zero hi word than a zero lo word, so more cases will take the > shortcut. > > mvh. > > David > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Mspgcc-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/mspgcc-users -- /******************************************************************** ("`-''-/").___..--''"`-._ (\ Dimmy the Wild UA1ACZ `6_ 6 ) `-. ( ).`-.__.`) Enterprise Information Sys (_Y_.)' ._ ) `._ `. ``-..-' Nevsky prospekt, 20 / 44 _..`--'_..-_/ /--'_.' ,' Saint Petersburg, Russia (il),-'' (li),' ((!.-' +7 (812) 3468202, 5585314 ********************************************************************/
