Skip to content

Commit 3727672

Browse files
authored
Improve workaround and keep compilers from optimizing it out
1 parent 108a21e commit 3727672

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

kernel/arm64/dznrm2_thunderx2t99.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2727

2828

2929
#include "common.h"
30-
30+
#include <float.h>
3131
#include <arm_neon.h>
3232

3333
#if defined(SMP)
@@ -344,6 +344,7 @@ FLOAT CNAME(BLASLONG n, FLOAT *x, BLASLONG inc_x)
344344
FLOAT dummy_alpha[2];
345345
#endif
346346
FLOAT ssq, scale;
347+
volatile FLOAT sca;
347348

348349
if (n <= 0 || inc_x <= 0) return 0.0;
349350

@@ -404,7 +405,8 @@ FLOAT CNAME(BLASLONG n, FLOAT *x, BLASLONG inc_x)
404405
#else
405406
nrm2_compute(n, x, inc_x, &ssq, &scale);
406407
#endif
407-
if (fabs(scale) <1.e-300) return 0.;
408+
sca = fabs(scale);
409+
if (sca < DBL_MIN) return 0.;
408410
ssq = sqrt(ssq) * scale;
409411

410412
return ssq;

0 commit comments

Comments
 (0)