The HLSL compiler incorrectly decides isnan can't be true, so this workaround was originally added in 52c82733 but lost during the conversion to SPIR-V.