vcmpe
Vector Compare Exception (VFP)
VCMPE<c>.F32 <Sd>, <Sm>
Compares values and raises exception on NaN.
Details
Compares two single-precision floating-point values in VFP registers and sets the FPSCR condition flags (N, Z, C, V) based on the comparison result. Unlike VCMP, this variant raises an Invalid Operation exception if either operand is NaN (signaling comparison). Executed in A32/T32 with VFP extension; exception behavior depends on FPSCR exception-enable bits.
Pseudocode Operation
if Sd is NaN or Sm is NaN then
if FPSCR.IXE then raise InvalidOperationException
result ← compare(Sd, Sm)
FPSCR.N ← result.N
FPSCR.Z ← result.Z
FPSCR.C ← result.C
FPSCR.V ← result.V
Example
VCMPE.F32 s0, s2
Encoding
Binary Layout
cond
11101
D
11
0
100
Vd
10
10
1
1
M
0
Vm
Operands
-
Sd
Destination 32-bit floating-point register -
Sm
Second source 32-bit floating-point register
Reference (Arm AArch32 ISA)
Instruction Forms
| Encoding | Instruction | ISA | Bit pattern | ||
|---|---|---|---|---|---|
| 0x0EB409C0 | VCMPE{<c>}{<q>}.F16 <Sd>, <Sm> | A32 | cond | 11101 | D | 11 | 0 | 100 | Vd | 10 | 01 | 1 | 1 | M | 0 | Vm | ||
| 0x0EB40AC0 | VCMPE{<c>}{<q>}.F32 <Sd>, <Sm> | A32 | cond | 11101 | D | 11 | 0 | 100 | Vd | 10 | 10 | 1 | 1 | M | 0 | Vm | ||
| 0x0EB40BC0 | VCMPE{<c>}{<q>}.F64 <Dd>, <Dm> | A32 | cond | 11101 | D | 11 | 0 | 100 | Vd | 10 | 11 | 1 | 1 | M | 0 | Vm | ||
| 0x0EB509C0 | VCMPE{<c>}{<q>}.F16 <Sd>, #0.0 | A32 | cond | 11101 | D | 11 | 0 | 101 | Vd | 10 | 01 | 1 | 1 | 0 | 0 | 0000 | ||
| 0x0EB50AC0 | VCMPE{<c>}{<q>}.F32 <Sd>, #0.0 | A32 | cond | 11101 | D | 11 | 0 | 101 | Vd | 10 | 10 | 1 | 1 | 0 | 0 | 0000 | ||
| 0x0EB50BC0 | VCMPE{<c>}{<q>}.F64 <Dd>, #0.0 | A32 | cond | 11101 | D | 11 | 0 | 101 | Vd | 10 | 11 | 1 | 1 | 0 | 0 | 0000 | ||
| 0xEEB409C0 | VCMPE{<c>}{<q>}.F16 <Sd>, <Sm> | T32 | 111011101 | D | 11 | 0 | 100 | Vd | 10 | 01 | 1 | 1 | M | 0 | Vm | ||
| 0xEEB40AC0 | VCMPE{<c>}{<q>}.F32 <Sd>, <Sm> | T32 | 111011101 | D | 11 | 0 | 100 | Vd | 10 | 10 | 1 | 1 | M | 0 | Vm | ||
| 0xEEB40BC0 | VCMPE{<c>}{<q>}.F64 <Dd>, <Dm> | T32 | 111011101 | D | 11 | 0 | 100 | Vd | 10 | 11 | 1 | 1 | M | 0 | Vm | ||
| 0xEEB509C0 | VCMPE{<c>}{<q>}.F16 <Sd>, #0.0 | T32 | 111011101 | D | 11 | 0 | 101 | Vd | 10 | 01 | 1 | 1 | 0 | 0 | 0000 | ||
| 0xEEB50AC0 | VCMPE{<c>}{<q>}.F32 <Sd>, #0.0 | T32 | 111011101 | D | 11 | 0 | 101 | Vd | 10 | 10 | 1 | 1 | 0 | 0 | 0000 | ||
| 0xEEB50BC0 | VCMPE{<c>}{<q>}.F64 <Dd>, #0.0 | T32 | 111011101 | D | 11 | 0 | 101 | Vd | 10 | 11 | 1 | 1 | 0 | 0 | 0000 |
Description
Vector Compare, raising Invalid Operation on NaN compares two floating-point registers, or one floating-point register and zero. It writes the result to the FPSCR flags. These are normally transferred to the PSTATE.{N, Z, C, V} Condition flags by a subsequent VMRS instruction.
This instruction raises an Invalid Operation floating-point exception if either or both of the operands is any type of NaN.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the Security state and PE mode in which the instruction is executed, an attempt to execute the instruction might be undefined, or trapped to Hyp mode. For more information see Enabling Advanced SIMD and floating-point support.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckVFPEnabled(TRUE);
bits(4) nzcv;
case esize of
when 16
bits(16) op16 = if with_zero then FPZero('0', 16) else S[m]<15:0>;
nzcv = FPCompare(S[d]<15:0>, op16, quiet_nan_exc, FPSCR[]);
when 32
bits(32) op32 = if with_zero then FPZero('0', 32) else S[m];
nzcv = FPCompare(S[d], op32, quiet_nan_exc, FPSCR[]);
when 64
bits(64) op64 = if with_zero then FPZero('0', 64) else D[m];
nzcv = FPCompare(D[d], op64, quiet_nan_exc, FPSCR[]);
FPSCR<31:28> = nzcv; // FPSCR.<N,Z,C,V> set to nzcv