fdiv

Floating-Point Divide (Scalar)

FDIV <Hd|Sd|Dd>, <Hn|Sn|Dn>, <Hm|Sm|Dm>

Divides two floating-point values.

Details

Divides one scalar floating-point operand by another and writes the result to the destination register. The operation respects IEEE 754 rounding modes and may generate floating-point exception conditions (invalid, overflow, underflow, inexact, divide-by-zero). The instruction operates on Half-precision (16-bit), Single-precision (32-bit), or Double-precision (64-bit) formats, determined by the type field. This is an AArch64-only instruction.

Pseudocode Operation

Rd ← FP_Divide(Rn, Rm)
if (type == 00) then operands are H-registers (16-bit)
else if (type == 01) then operands are S-registers (32-bit)
else if (type == 10) then operands are D-registers (64-bit)

Example

FDIV Dd, Dn, Dm

Encoding

Binary Layout
0
0
0
11110
00
1
Rm
0001
10
Rn
Rd
 
Format FP Data Processing
Opcode 0x1E201800
Extension Floating Point

Operands

  • Vd
    Destination SIMD/FP vector register
  • Vn
    Dividend
  • Vm
    Divisor

Reference (Arm A64 ISA)

Instruction Forms

Encoding Instruction ISA Bit pattern
0x2E403C00 FDIV <Vd>.<T>, <Vn>.<T>, <Vm>.<T> A64 0 | Q | 1 | 01110 | 0 | 10 | Rm | 00 | 111 | 1 | Rn | Rd
0x2E20FC00 FDIV <Vd>.<T>, <Vn>.<T>, <Vm>.<T> A64 0 | Q | 1 | 011100 | sz | 1 | Rm | 11111 | 1 | Rn | Rd
0x1EE01800 FDIV <Hd>, <Hn>, <Hm> A64 0 | 0 | 0 | 11110 | 11 | 1 | Rm | 0001 | 10 | Rn | Rd
0x1E201800 FDIV <Sd>, <Sn>, <Sm> A64 0 | 0 | 0 | 11110 | 00 | 1 | Rm | 0001 | 10 | Rn | Rd
0x1E601800 FDIV <Dd>, <Dn>, <Dm> A64 0 | 0 | 0 | 11110 | 01 | 1 | Rm | 0001 | 10 | Rn | Rd
0x650D8000 FDIV <Zdn>.<T>, <Pg>/M, <Zdn>.<T>, <Zm>.<T> A64 01100101 | size | 00 | 110 | 1 | 100 | Pg | Zm | Zdn

Description

Floating-point Divide (scalar). This instruction divides the floating-point value of the first source SIMD&FP register by the floating-point value of the second source SIMD&FP register, and writes the result to the destination SIMD&FP register. This instruction can generate a floating-point exception. Depending on the settings in FPCR, the exception results in either a flag being set in FPSR, or a synchronous exception being generated. For more information, see Floating-point exception traps. Depending on the settings in the CPACR_EL1, CPTR_EL2, and CPTR_EL3 registers, and the current Security state and Exception level, an attempt to execute the instruction might be trapped.

Operation

CheckFPEnabled64();
bits(esize) operand1 = V[n, esize];
bits(esize) operand2 = V[m, esize];

boolean merge = IsMerging(FPCR);
bits(128) result = if merge then V[n, 128] else Zeros(128);

Elem[result, 0, esize] = FPDiv(operand1, operand2, FPCR);

V[d, 128] = result;