3
votes

How is the behavior of the ARM Neon float-to-integer conversion instructions vcvt.s32.f32 and vcvt.u32.f32 defined in case of overflows? Can you rely upon the behavior that I observed on a particular processor, i.e. that the result is saturated? Any links to official documentation are highly appreciated.

1

1 Answers

3
votes

The ARM Architecture Reference Manual is the source of all answers for this sort of question. In section A8.8.305 it says:

The floating-point to integer operation uses the Round towards Zero rounding mode.

And in the Glossary it clarifies:

Round towards Zero (RZ) mode Means that results are rounded to the nearest representable number that is no greater in magnitude than the unrounded result.

(Which is the same meaning for "Round towards Zero" as in IEEE 754.)

The gory details are in the pseudocode for FPToFixed and FPUnpack.

So, in short: yes, the result is guaranteed to be saturated.