Instruction classification: ADD, CMP, and MUL belong to which category of instructions in common CPU instruction sets?
-
AData transfer
-
BArithmetic
-
CBit manipulation
-
DLoops and jumps
Answer
Correct Answer: Arithmetic
Explanation
Introduction / Context:Arithmetic instructions manipulate numeric values, influencing flags that guide conditional execution. This question asks you to place three well-known instructions into their correct category.
Given Data / Assumptions:
- ADD performs integer addition and sets flags like carry and zero as appropriate.
- CMP subtracts operands to set flags but discards the result, enabling comparisons.
- MUL multiplies operands and sets flags/expands results according to the ISA.
Concept / Approach:All three affect numeric state or flags in a way tied to arithmetic semantics, so they are grouped under arithmetic rather than data movement or control flow.
Step-by-Step Solution:
Identify ADD and MUL as straightforward arithmetic.Recognize CMP as arithmetic comparison via subtraction without storing.Map to the “Arithmetic” instruction class.Choose “Arithmetic.”Verification / Alternative check:Instruction set documents categorize ADD/MUL/CMP with arithmetic/logic, distinct from data transfer and control operations.
Why Other Options Are Wrong:
Data transfer: No movement between locations is primary.Bit manipulation: Not purely logical masking or shifting.Loops and jumps: No branch or jump semantics.Common Pitfalls:Misclassifying CMP because it stores no result; its sole purpose is arithmetic comparison via flags.
Final Answer:Arithmetic