[PATCH] Fold __builtin_ia32_[tl]zcnt_u{16,32,64} (PR target/78057)

Jakub Jelinek jakub@redhat.com
Fri Oct 21 15:31:00 GMT 2016


On Fri, Oct 21, 2016 at 05:28:42PM +0200, Uros Bizjak wrote:
> On Fri, Oct 21, 2016 at 5:23 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> > Hi!
> >
> > This patch adds folding for the new ia32 md builtins.
> > If they can be folded into constant, it is done in ix86_fold_builtin,
> > if they can fold to corresponding generic __builtin_c[lt]z* (which have
> > e.g. the advantage that VRP knows about what values it can have etc.),
> > it is done in gimple_fold_builtin target hook.
> 
> Are you sure that there is no way zero will be passed to generic
> __builtin_c[lt]z?

The patch only folds the ia32 specific builtins into __builtin_c[lt]z, if
the argument is known not to be 0 (from VRP).
That is the expr_not_equal_to call, which uses get_range_info under the
hood.

	Jakub



More information about the Gcc-patches mailing list