Search code examples
simdintrinsicsavx512

What is meant by "fixing up" floats?


I was looking through the instruction set in AVX-512 and noticed a set of fixup instructions. Some examples:

_mm512_fixupimm_pd, 
_mm512_mask_fixupimm_pd, 
_mm512_maskz_fixupimm_pd

_mm512_fixupimm_round_pd, 
_mm512_mask_fixupimm_round_pd, 
_mm512_maskz_fixupimm_round_pd

What is meant here by "fixing up"?


Solution

  • That's a great question. Intel's answer (my bold) is here:

    This instruction is specifically intended for use in fixing up the results of arithmetic calculations involving one source so that they match the spec, although it is generally useful for fixing up the results of multiple-instruction sequences to reflect special-number inputs. For example, consider rcp(0). Input 0 to rcp, and you should get INF according to the DX10 spec. However, evaluating rcp via Newton-Raphson, where x=approx(1/0), yields an incorrect result. To deal with this, VFIXUPIMMPS can be used after the N-R reciprocal sequence to set the result to the correct value (i.e. INF when the input is 0).

    Look for VFIXUPIMMPD in:

    https://software.intel.com/sites/default/files/managed/0d/53/319433-022.pdf