aboutsummaryrefslogtreecommitdiff
path: root/gcc/builtins.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2013-07-06 11:34:17 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2013-07-06 11:34:17 +0200
commit1f6eac9041e87e273c2b955a309ed44364f41544 (patch)
tree5c06ed10d38755e166140f77dd83928e972b3462 /gcc/builtins.c
parent5504e5d864f7b9c83727669847396c639abdf77b (diff)
downloadgcc-1f6eac9041e87e273c2b955a309ed44364f41544.zip
gcc-1f6eac9041e87e273c2b955a309ed44364f41544.tar.gz
gcc-1f6eac9041e87e273c2b955a309ed44364f41544.tar.bz2
re PR target/29776 (result of ffs/clz/ctz/popcount/parity are already sign-extended)
PR target/29776 * fold-const.c (tree_call_nonnegative_warnv_p): Return true for BUILT_IN_C{LZ,LRSB}*. * tree.h (CASE_INT_FN): Add FN##IMAX case. * tree-vrp.c (extract_range_basic): Handle BUILT_IN_{FFS,PARITY,POPCOUNT,C{LZ,TZ,LRSB}}*. For BUILT_IN_CONSTANT_P if argument isn't (D) of PARM_DECL, fall thru to code calling set_value*. * builtins.c (expand_builtin): Remove *IMAX cases. (fold_builtin_bitop): For BUILT_IN_CLRSB* return NULL_TREE if width is bigger than 2*HWI. * libgcc2.c (__floattisf): Avoid undefined signed overflow. * gcc.dg/tree-ssa/vrp89.c: New test. From-SVN: r200731
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r--gcc/builtins.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 6bd045c..78b0d84 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -6107,7 +6107,6 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
break;
CASE_INT_FN (BUILT_IN_FFS):
- case BUILT_IN_FFSIMAX:
target = expand_builtin_unop (target_mode, exp, target,
subtarget, ffs_optab);
if (target)
@@ -6115,7 +6114,6 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
break;
CASE_INT_FN (BUILT_IN_CLZ):
- case BUILT_IN_CLZIMAX:
target = expand_builtin_unop (target_mode, exp, target,
subtarget, clz_optab);
if (target)
@@ -6123,7 +6121,6 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
break;
CASE_INT_FN (BUILT_IN_CTZ):
- case BUILT_IN_CTZIMAX:
target = expand_builtin_unop (target_mode, exp, target,
subtarget, ctz_optab);
if (target)
@@ -6131,7 +6128,6 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
break;
CASE_INT_FN (BUILT_IN_CLRSB):
- case BUILT_IN_CLRSBIMAX:
target = expand_builtin_unop (target_mode, exp, target,
subtarget, clrsb_optab);
if (target)
@@ -6139,7 +6135,6 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
break;
CASE_INT_FN (BUILT_IN_POPCOUNT):
- case BUILT_IN_POPCOUNTIMAX:
target = expand_builtin_unop (target_mode, exp, target,
subtarget, popcount_optab);
if (target)
@@ -6147,7 +6142,6 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
break;
CASE_INT_FN (BUILT_IN_PARITY):
- case BUILT_IN_PARITYIMAX:
target = expand_builtin_unop (target_mode, exp, target,
subtarget, parity_optab);
if (target)
@@ -8152,6 +8146,8 @@ fold_builtin_bitop (tree fndecl, tree arg)
break;
CASE_INT_FN (BUILT_IN_CLRSB):
+ if (width > 2 * HOST_BITS_PER_WIDE_INT)
+ return NULL_TREE;
if (width > HOST_BITS_PER_WIDE_INT
&& (hi & ((unsigned HOST_WIDE_INT) 1
<< (width - HOST_BITS_PER_WIDE_INT - 1))) != 0)