diff options
Diffstat (limited to 'compiler-rt/lib/builtins/divsf3.c')
| -rw-r--r-- | compiler-rt/lib/builtins/divsf3.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/compiler-rt/lib/builtins/divsf3.c b/compiler-rt/lib/builtins/divsf3.c index 97cbcc1960b..944524749e9 100644 --- a/compiler-rt/lib/builtins/divsf3.c +++ b/compiler-rt/lib/builtins/divsf3.c @@ -147,6 +147,18 @@ __divsf3(fp_t a, fp_t b) { } else if (writtenExponent < 1) { + if (writtenExponent == 0) { + // Check whether the rounded result is normal. + const bool round = (residual << 1) > bSignificand; + // Clear the implicit bit. + rep_t absResult = quotient & significandMask; + // Round. + absResult += round; + if (absResult & ~significandMask) { + // The rounded result is normal; return it. + return fromRep(absResult | quotientSign); + } + } // Flush denormals to zero. In the future, it would be nice to add // code to round them correctly. return fromRep(quotientSign); |

