From 3cc693df0b2892cc878dcd0f3cfa5947da088b3e Mon Sep 17 00:00:00 2001 From: Subv Date: Mon, 8 May 2017 14:25:33 -0500 Subject: [PATCH] Dyncom/VFP: Properly pack QNaN values. vfp_*_normaliseround was previously converting qnans into numbers, ie, 7fc00000 (qnan) into 7f000000 (1.7014118e+38). Closes #2680 --- src/core/arm/skyeye_common/vfp/vfpdouble.cpp | 4 +++- src/core/arm/skyeye_common/vfp/vfpsingle.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/core/arm/skyeye_common/vfp/vfpdouble.cpp b/src/core/arm/skyeye_common/vfp/vfpdouble.cpp index 2886f351f..452d16049 100644 --- a/src/core/arm/skyeye_common/vfp/vfpdouble.cpp +++ b/src/core/arm/skyeye_common/vfp/vfpdouble.cpp @@ -90,10 +90,12 @@ u32 vfp_double_normaliseround(ARMul_State* state, int dd, struct vfp_double* vd, vfp_double_dump("pack: in", vd); + int td = vfp_double_type(vd); + /* * Infinities and NaNs are a special case. */ - if (vd->exponent == 2047 && (vd->significand == 0 || exceptions)) + if (td & (VFP_NAN | VFP_INFINITY)) goto pack; /* diff --git a/src/core/arm/skyeye_common/vfp/vfpsingle.cpp b/src/core/arm/skyeye_common/vfp/vfpsingle.cpp index 1590d89a4..3b51f4f9c 100644 --- a/src/core/arm/skyeye_common/vfp/vfpsingle.cpp +++ b/src/core/arm/skyeye_common/vfp/vfpsingle.cpp @@ -90,10 +90,12 @@ u32 vfp_single_normaliseround(ARMul_State* state, int sd, struct vfp_single* vs, vfp_single_dump("pack: in", vs); + int ts = vfp_single_type(vs); + /* * Infinities and NaNs are a special case. */ - if (vs->exponent == 255 && (vs->significand == 0 || exceptions)) + if (ts & (VFP_NAN | VFP_INFINITY)) goto pack; /*