summaryrefslogtreecommitdiff
path: root/gcc/omega.c
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2011-08-01 21:53:07 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2011-08-01 21:53:07 +0000
commit2fa63533bafde2e69dda053d1b5eb0bc7403d601 (patch)
treeb283fc957cb0e873ede675b16d01fe03cbf1bd48 /gcc/omega.c
parentc5a7bf9e4210918a6d64282bd3f9b58c5b92ee1c (diff)
downloadgcc-2fa63533bafde2e69dda053d1b5eb0bc7403d601.tar.gz
2011-08-01 Sebastian Pop <sebastian.pop@amd.com>
Joseph Myers <joseph@codesourcery.com> * Makefile.in (hwint.o): Depend on DIAGNOSTIC_CORE_H. * hwint.c: Include diagnostic-core.h. (abs_hwi): New. (gcd): Moved here... (pos_mul_hwi): New. (mul_hwi): New. (least_common_multiple): Moved here... * hwint.h (gcd): ... from here. (least_common_multiple): ... from here. (HOST_WIDE_INT_MIN): New. (HOST_WIDE_INT_MAX): New. (abs_hwi): Declared. (gcd): Declared. (pos_mul_hwi): Declared. (mul_hwi): Declared. (least_common_multiple): Declared. * omega.c (check_pos_mul): Removed. (check_mul): Removed. (omega_solve_geq): Use pos_mul_hwi instead of check_pos_mul and mul_hwi instead of check_mul. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177075 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/omega.c')
-rw-r--r--gcc/omega.c47
1 files changed, 8 insertions, 39 deletions
diff --git a/gcc/omega.c b/gcc/omega.c
index 1717f8e4524..c8768d8b441 100644
--- a/gcc/omega.c
+++ b/gcc/omega.c
@@ -110,37 +110,6 @@ int_mod (int a, int b)
return a - b * int_div (a, b);
}
-/* For X and Y positive integers, return X multiplied by Y and check
- that the result does not overflow. */
-
-static inline int
-check_pos_mul (int x, int y)
-{
- if (x != 0)
- gcc_assert ((INT_MAX) / x > y);
-
- return x * y;
-}
-
-/* Return X multiplied by Y and check that the result does not
- overflow. */
-
-static inline int
-check_mul (int x, int y)
-{
- if (x >= 0)
- {
- if (y >= 0)
- return check_pos_mul (x, y);
- else
- return -check_pos_mul (x, -y);
- }
- else if (y >= 0)
- return -check_pos_mul (-x, y);
- else
- return check_pos_mul (-x, -y);
-}
-
/* Test whether equation E is red. */
static inline bool
@@ -3907,8 +3876,8 @@ omega_solve_geq (omega_pb pb, enum omega_result desired_res)
max_splinters += -minC - 1;
else
max_splinters +=
- check_pos_mul ((pb->geqs[e].coef[i] - 1),
- (-minC - 1)) / (-minC) + 1;
+ pos_mul_hwi ((pb->geqs[e].coef[i] - 1),
+ (-minC - 1)) / (-minC) + 1;
}
/* #ifdef Omega3 */
@@ -4321,8 +4290,8 @@ omega_solve_geq (omega_pb pb, enum omega_result desired_res)
for (k = 0; k <= n_vars; k++)
pb->geqs[Ue].coef[k] =
- check_mul (pb->geqs[Ue].coef[k], Lc) +
- check_mul (lbeqn->coef[k], Uc);
+ mul_hwi (pb->geqs[Ue].coef[k], Lc) +
+ mul_hwi (lbeqn->coef[k], Uc);
if (dump_file && (dump_flags & TDF_DETAILS))
{
@@ -4384,8 +4353,8 @@ omega_solve_geq (omega_pb pb, enum omega_result desired_res)
for (k = n_vars; k >= 0; k--)
pb->geqs[e2].coef[k] =
- check_mul (pb->geqs[Ue].coef[k], Lc) +
- check_mul (pb->geqs[Le].coef[k], Uc);
+ mul_hwi (pb->geqs[Ue].coef[k], Lc) +
+ mul_hwi (pb->geqs[Le].coef[k], Uc);
pb->geqs[e2].coef[n_vars + 1] = 0;
pb->geqs[e2].touched = 1;
@@ -4506,8 +4475,8 @@ omega_solve_geq (omega_pb pb, enum omega_result desired_res)
{
for (k = n_vars; k >= 0; k--)
iS->geqs[e2].coef[k] = rS->geqs[e2].coef[k] =
- check_mul (pb->geqs[Ue].coef[k], Lc) +
- check_mul (pb->geqs[Le].coef[k], Uc);
+ mul_hwi (pb->geqs[Ue].coef[k], Lc) +
+ mul_hwi (pb->geqs[Le].coef[k], Uc);
iS->geqs[e2].coef[0] -= (Uc - 1) * (Lc - 1);
}