ia32: Fix calculation bug in ia32_get_op_estimated_cost() of the latency of CopyB_i.
authorChristoph Mallon <christoph.mallon@gmx.de>
Tue, 18 Dec 2012 09:39:38 +0000 (10:39 +0100)
committerChristoph Mallon <christoph.mallon@gmx.de>
Tue, 18 Dec 2012 09:39:38 +0000 (10:39 +0100)
4 / 3 * x is x, so use x * 4 / 3.

ir/be/ia32/bearch_ia32.c

index 39c8cc3..6cc7ed4 100644 (file)
@@ -12,9 +12,6 @@
 
 #include "lc_opts.h"
 #include "lc_opts_enum.h"
-
-#include <math.h>
-
 #include "irarch.h"
 #include "irgwalk.h"
 #include "irprog.h"
@@ -309,7 +306,7 @@ static int ia32_get_op_estimated_cost(const ir_node *irn)
 
        if (is_ia32_CopyB_i(irn)) {
                int size = get_ia32_copyb_size(irn);
-               cost     = 20 + (int)ceil((4/3) * size);
+               cost     = 20 + size * 4 / 3;
        }
        /* in case of address mode operations add additional cycles */
        else if (op_tp == ia32_AddrModeD || op_tp == ia32_AddrModeS) {