fmaxnm
Floating-Point Max Number (Scalar)
FMAXNM <Hd|Sd|Dd>, <Hn|Sn|Dn>, <Hm|Sm|Dm>
Returns larger value, handling NaNs according to IEEE 754-2008 'maxNum'.
Details
Floating-point maximum number: returns the larger of two floating-point numbers Vn and Vm according to IEEE 754-2008 'maxNum' semantics, where if one operand is NaN and the other is a number, the number is returned. Supports half-precision (H), single-precision (S), and double-precision (D) floating-point formats. No condition flags are affected; exceptions may be generated for invalid operations or input denormals depending on FPCR settings. AArch64 only.
Pseudocode Operation
if HaveFPExt() then
Vd ← FPMaxNum(Vn, Vm)
else
UNDEFINED
Example
FMAXNM Dd, Dn, Dm
Encoding
Binary Layout
0
0
0
11110
00
1
Rm
01
10
10
Rn
Rd
Operands
-
Vd
Destination SIMD/FP vector register -
Vn
First source SIMD/FP vector register -
Vm
Second source SIMD/FP vector register
Reference (Arm A64 ISA)
Instruction Forms
| Encoding | Instruction | ISA | Bit pattern | ||
|---|---|---|---|---|---|
| 0x0E400400 | FMAXNM <Vd>.<T>, <Vn>.<T>, <Vm>.<T> | A64 | 0 | Q | 0 | 01110 | 0 | 10 | Rm | 00 | 000 | 1 | Rn | Rd | ||
| 0x0E20C400 | FMAXNM <Vd>.<T>, <Vn>.<T>, <Vm>.<T> | A64 | 0 | Q | 0 | 01110 | 0 | sz | 1 | Rm | 11000 | 1 | Rn | Rd | ||
| 0x1EE06800 | FMAXNM <Hd>, <Hn>, <Hm> | A64 | 0 | 0 | 0 | 11110 | 11 | 1 | Rm | 01 | 10 | 10 | Rn | Rd | ||
| 0x1E206800 | FMAXNM <Sd>, <Sn>, <Sm> | A64 | 0 | 0 | 0 | 11110 | 00 | 1 | Rm | 01 | 10 | 10 | Rn | Rd | ||
| 0x1E606800 | FMAXNM <Dd>, <Dn>, <Dm> | A64 | 0 | 0 | 0 | 11110 | 01 | 1 | Rm | 01 | 10 | 10 | Rn | Rd | ||
| 0xC120A120 | FMAXNM { <Zdn1>.<T>-<Zdn2>.<T> }, { <Zdn1>.<T>-<Zdn2>.<T> }, <Zm>.<T> | A64 | 11000001 | size | 10 | Zm | 101000 | 0100 | 1 | Zdn | 0 | ||
| 0xC120A920 | FMAXNM { <Zdn1>.<T>-<Zdn4>.<T> }, { <Zdn1>.<T>-<Zdn4>.<T> }, <Zm>.<T> | A64 | 11000001 | size | 10 | Zm | 101010 | 0100 | 1 | Zdn | 0 | 0 | ||
| 0xC120B120 | FMAXNM { <Zdn1>.<T>-<Zdn2>.<T> }, { <Zdn1>.<T>-<Zdn2>.<T> }, { <Zm1>.<T>-<Zm2>.<T> } | A64 | 11000001 | size | 1 | Zm | 0101100 | 010 | 0 | 1 | Zdn | 0 | ||
| 0xC120B920 | FMAXNM { <Zdn1>.<T>-<Zdn4>.<T> }, { <Zdn1>.<T>-<Zdn4>.<T> }, { <Zm1>.<T>-<Zm4>.<T> } | A64 | 11000001 | size | 1 | Zm | 00101110 | 010 | 0 | 1 | Zdn | 0 | 0 | ||
| 0x651C8000 | FMAXNM <Zdn>.<T>, <Pg>/M, <Zdn>.<T>, <const> | A64 | 01100101 | size | 011 | 10 | 0 | 100 | Pg | 0000 | i1 | Zdn | ||
| 0x65048000 | FMAXNM <Zdn>.<T>, <Pg>/M, <Zdn>.<T>, <Zm>.<T> | A64 | 01100101 | size | 00 | 010 | 0 | 100 | Pg | Zm | Zdn |
Description
Floating-point Maximum Number (scalar). This instruction compares the first and second source SIMD&FP register values, and writes the larger of the two floating-point values to the destination SIMD&FP register.
Regardless of the value of FPCR.AH, the behavior is as follows:
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] = FPMaxNum(operand1, operand2, FPCR); V[d, 128] = result;