diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-08-18 11:30:42 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-08-18 11:30:42 +0000 |
commit | b1757d46a6ec2a81b4e2cb78df5ec3e2e5567d5e (patch) | |
tree | fbdfd26aa897edd883893073cf2f3b2ed9769b4a /gcc/hwint.c | |
parent | 2ad5f5fc44b63e7b56516a47ca7417ea74d7d162 (diff) | |
download | gcc-b1757d46a6ec2a81b4e2cb78df5ec3e2e5567d5e.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177848 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/hwint.c')
-rw-r--r-- | gcc/hwint.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/hwint.c b/gcc/hwint.c index a128dc134f9..533133c7b4d 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. */ |