cottrell@nbs-vms.ARPA (COTTRELL, JAMES) (10/01/85)
/* Alan Covington writes: > Chris Torek writes > > I offer another example. Take a 32 bit machine---the Vax---both for > > simplicity and because the Vax does compares via subtraction. But I > > will use a byte instruction: > > The VAX cmp and sub instructions set the condition codes differently. > Thus, the cmp is not just a "subtract" with the result thrown away. > An easy example is comparing 0x80000000 and 1 results in the N bit > of the condition codes being set, whereas subtracting 1 from 0x80000000 > results in the overflow bit being set. The VAX may use a subtract as > part of the cmp instruction, but it doesn't do signed comparison as > Chris claims. > > A signed comparison is a subtract with the result > > thrown away. You are correct literally. However, conceptually Chris is correct. You see, we all consider the VAX to be merely a PDP-11 with bells & whistles. On a PDP-11 (which is *the* standard conceptual model for instruxion sets) what he says is true. On a VAX, however, the microcode does all that `N xor V' stuff for you and just sets the result in N for you. The branch instruxions are changed to reflect that fact. Gone is the ability to determine the true sign of a *real* add/sub without testing overflow, but nobody did that anyway. You can trot out examples of what one machine or the other really *does* with compare/subtract, but the *concept* remains the same. jim cottrell@nbs */ ------