]> git.ipfire.org Git - thirdparty/gcc.git/commit
ranger: Improve CLZ fold_range [PR115337]
authorJakub Jelinek <jakub@redhat.com>
Tue, 4 Jun 2024 14:16:49 +0000 (16:16 +0200)
committerJakub Jelinek <jakub@redhat.com>
Tue, 4 Jun 2024 14:16:49 +0000 (16:16 +0200)
commit591d30c5c97e757f63ce0d99ae9a3dbe8c75a50a
treeaa773d49def70b17ba64071998e7d3867fbad4da
parent181861b072ff1ef650c1a9d0290a4a672b9e747c
ranger: Improve CLZ fold_range [PR115337]

cfn_ctz::fold_range includes special cases for the case where .CTZ has
two arguments and so is well defined at zero, and the second argument is
equal to prec or -1, but cfn_clz::fold_range does that only for the prec
case.  -1 is fairly common as well though, because the <stdbit.h> builtins
do use it now, so I think it is worth special casing that.
If we don't know anything about the argument, the difference for
.CLZ (arg, -1) is that previously the result was varying, now it will be
[-1, prec-1].  If we knew arg can't be zero, it used to be optimized before
as well into e.g. [0, prec-1] or similar.

2024-06-04  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/115337
* gimple-range-op.cc (cfn_clz::fold_range): For
m_gimple_call_internal_p handle as a special case also second argument
of -1 next to prec.
gcc/gimple-range-op.cc