Path: utzoo!utgpu!water!watmath!clyde!rutgers!gatech!hubcap!ncrcae!ncr-sd!hp-sdd!hplabs!hpda!hpesoc1!hpcllla!hpcllcm!daryl From: daryl@hpcllcm.HP.COM (Daryl Odnert) Newsgroups: comp.arch Subject: Re: conditional branches Message-ID: <960001@hpcllcm.HP.COM> Date: 12 Feb 88 18:16:05 GMT References: <191@telesoft.UUCP> Organization: HP ITG/ISD Computer Language Lab Lines: 35 The Hewlett-Packard Precision Architecture (a.k.a. Spectrum) includes some conditional branch instructions that may be of interest. There are instructions that allow you to -- compare two registers and conditionally branch based on the result of the comparison -- compare a register vs. an immediate and conditionally branch based on the result of the comparison -- add two registers and conditionally branch based on certain relationships between the operands -- add an immediate to a register and conditionally branch based on certain relationships between the operands Perhaps more directly related to Roger's suggestion are the following two instructions: BB -- branch on bit: tests a bit at a fixed position in a register and branch based if the bit is on or off (depending on a bit set in the instruction word.) BVB -- branch on variable bit: conditionally branches based on a bit at a position in a register specified by the value in another register. These last two instructions allow an optimizing compiler to perform the transformation suggested. I'm not sure whether the test is done early enough in the pipeline for the hardware to treat the instruction as a no-op or an unconditional branch. The answer may be different depending on which hardware implementation you look at. Daryl Odnert Hewlett-Packard Computer Language Lab {outside world}!hplabs!hpcllcm!daryl