From 7dba8395e27f52d22aa11ff2fc147858e34f2a9d Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Wed, 5 Feb 2003 14:37:54 -0800 Subject: 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 --- gcc/combine.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'gcc/combine.c') 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: -- cgit v1.1