Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!uunet!comp.vuw.ac.nz!waikato.ac.nz!ldo From: ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) Newsgroups: comp.arch Subject: What about loop instructions? Message-ID: <1991Apr15.195511.3437@waikato.ac.nz> Date: 15 Apr 91 07:55:11 GMT Organization: University of Waikato, Hamilton, New Zealand Lines: 17 What sort of looping instructions do different processors have? I used to think it was more trouble than it was worth to use *any* kind of "subtract-one-and-branch" instruction to implement a Pascal-style for-loop correctly, until I saw some code which showed me the *right* way to use the DBRA instruction on a 68000. I was impressed! This instruction lets you handle an initial loop count of zero without a separate check. Do other architectures have loop instructions that are at least as well-designed? Lawrence D'Oliveiro fone: +64-71-562-889 Computer Services Dept fax: +64-71-384-066 University of Waikato electric mail: ldo@waikato.ac.nz Hamilton, New Zealand 37^ 47' 26" S, 175^ 19' 7" E, GMT+12:00 To someone with a hammer and a screwdriver, every problem looks like a nail with threads.