aboutsummaryrefslogtreecommitdiff
path: root/gcc/simplify-rtx.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2003-02-05 14:37:54 -0800
committerRichard Henderson <rth@gcc.gnu.org>2003-02-05 14:37:54 -0800
commit7dba8395e27f52d22aa11ff2fc147858e34f2a9d (patch)
treee14ea46575bce454a67edbb9d6bc03000c970bcd /gcc/simplify-rtx.c
parent8d705469aaefd27a439760de0c216ff036f92e11 (diff)
downloadgcc-7dba8395e27f52d22aa11ff2fc147858e34f2a9d.zip
gcc-7dba8395e27f52d22aa11ff2fc147858e34f2a9d.tar.gz
gcc-7dba8395e27f52d22aa11ff2fc147858e34f2a9d.tar.bz2
defaults.h (CLZ_DEFINED_VALUE_AT_ZERO): New.
* defaults.h (CLZ_DEFINED_VALUE_AT_ZERO): New. (CTZ_DEFINED_VALUE_AT_ZERO): New. * doc/rtl.texi, doc/tm.texi: Document them. * combine.c (nonzero_bits) [CLZ, CTZ]: Handle the definedness of the value at zero properly. * fold-const.c (tree_expr_nonnegative_p): Likewise. * simplify-rtx.c (simplify_unary_operation): Likewise. * config/alpha/alpha.h (CLZ_DEFINED_VALUE_AT_ZERO): New. (CTZ_DEFINED_VALUE_AT_ZERO): New. * config/arm/arm.c (TARGET_INIT_BUILTINS): Remove. (TARGET_EXPAND_BUILTIN): Remove. (def_builtin, arm_init_builtins, arm_expand_builtin): Remove. * config/arm/arm.h (CLZ_DEFINED_VALUE_AT_ZERO): New. (enum arm_builtins): Remove. * config/arm/arm.md (UNSPEC_CLZ): Remove. (clzsi2): Rename from clz; use clz instead of unspec. (ctzsi2): New. * config/arm/arm-protos.h: Update. From-SVN: r62453
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r--gcc/simplify-rtx.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 19d664b..0298b79e 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -449,14 +449,23 @@ simplify_unary_operation (code, mode, op, op_mode)
case CLZ:
arg0 &= GET_MODE_MASK (mode);
- val = GET_MODE_BITSIZE (mode) - floor_log2 (arg0) - 1;
+ if (arg0 == 0 && CLZ_DEFINED_VALUE_AT_ZERO (mode, val))
+ ;
+ else
+ val = GET_MODE_BITSIZE (mode) - floor_log2 (arg0) - 1;
break;
case CTZ:
arg0 &= GET_MODE_MASK (mode);
- val = arg0 == 0
- ? GET_MODE_BITSIZE (mode)
- : exact_log2 (arg0 & -arg0);
+ if (arg0 == 0)
+ {
+ /* Even if the value at zero is undefined, we have to come
+ up with some replacement. Seems good enough. */
+ if (! CTZ_DEFINED_VALUE_AT_ZERO (mode, val))
+ val = GET_MODE_BITSIZE (mode);
+ }
+ else
+ val = exact_log2 (arg0 & -arg0);
break;
case POPCOUNT: