CHAPTER 5Data Processing Instructions

This chapter introduces data processing instructions and their instruction forms, including arithmetic, logical, shift operations, and bitfield manipulation operations, as well as multiply and divide instructions. Data processing instructions perform operations on values in general‐purpose registers, and their basic syntax typically consists of two source operands and one destination register, as follows:

mneumonic     Rd, Rn, operand2
 

The operands for any given instruction depend on the type of instruction being executed. Data processing instructions always list destination registers first, followed by the inputs to the instruction. In this chapter, you will see destination registers denoted as Rd for A32/T32, and Xd or Wd for A64 instructions. Input registers are denoted Rm, Rn, or Ra for A32/T32 and Xn or Xm for A64. Since the syntax of various instructions has more components than source and destination registers, you will see an overview of the syntax symbols used for a particular group or class of instructions at the beginning of each section.

When reading or writing assembly, the instruction opcode, i.e., the operation, is given first, followed by any destination registers, and finally any source operands. In the following example, the instruction ADD adds together two 64‐bit source register values, X1 and X2, and stores the 64‐bit result in register x0.

add x0, x1, x2 ; x0 = x1 + x2
  

In A64, arithmetic instructions can set arithmetic ...

Get Blue Fox now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.