aboutsummaryrefslogtreecommitdiff
path: root/gcc/hwint.c
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2011-08-18 11:30:42 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2011-08-18 11:30:42 +0000
commit4c9cf7af89d0800e1f8fdeeba03ea41cdc3115f1 (patch)
treefbdfd26aa897edd883893073cf2f3b2ed9769b4a /gcc/hwint.c
parent97919ae7b65c192b0fdb6dfa6abdebd63a3f4ba9 (diff)
downloadgcc-4c9cf7af89d0800e1f8fdeeba03ea41cdc3115f1.zip
gcc-4c9cf7af89d0800e1f8fdeeba03ea41cdc3115f1.tar.gz
gcc-4c9cf7af89d0800e1f8fdeeba03ea41cdc3115f1.tar.bz2
re PR tree-optimization/49963 (ICE: in abs_hwi, at hwint.c:108)
2011-08-18 Paolo Carlini <paolo.carlini@oracle.com> Joseph Myers <joseph@codesourcery.com> PR tree-optimization/49963 * hwint.c (absu_hwi): Define. * hwint.h (absu_hwi): Declare. * fold-const.c (fold_plusminus_mult_expr): Use absu_hwi instead of abs_hwi. * tree-ssa-math-opts.c (gimple_expand_builtin_pow): Likewise. * tree-ssa-loop-prefetch.c (prune_ref_by_group_reuse): Likewise. Co-Authored-By: Joseph Myers <joseph@codesourcery.com> From-SVN: r177848
Diffstat (limited to 'gcc/hwint.c')
-rw-r--r--gcc/hwint.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/hwint.c b/gcc/hwint.c
index a128dc1..533133c 100644
--- a/gcc/hwint.c
+++ b/gcc/hwint.c
@@ -109,6 +109,14 @@ abs_hwi (HOST_WIDE_INT x)
return x >= 0 ? x : -x;
}
+/* Compute the absolute value of X as an unsigned type. */
+
+unsigned HOST_WIDE_INT
+absu_hwi (HOST_WIDE_INT x)
+{
+ return x >= 0 ? (unsigned HOST_WIDE_INT)x : -(unsigned HOST_WIDE_INT)x;
+}
+
/* Compute the greatest common divisor of two numbers A and B using
Euclid's algorithm. */