https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45273

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot 
gnu.org

--- Comment #29 from Richard Biener <rguenth at gcc dot gnu.org> ---
Like the following which I am testing now:

-       /* Use FP math to avoid overflows of 32bit integers.  */
+       /* Use int64_t math to avoid overflows of 32bit integers.  */
        if (d == 0)
          /* If one probability is 0% and one 100%, avoid division by zero.  */
          combined_probability = REG_BR_PROB_BASE / 2;
        else
-         combined_probability = (((double) combined_probability) * probability
-                                 * REG_BR_PROB_BASE / d + 0.5);
+         combined_probability = ((((int64_t) combined_probability)
+                                  * probability
+                                  * REG_BR_PROB_BASE + (d / 2)) / d);

I can confirm that in gcc/ the only other remaining uses of 'double' are
for dumpfile contents.

Reply via email to