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

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by hongtao Liu <liuho...@gcc.gnu.org>:

https://gcc.gnu.org/g:57b30f0134d9b49f7707b0c2ded6fd7686a312c8

commit r14-1510-g57b30f0134d9b49f7707b0c2ded6fd7686a312c8
Author: liuhongt <hongtao....@intel.com>
Date:   Thu Jun 1 12:11:24 2023 +0800

    Don't try bswap + rotate when TYPE_PRECISION(n->type) > n->range.

    For the testcase in the PR, we have

      br64 = br;
      br64 = ((br64 << 16) & 0x000000ff00000000ull) | (br64 & 0x0000ff00ull);

      n->n: 0x3000000200.
      n->range: 32.
      n->type: uint64.

    The original code assumes n->range is same as TYPE PRECISION(n->type),
    and tries to rotate the mask from 0x300000200 -> 0x20300 which is
    incorrect. The patch fixed this bug by not trying bswap + rotate when
    TYPE_PRECISION(n->type) is not equal to n->range.

    gcc/ChangeLog:

            PR tree-optimization/110067
            * gimple-ssa-store-merging.cc (find_bswap_or_nop): Don't try
            bswap + rotate when TYPE_PRECISION(n->type) > n->range.

    gcc/testsuite/ChangeLog:

            * gcc.target/i386/pr110067.c: New test.

Reply via email to