Skip to content

Commit

Permalink
MIPS: use pufirfyNaN for substraction result in slow_op_sub
Browse files Browse the repository at this point in the history
On MIPS, glibc's slowfp implementation of double substraction yields an
impure NaN.
  • Loading branch information
guijemont committed Nov 6, 2015
1 parent 206e3df commit bcb5650
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Source/JavaScriptCore/runtime/CommonSlowPaths.cpp
Expand Up @@ -386,7 +386,14 @@ SLOW_PATH_DECL(slow_path_sub)
BEGIN();
double a = OP_C(2).jsValue().toNumber(exec);
double b = OP_C(3).jsValue().toNumber(exec);

#if CPU(MIPS) && defined(__GLIBC__)
// on MIPS, the GLIBC version of the softfp double substraction sometimes
// returns impure NaNs
RETURN(jsNumber(purifyNaN(a - b)));
#else
RETURN(jsNumber(a - b));
#endif
}

SLOW_PATH_DECL(slow_path_div)
Expand Down

0 comments on commit bcb5650

Please sign in to comment.