aboutsummaryrefslogtreecommitdiff
path: root/gcc/combine.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/combine.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/combine.c')
-rw-r--r--gcc/combine.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index aeb5c2f..6566823 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -8547,11 +8547,28 @@ nonzero_bits (x, mode)
break;
case FFS:
- case CLZ:
- case CTZ:
case POPCOUNT:
/* This is at most the number of bits in the mode. */
- nonzero = ((HOST_WIDE_INT) 1 << (floor_log2 (mode_width) + 1)) - 1;
+ nonzero = ((HOST_WIDE_INT) 2 << (floor_log2 (mode_width))) - 1;
+ break;
+
+ case CLZ:
+ /* If CLZ has a known value at zero, then the nonzero bits are
+ that value, plus the number of bits in the mode minus one. */
+ if (CLZ_DEFINED_VALUE_AT_ZERO (mode, nonzero))
+ nonzero |= ((HOST_WIDE_INT) 1 << (floor_log2 (mode_width))) - 1;
+ else
+ nonzero = -1;
+ break;
+
+ case CTZ:
+ /* If CTZ has a known value at zero, then the nonzero bits are
+ that value, plus the number of bits in the mode minus one. */
+ if (CTZ_DEFINED_VALUE_AT_ZERO (mode, nonzero))
+ nonzero |= ((HOST_WIDE_INT) 1 << (floor_log2 (mode_width))) - 1;
+ else
+ nonzero = -1;
+ break;
break;
case PARITY: