ispc / ispc

Intel® Implicit SPMD Program Compiler
BSD 3-Clause "New" or "Revised" License
2.5k stars 314 forks source link

NaN handling on ARM NEON for min/max #3048

Closed johguenther closed 1 week ago

johguenther commented 2 weeks ago

For min (analog for max) ISPC issues fmin or vmin instructions, which are not IEEE 754 compliant: in case any operand is NaN then NaN is the result. I suggest to better choose the alternative instructions fminnm / vminnm: those follow IEEE 754 and select the numerical value instead if NaN is one operand and are thus consistent to x86 behavior. OSPRay uses min/max to filter out NaNs.

aneshlya commented 1 week ago

Will be fixed in v1.25.0. Be aware that vminnm/vmaxnm will not be generated by default for --arch=arm. In addition you need to specify --cpu=cortex-a35 or newer. fminnm/fmaxnm will be generated by default when --arch=aarch64 is selected.