Many microprocessor instruction sets include an instruction that tests a condition and sets a destination operand if

Question:

Many microprocessor instruction sets include an instruction that tests a condition and sets a destination operand if the condition is true. Examples include the SETcc on the x86, the Scc on the Motorola MC68000, and the Scond on the National NS32000.
a. There are a few differences among these instructions:
€¢ SETcc and Scc operate only on a byte, whereas Scond operates on byte, word, and doubleword operands.
€¢ SETcc and Scond set the operand to integer one if true and to zero if false. Scc sets the byte to all binary ones if true and all zeros if false.
What are the relative advantages and disadvantages of these differences?
b. None of these instructions set any of the condition code flags, and thus an explicit test of the result of the instruction is required to determine its value. Discuss whether condition codes should be set as a result of this instruction.
c. A simple IF statement such as IF a > b THEN can be implemented using a numerical representation method, that is, making the Boolean value manifest, as opposed to a flow of control method, which represents the value of a Boolean expression by a point reached in the program. A compiler might implement IF a > b THEN with the following x86 code:
Many microprocessor instruction sets include an instruction that tests a

The result of (A > B) is a Boolean value held in a register and available later on, outside the context of the flow of code just shown. It is convenient to use register CX for this, because many of the branch and loop opcodes have a built-in test for CX. Show an alternative implementation using the SETcc instruction that saves memory and execution time.
d. Now consider the high-level language statement:
A: = (B > C) OR (D = F)
A compiler might generate the following code:

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: