Optimal for loop on the 68020.

Root Boy Jim rbj at dsys.ncsl.nist.gov
Tue Jun 13 08:58:45 AEST 1989


? From: Jef Poskanzer <pokey at well.uucp>
? Date: 8 Jun 89 21:45:08 GMT

? In the referenced message, rbj at dsys.ncsl.nist.gov (Root Boy Jim) wrote:
? }Hey, aren't most programs *I/O bound* anyway? And you can sometimes
? }unroll your loops.

? Any statement about "most programs" is guaranteed false.  In my case,
? I have a large suite of programs called PBM.  Most of them (note
? difference) are I/O bound (but less so now that I've improved the
? external data format).  Some are CPU bound.  I estimate that these
? would go about 1% faster if they used a dbra in their inner loop.

OK, I'll give you that point. It really *does* depend on your environment.
Even if what I say is true, there are still cases where it matters.

*But*, I would imagine that loop unrolling might beat the difference
that dbra might make. Have you looked into that?

? }I seem to remember Chris Torek stating something about using
? }		printf("n = %d\n");

? Somehow I doubt Chris would make such a stupid mistake.

Well, I *did* actually run the code; I started off with something
more nebulous, then decided to investigate it. Evidently my
transcription didn't make it back to the mail text.

? What is your point, anyway?  I didn't see it in your article.

Sorry, it was hidden in the generated code rather than stated.

If you had looked past the obvious, trivial, unimportant error, and
got to the meat of my posting, you would have noticed that I showed
you how to get a `dbra' generated by the compiler.

Hey, mellow out! My first reaction was to say: SHPX LBH!, but I can
see where you're coming from. I didn't make my points very well, and
my opening statement's flippancy evidently turned you off.

You will notice that my posting was the only one that showed you
how to actually get a dbra generated.

Peace, and thanks for the bitmaps.

? Jef

?     Jef Poskanzer  pokey at well.sf.ca.us  {ucbvax, apple, hplabs}!well!pokey
?                     "Sound impressive? It should. It is."

	Root Boy Jim is what I am
	Are you what you are or what?



More information about the Comp.unix.wizards mailing list