https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114760

--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Di Zhao <dz...@gcc.gnu.org>:

https://gcc.gnu.org/g:1b0919cd147a2b6ccdee2b1217bf0200bdcc87aa

commit r15-380-g1b0919cd147a2b6ccdee2b1217bf0200bdcc87aa
Author: dzhao.ampere <di.z...@amperecomputing.com>
Date:   Fri May 10 11:55:18 2024 +0800

    tree-optimization/114760 - check variants of >> and << in loop-niter

    When recognizing bit counting idiom, include pattern "x * 2"
    for "x << 1", and "x / 2" for "x >> 1" (given x is unsigned).

    gcc/ChangeLog:
            PR tree-optimization/114760
            * tree-ssa-loop-niter.cc (is_lshift_by_1): New function
            to check if STMT is equivalent to x << 1.
            (is_rshift_by_1): New function to check if STMT is
            equivalent to x >> 1.
            (number_of_iterations_cltz): Enhance the identification
            of logical shift by one.
            (number_of_iterations_cltz_complement): Enhance the
            identification of logical shift by one.

    gcc/testsuite/ChangeLog:
            PR tree-optimization/114760
            * gcc.dg/tree-ssa/pr114760-1.c: New test.
            * gcc.dg/tree-ssa/pr114760-2.c: New test.

Reply via email to