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

Uros Bizjak ubizjak@gmail.com
Fri Oct 21 15:33:00 GMT 2016


On Fri, Oct 21, 2016 at 5:31 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> 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.

I was expecting this answer ;)

Thanks, the patch is OK.

(I'll backport this and my patch to gcc-6 early next week).

Uros.



More information about the Gcc-patches mailing list