adc

Add with Carry

ADC <Wd>, <Wn>, <Wm>

Adds two register values and the Carry flag.

Details

Adds Wn and Wm plus the Carry flag (C), placing the 32-bit result in Wd. The C flag is read but not modified by this instruction; use ADCS to update flags. Execution is available in AArch64 only.

Pseudocode Operation

result ← Wn + Wm + C
Wd ← result[0:31]

Example

ADC w0, w1, w2

Encoding

Binary Layout
0
0
0
11010000
Rm
000000
Rn
Rd
 
Format Data Processing (3-source)
Opcode 0x1A000000
Extension Base

Operands

  • Wd
    Dest (32-bit)
  • Wn
    First source / base 32-bit integer register
  • Wm
    Second source / offset 32-bit integer register

Reference (Arm A64 ISA)

Instruction Forms

Encoding Instruction ISA Bit pattern
0x1A000000 ADC <Wd>, <Wn>, <Wm> A64 0 | 0 | 0 | 11010000 | Rm | 000000 | Rn | Rd
0x9A000000 ADC <Xd>, <Xn>, <Xm> A64 1 | 0 | 0 | 11010000 | Rm | 000000 | Rn | Rd

Description

Add with Carry adds two register values and the Carry flag value, and writes the result to the destination register.

Operation

bits(datasize) result;
bits(datasize) operand1 = X[n, datasize];
bits(datasize) operand2 = X[m, datasize];

(result, -) = AddWithCarry(operand1, operand2, PSTATE.C);

X[d, datasize] = result;